From patchwork Thu Jul 27 09:36:35 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: 13329869 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 DA5DEC001E0 for ; Thu, 27 Jul 2023 09:37:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 765246B0074; Thu, 27 Jul 2023 05:37:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 715976B0078; Thu, 27 Jul 2023 05:37:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B5D66B007B; Thu, 27 Jul 2023 05:37:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 48AA76B0074 for ; Thu, 27 Jul 2023 05:37:33 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0CF0F140417 for ; Thu, 27 Jul 2023 09:37:33 +0000 (UTC) X-FDA: 81056889186.07.56C3FD2 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf03.hostedemail.com (Postfix) with ESMTP id 178E220010 for ; Thu, 27 Jul 2023 09:37:30 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=AVTalQpm; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf03.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.172 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690450651; 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=wsz9WqYV5jVQc+TBJks4MSrsY1i7UTzQuAjaomif5F4=; b=sW+NyhkZu7C54CGynC5QHbL+2/2/p2WkxyOuOU7XehD9L4eOO5nrgDIvbtXIYvBbZZZXX2 YCC6ndpN3DQOSjpA+VcWIZguzrPXlvgtujyAUonmOBoT1b1zlTmPJErq+Wvughds88oAT4 0cSELhhi1Lxhh2GhvNIy4n7vKVwYqNo= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=AVTalQpm; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf03.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.172 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690450651; a=rsa-sha256; cv=none; b=3/WHcYvDBL1zv7EUDy5y8q10x9Pbg671VeBHIthJOk9qQUlnNW+BeHyopV6DbQx4f9G5RK olUtZKxvVF13WdH8RnAQCI1iHyLxm0De8mDyFFkjkf/0dttxkE/GXr8i8bPK0Hryy8KvGn mxuUheT2IIB8cLWRrtXJd/zdn5oqU0M= Received: from localhost.localdomain (unknown [59.103.218.24]) (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 A2FE6660702D; Thu, 27 Jul 2023 10:37:14 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1690450649; bh=dabNFCG6XmuM1SNYKLB4djPlZIef3vyE5I3SQQtbvxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AVTalQpmFPRaIFA4HBHC9I9feR4ru83QmgUHp7mvMKqC7SbA//H/oc6An9pc+18Ti 4DBQIS85WyF20JZnX3ub3z94dmOpmvH0JfO52zTLPDMHBoJ/F//3RfBc5KRusLFZJT /5f6FHi0pC8RCTqOz6hnAEQpE0wyqwFzbS57d02xufENLDTu0LpVzZC5+9tC70xehb nDy3qwXsqXiGgi6EyamZacJhJ5PhlzR2dZPMeo5LK9oypaKTd1gJe+hUkk8gxx2D2o T1wtolUZ7v2WPpnPkHw9iE3RLPbzZIyafGOTGdRMBChucM6J5IQr5+TPJLVVCyLpA5 5juu8pAMy7t4g== 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 v26 3/5] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Thu, 27 Jul 2023 14:36:35 +0500 Message-Id: <20230727093637.1262110-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230727093637.1262110-1-usama.anjum@collabora.com> References: <20230727093637.1262110-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 178E220010 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: odqkcm5ujsirp6aa6bd9himqnaqf94ti X-HE-Tag: 1690450650-57212 X-HE-Meta: U2FsdGVkX1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6S2Ib24KPJjpiJP2DwFd1RbaMR/kKFvWIwiIuBoHAEBcIVfZw7eSKHnLOzO/nJtxcAxhlrWRfs26+mhmLcGqc2OV36ZPz2Gwo1eE329qkS5exvOwIPyOoM8ztmZ5Yur8JAdTokof4JKzEnsxozM98S 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 v26: - Update according to tools/include/uapi/linux/fs.h Changes in v21: - Update tools/include/uapi/linux/fs.h Changes in v19: - Update fs.h according to precious patch --- tools/include/uapi/linux/fs.h | 58 +++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/tools/include/uapi/linux/fs.h b/tools/include/uapi/linux/fs.h index b7b56871029c5..1bb3c625c2381 100644 --- a/tools/include/uapi/linux/fs.h +++ b/tools/include/uapi/linux/fs.h @@ -305,4 +305,62 @@ 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_WPALLOWED (1 << 0) +#define PAGE_IS_WRITTEN (1 << 1) +#define PAGE_IS_FILE (1 << 2) +#define PAGE_IS_PRESENT (1 << 3) +#define PAGE_IS_SWAPPED (1 << 4) +#define PAGE_IS_PFNZERO (1 << 5) + +/* + * struct page_region - Page region with flags + * @start: Start of the region + * @end: End of the region (exclusive) + * @categories: PAGE_IS_* category bitmask for the region + */ +struct page_region { + __u64 start; + __u64 end; + __u64 categories; +}; + +/* Flags for PAGEMAP_SCAN ioctl */ +#define PM_SCAN_WP_MATCHING (1 << 0) /* Write protect the pages matched. */ +#define PM_SCAN_CHECK_WPASYNC (1 << 1) /* Abort the scan when a non-WP-enabled page is found. */ + +/* + * struct pm_scan_arg - Pagemap ioctl argument + * @size: Size of the structure + * @flags: Flags for the IOCTL + * @start: Starting address of the region + * @end: Ending address of the region + * @walk_end: Ending address of the visited memory is returned + * (This helps if entire range hasn't been visited) + * @vec: Address of page_region struct array for output + * @vec_len: Length of the page_region struct array + * @max_pages: Optional limit for number of returned pages (0 = disabled) + * @category_inverted: PAGE_IS_* categories which values match if 0 instead of 1 + * @category_mask: Skip pages for which any category doesn't match + * @category_anyof_mask: Skip pages for which no category matches + * @return_mask: PAGE_IS_* categories that are to be reported in `page_region`s returned + */ +struct pm_scan_arg { + __u64 size; + __u64 flags; + __u64 start; + __u64 end; + __u64 walk_end; + __u64 vec; + __u64 vec_len; + __u64 max_pages; + __u64 category_inverted; + __u64 category_mask; + __u64 category_anyof_mask; + __u64 return_mask; +}; + #endif /* _UAPI_LINUX_FS_H */