From patchwork Mon Jun 26 11:31:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 13292716 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2F80EB64DC for ; Mon, 26 Jun 2023 11:33:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 417F38D0006; Mon, 26 Jun 2023 07:33:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A1CD8D0001; Mon, 26 Jun 2023 07:33:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21BC78D0006; Mon, 26 Jun 2023 07:33:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 0C5728D0001 for ; Mon, 26 Jun 2023 07:33:35 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BEAA6C06ED for ; Mon, 26 Jun 2023 11:33:33 +0000 (UTC) X-FDA: 80944688706.26.ADC0FBE Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf22.hostedemail.com (Postfix) with ESMTP id E1CA2C0012 for ; Mon, 26 Jun 2023 11:33:31 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=O8ZENYso; spf=pass (imf22.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.172 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=quarantine) header.from=collabora.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687779212; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tflQA2AK1JIQFWo9owKIh7PFUAY4ms+DpXRjqJjPVaI=; b=DwsaeW+dZpV2OiHMIoRYrSYvkH5b5FWBX3AyZDEkkeMdIxmLQTPZUnUnsXSXWvLDGIfwE5 0BSaND6IUw2Z7MWniJnm7TFZi9oVqJVGrUgK/Vqzn8dMPBmOI0XsNSBk//lyvLocIiltr4 D/RBjs8rQsPR9wpYJOcgKp844xHGCWk= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=O8ZENYso; spf=pass (imf22.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.172 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=quarantine) header.from=collabora.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687779212; a=rsa-sha256; cv=none; b=wWXFREcg8O5VXHr5NMPGFafd30Z9M4nKWZ8UGGy08NWTYPCZSHl1P7B43Xx/zGHDsc3TDU qbUF4fSBroR8OtBwzfMrwElkRu1BTdVKv2xt2if57cDHNHyUDxJj2HDLp0tV/tKwlL8HKD OEIOZ1a0Ro4cdLW1bdE15YsSYH/Ll6g= Received: from localhost.localdomain (unknown [182.179.162.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madras.collabora.co.uk (Postfix) with ESMTPSA id E0178660714F; Mon, 26 Jun 2023 12:33:19 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1687779210; bh=DAOwVTuhGwSLTXi2XkXO+pqlt7qRt0sZ4TECXHyflfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O8ZENYso2s3mO6kT3JFuwzToFRTrU4T04lGLUxfYGSE6isZFX1Q6dJhVoOwgkOQ6B amgOZNcJXuQBwSdzLjAyWUDs3q2Q5e1NCk0f7s1D/W2cN0FTK8FTPCisfrFmO8oE66 ijdwBUkgDzrsjmS7/z06XlxghF4AwMMlpMFVX9UeBe+ZRKjz/EMpnhdNGLACyh6ljc CjK7HYrBlpciipruQlaEoyeqY2vNshNqFKda3dJl+PeQ7N6C4WP0D3NBm3kIcyT+zJ xzqNGFdL9ZdqhA+yGSFMRT+/jKMaOGJQcwv0M8tOPUAdOWuvyLop4KfGTamVKyFeKW rTswlNeYkr6iw== From: Muhammad Usama Anjum To: Peter Xu , David Hildenbrand , Andrew Morton , =?utf-8?b?TWljaGHFgiBNaXJvc8WC?= =?utf-8?b?YXc=?= , Andrei Vagin , Danylo Mocherniuk , Paul Gofman , Cyrill Gorcunov , Mike Rapoport , Nadav Amit Cc: Alexander Viro , Shuah Khan , Christian Brauner , Yang Shi , Vlastimil Babka , "Liam R . Howlett" , Yun Zhou , Suren Baghdasaryan , Alex Sierra , Muhammad Usama Anjum , Matthew Wilcox , Pasha Tatashin , Axel Rasmussen , "Gustavo A . R . Silva" , Dan Williams , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Greg KH , kernel@collabora.com Subject: [PATCH v21 3/5] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Mon, 26 Jun 2023 16:31:54 +0500 Message-Id: <20230626113156.1274521-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230626113156.1274521-1-usama.anjum@collabora.com> References: <20230626113156.1274521-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: E1CA2C0012 X-Rspam-User: X-Stat-Signature: dm8goc1x7fwkzn9i73wdn59tbpgzngoi X-Rspamd-Server: rspam01 X-HE-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amyzT7+Hqw8QxDxGPeC8o3F6d7kyvdl+aZOpcKFo8/9MeytDmHJV/Rpidbx2ePWYu+/7co7lDj9vB2dlUnacU79e+CRo4nCz6w4gx+rjARh4PwZVoLHGdpjP7QDN/aWBhPebMpEaUxw/IcKdt6rK1fZX5eX8NFqZ1QsEN39YwFskR/eBBo3yx6Ul//2GHFNGQe05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: New IOCTL and macros has been added in the kernel sources. Update the tools header file as well. Signed-off-by: Muhammad Usama Anjum --- Changes in v20: - Update tools/include/uapi/linux/fs.h Changes in v19: - Update fs.h accourding to precious patch --- tools/include/uapi/linux/fs.h | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tools/include/uapi/linux/fs.h b/tools/include/uapi/linux/fs.h index b7b56871029c..00dba03d4b8f 100644 --- a/tools/include/uapi/linux/fs.h +++ b/tools/include/uapi/linux/fs.h @@ -305,4 +305,58 @@ typedef int __bitwise __kernel_rwf_t; #define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\ RWF_APPEND) +/* Pagemap ioctl */ +#define PAGEMAP_SCAN _IOWR('f', 16, struct pm_scan_arg) + +/* Bits are set in flags of the page_region and masks in pm_scan_args */ +#define PAGE_IS_WRITTEN (1 << 0) +#define PAGE_IS_FILE (1 << 1) +#define PAGE_IS_PRESENT (1 << 2) +#define PAGE_IS_SWAPPED (1 << 3) +#define PAGE_IS_PFNZERO (1 << 4) + +/* + * struct page_region - Page region with flags + * @start: Start of the region + * @len: Length of the region in pages + * @bitmap: Bits sets for the region + */ +struct page_region { + __u64 start; + __u64 len; + __u64 flags; +}; + +/* + * struct pm_scan_arg - Pagemap ioctl argument + * @size: Size of the structure + * @flags: Flags for the IOCTL + * @start: Starting address of the region + * @len: Length of the region (All the pages in this length are included) + * @vec: Address of page_region struct array for output + * @vec_len: Length of the page_region struct array + * @max_pages: Optional max return pages + * @required_mask: Required mask - All of these bits have to be set in the PTE + * @anyof_mask: Any mask - Any of these bits are set in the PTE + * @excluded_mask: Exclude mask - None of these bits are set in the PTE + * @return_mask: Bits that are to be reported in page_region + */ +struct pm_scan_arg { + __u64 size; + __u64 flags; + __u64 start; + __u64 len; + __u64 vec; + __u64 vec_len; + __u64 max_pages; + __u64 required_mask; + __u64 anyof_mask; + __u64 excluded_mask; + __u64 return_mask; +}; + +/* Supported flags */ +#define PM_SCAN_OP_GET (1 << 0) +#define PM_SCAN_OP_WP (1 << 1) + #endif /* _UAPI_LINUX_FS_H */