From patchwork Wed Aug 16 11:30:47 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: 13355062 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 4C62CC001B0 for ; Wed, 16 Aug 2023 11:31:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E1D11280007; Wed, 16 Aug 2023 07:31:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DCEB78D0001; Wed, 16 Aug 2023 07:31:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C95AF280007; Wed, 16 Aug 2023 07:31:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id BAD9B8D0001 for ; Wed, 16 Aug 2023 07:31:33 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 427771A04C8 for ; Wed, 16 Aug 2023 11:31:32 +0000 (UTC) X-FDA: 81129752424.08.D9DA5CC Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf03.hostedemail.com (Postfix) with ESMTP id 7130020014 for ; Wed, 16 Aug 2023 11:31:30 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=Rp9iGp9M; 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=1692185490; 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=i7U1DhdUsfGUgqoJWbNxwwhwYA/Lif4e21yx3K4aJAQ=; b=pXYBZxS+cfkBf3ilfNgr2VWSxPVc8iiOhzhec/+5ad+IHDMIAZt4OJ4GuY0+0edrnaNOvf wePqSC6ZclMnV+qOnqLcNE691sjkRQClPIyADx3svfGMt6+raJSVGLu5uRINVfBmGi11i2 sJLQnx03eHNBsN2KNE7ca9MqH4JaFG0= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=Rp9iGp9M; 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=1692185490; a=rsa-sha256; cv=none; b=otNEPca/ephvMVZoR8bDCXgQ0TpgbzmLi1yJAc+GaCkzl1JQh34nTEaeDYRp+sJ/HymlFx vfXSz5LSsyt5Wru7NY64uD8EtV/JpYEwpaK7cW11tbtBofiiYZhR6lClbNysaVcelRkpAd aO6DGbNUW84dk2aCYiHwsfqMititFLo= Received: from localhost.localdomain (unknown [59.103.216.185]) (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 B8EFA6607208; Wed, 16 Aug 2023 12:31:23 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1692185489; bh=KpgOAtB3tRXafG9E2ExNtij79OUEo5+z7uKo4KCrRus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rp9iGp9MJR0r39FqWz+WzD78782wqzgL/3CA33K4AJF5O62J9PmC0aAG5LNTt+gXx KNgivc2IUsgaDmMl6ulMnjd0JivS+qSgSWnSLiaOfGt7QkNP/iuUemETY2Myf44ypu /K2YdozBcnRcNsAz2lirOrl4YSW/8BVBY1sOMsbRlXNWixpPhbcLTsrJVD2cwrOaSj gQjwEgPOzja6nLYmjLHRBMax4Q16QoQ36Qv65FAkWBY6HXDQI8nWFpSZ+GG0yhncoC kYxZlafLlpwLroybnZwcAYQuJyFCtmkgfbTkfWisRZ+HhTkZu84ekqz8A/s/jHX2L/ 5PYlBWxM9cBvw== From: Muhammad Usama Anjum To: Peter Xu , Andrew Morton , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Andrei Vagin , Danylo Mocherniuk , Paul Gofman 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, Cyrill Gorcunov , Mike Rapoport , Nadav Amit , David Hildenbrand Subject: [PATCH v32 4/6] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Wed, 16 Aug 2023 16:30:47 +0500 Message-Id: <20230816113049.1697849-5-usama.anjum@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230816113049.1697849-1-usama.anjum@collabora.com> References: <20230816113049.1697849-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 7130020014 X-Stat-Signature: 88n6r6z7mx91zd97r74tf17peymka6nu X-Rspam-User: X-HE-Tag: 1692185490-129167 X-HE-Meta: U2FsdGVkX18EL76sKRyv4dJ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kkc9fDnZwqVXLi8kkXxy9jRndUDRp8TSqdIy5iJR9+R6yEhGamhr4PVTOg2DqEw5tfUaYoVCa72gzl1ywIHI1WH7kZdI+4U5eM7axbLw0CHjpsnTZ9dq+jLAeHHfglv7CMax+/RuCAl0p89AALhTptAtbHQRyJja 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 v30: - Comment update Changes in v29: - Comment updates Changes in v27: - Comment updates in fs.h 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 | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tools/include/uapi/linux/fs.h b/tools/include/uapi/linux/fs.h index b7b56871029c5..da43810b74856 100644 --- a/tools/include/uapi/linux/fs.h +++ b/tools/include/uapi/linux/fs.h @@ -305,4 +305,63 @@ 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) + +/* Bitmasks provided in pm_scan_args masks and reported in page_region.categories. */ +#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) +#define PAGE_IS_HUGE (1 << 6) + +/* + * 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 Address where the scan stopped (written by kernel). + * walk_end == end (address tags cleared) informs that the scan completed on entire range. + * @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 */