From patchwork Mon Aug 21 14:15:16 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: 13359500 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 23C20EE4993 for ; Mon, 21 Aug 2023 14:16:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D18D8E000B; Mon, 21 Aug 2023 10:16:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 881E18E0006; Mon, 21 Aug 2023 10:16:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 749C98E000B; Mon, 21 Aug 2023 10:16:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 63A6D8E0006 for ; Mon, 21 Aug 2023 10:16:21 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2D31B40CC0 for ; Mon, 21 Aug 2023 14:16:21 +0000 (UTC) X-FDA: 81148311762.18.6E82CA8 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf28.hostedemail.com (Postfix) with ESMTP id 62FB8C0005 for ; Mon, 21 Aug 2023 14:16:19 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=ZgrLIMXX; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf28.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=1692627379; 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=u1TDgUAIDlw7437e2sr2V3u5BWHQ+WxBAK7+vLaDP0YAIopmu7Y9BDnn7ob9nWtOpxew1Z KDo53vBtng2h5sClMt7jjUOCHY3smjSKAK928bgNZlJuYDhaTdN2Vi7GCdkBhEnRVDPtcV OMEKaWltk1PQ2RVP7gXeb1Gv9Za+AME= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=ZgrLIMXX; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf28.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=1692627379; a=rsa-sha256; cv=none; b=wAeTKd8wn3MIXCUQHRqUncXvy0KaqL7y3QxnHYhWgAiIhLT5/ruJ3LhAfgF54W1sS+VhIU cxTb2Y5pX6k1e2J5DXrHp5VSOmu8TITKfALpUzkb4okn4tHOglzrJ0ZMoOq1p5OFiEgVZv //Vs3Cj9WgNogM8nte6frDcJT3UKU6Y= Received: from localhost.localdomain (unknown [39.45.215.81]) (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 A0CD66606F57; Mon, 21 Aug 2023 15:16:09 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1692627378; bh=KpgOAtB3tRXafG9E2ExNtij79OUEo5+z7uKo4KCrRus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZgrLIMXXEwAIvumP8624XNNZ/w/0zE/2ahnBht8+OO0ZDpmuvcCxzmYOSAe1r8NIT mLILAxC2VuKErq6BjGVXS2wk1SFReP/xtHoc60ZMHSQ4EzdVNpqeuHanbw1xvpz7Xq tv6SDT98Cio/Paqci2M/QUlRBYBY/jMidViIj4enyGPuaZY3Ogu6enc4OnhLDq9fkF lf2gY7w4wwda207a7aEoMj3tqqhbSzFNoqUyzm7Pqsh2uBFTT7Bu81/b00uSOtF36b 4ILog+HW0MhvEHSQWVA/97M4d/4lOxqOt60bKwl7/OgJZCM8mKwb8MW52YN6fC+MUG rfiN/JF3yI59g== 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 v33 4/6] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Mon, 21 Aug 2023 19:15:16 +0500 Message-Id: <20230821141518.870589-5-usama.anjum@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230821141518.870589-1-usama.anjum@collabora.com> References: <20230821141518.870589-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 62FB8C0005 X-Stat-Signature: 6h3t3nzp155pz6sybmt6d3gwf188uigy X-HE-Tag: 1692627379-144931 X-HE-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dpRYwipgrS70HZyCXINkpw9vlod9bnJ92rBHi5EdcB4lLuFPl7LhUfePT0+QdDhzdlLYPt+TeaT9SGudll7bSgxB5UGDU2ir6fuRaX/aT3MCAsDTTKWRibbYBTAty9gTBtncMOdH+IO1RlvGvpouzglPjLfWZ+eYkCPEQ0fsy8luZ/hHHQmdmnwrLQLCJZ7ulIjxHEa597GfDW9vwkOSk0HvYJEyuo4JMrjAYcf+hfoqo+y/B4= 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 */