From patchwork Fri Aug 11 18:08:40 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: 13351302 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 4B3CFC0015E for ; Fri, 11 Aug 2023 18:09:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF1596B0074; Fri, 11 Aug 2023 14:09:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CA1656B0078; Fri, 11 Aug 2023 14:09:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B42626B007B; Fri, 11 Aug 2023 14:09:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A71326B0074 for ; Fri, 11 Aug 2023 14:09:24 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 75DE0A0511 for ; Fri, 11 Aug 2023 18:09:24 +0000 (UTC) X-FDA: 81112611048.21.D4F4FA8 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf25.hostedemail.com (Postfix) with ESMTP id A7B12A0011 for ; Fri, 11 Aug 2023 18:09:22 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=dZiHdUv3; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf25.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=1691777362; 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=k6t3J8B3hSDEqGXc5bKM6Q6lPcFaImK3d7mB/xpl/0w=; b=3RHxoEsYAKmOLr8nrbdZjtRbKoMBtagMNyEjNxwiEiawdcqNzwOcvc2zualvJrUc3FVDSQ to29Rs+g5sxQB9oebYT4ElxlM2c45R/79CsWm447CG0NKc6nUSrpY3Q4OBtnuATb0Ywcdy bXKLpqhXN4DvJjMITFOMMM532TjwZig= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=dZiHdUv3; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf25.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=1691777362; a=rsa-sha256; cv=none; b=Q7UOJSgvZGH1LJvocyb+y80bziDJTAtAiMnwlbiFvulJUzeF2tXf6Qy9WcObO0YJvutvCU dHB75YbmAC7/bIUsZPmG+bfKymtMHC0b3ZflYYsjjuu4V2yoMFa51rC81neP6D9vLZrMjt ClYbQQGf2QIFDgkYuYMBBopEN20aR+M= Received: from localhost.localdomain (unknown [39.34.188.71]) (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 5EF7A6607197; Fri, 11 Aug 2023 19:09:15 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1691777361; bh=9uTk0llNWEPmmOOkPfdRM+BOIR6HHEXo0/iE/XdTOcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dZiHdUv3U6izyyApUhRB7GlYkOqvT0JwkXUO+luehOwIVQaEWa0P03h9TnZ1sp5mR fhUbtl0k1mlgsu2+wZtAX0PijdX+jzWI2Dhb6G0rheKgnF38QzFGyWysi3RJLDPsp/ pzj/6VIRYsowXIua+GFEEQLHD4ps+aHt5SYO00g8VMLdLGF3N2fW+gih47PuDkJcU6 wx8MOvycUoCmshVm+rZ4OyATVC8ijOlsRHdhjYnUdG4xCj4h9yLzdZgt+fPdpEWR+H xn4ZirOb0x7USXfbcNUVUfVygQi3quiSq8kAgI+dCWcWkuQnHOKeVjAclCHtrAEmX9 6T+Iv3QVIBoIA== 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 v29 4/6] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Fri, 11 Aug 2023 23:08:40 +0500 Message-Id: <20230811180842.3141781-5-usama.anjum@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230811180842.3141781-1-usama.anjum@collabora.com> References: <20230811180842.3141781-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: A7B12A0011 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: cqeogon8e1uirzqkayuiexqemx3tgpbq X-HE-Tag: 1691777362-348127 X-HE-Meta: U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F5xM0TNE6gYiIGUSRMWzGhmviHHnD5rZpJeVubVYJPjjmUZkn0qMXZzsng2KkmJ7URpu1EzZJU7yrjbyKyhqa6YzFotFRPwdxut0GWY9EL7LxR7eAA0sxu5XGwtA67S/jTHTgwFDkwHCfS+VtKN9kKiKtlGlr2ugwj1chILgR3IOjfGueGdpaH4SnJ 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 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..0202af0434791 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 (tag removed) 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 */