From patchwork Thu Jul 6 06:01:45 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: 13303222 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 E7DEFEB64D9 for ; Thu, 6 Jul 2023 06:02:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7486E8D0006; Thu, 6 Jul 2023 02:02:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F8778D0001; Thu, 6 Jul 2023 02:02:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 598F88D0006; Thu, 6 Jul 2023 02:02:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 4A73A8D0001 for ; Thu, 6 Jul 2023 02:02:54 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1A2AC8080B for ; Thu, 6 Jul 2023 06:02:54 +0000 (UTC) X-FDA: 80980143468.03.F7AEBCF Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf25.hostedemail.com (Postfix) with ESMTP id B0AD1A0018 for ; Thu, 6 Jul 2023 06:02:51 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=YsrvwX5G; 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=1688623372; 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=8wiGM7Q7eAABgqXCBfO0EzWj9ozwqucI7Vc0VSe2/BM=; b=HS6C/ojghD/Hmo68j/j9NTKwheWDfgt98w7k2nMdXH09iWESAdpKOyiW/hRs4Hgta91f49 FJ04eyBd+4OG0Jun5RLqMzu+r5S/4OB3i8VC6XK9h2MmQnJyoytIkeHj+K1rsSfYbK92qV IPLRweyNpzMjJmNjxS0xOFkELgCce2g= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=YsrvwX5G; 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=1688623372; a=rsa-sha256; cv=none; b=Z0XdEh21DMIA7cguHoy7maUyxDGJQ9lPInx43sEEdIVVnVmWVbEEUsV89hu7vxtOzrg9ZO FsJI0mgG6caq5HBnrUDxyqBs1XBbfA1dGyFp7sOY2sFsgvdeKYCTqciugA1bLEmGOALRtR TiIqeR2A/pR9zk9SRDmf/KxgE4ZRzDY= Received: from localhost.localdomain (unknown [119.155.52.241]) (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 4EDB86606FBC; Thu, 6 Jul 2023 07:02:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1688623368; bh=5buco7QtB4jur/NsS/yDxCuMSRfJbuncKSNIdEednz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YsrvwX5GSGxHNTmn7qDMGntfvnI9TVy+4t6ChZmnFYtgVgJzmZPcs2zja73svx4oK 3R4h/WuQwcsW7jw2J0Mh3W5s9YsK6VwA5KFV41IG1TITc1IsugViY9p9Vq+apwAksO bGxwlnxEpgC53yoxWKtJCshdst0r9s5QZHD76GGnVWLltSbV63TJX+nfWrqywVZ5gJ 7csbILiioHF4sHwkn/kZS1xrunUgJHn8421lyEPEMG0ZdsJjxygxddqOdjMmRnGjTi pWet9PS3LpEqoMyUmQj7LSelFapXAcfbvQntEpUkw909PhPa9pXqC49/wk5DPdpi3p Ot9HpwTnAtB/g== 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 v23 3/5] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Thu, 6 Jul 2023 11:01:45 +0500 Message-Id: <20230706060147.444375-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230706060147.444375-1-usama.anjum@collabora.com> References: <20230706060147.444375-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: B0AD1A0018 X-Stat-Signature: jwypcydnnkjx34rey1t63j5hh6gdkjrh X-HE-Tag: 1688623371-522859 X-HE-Meta: U2F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xGfIh7HUHdS+u+zui2r78L9R0uzO9KabnHUbqVHQwqAHc23mVcTBnAIElkxbajhvaZ2RG4A7ZuylVvvHyhp4S/Tf31ptIR5+UHmAAGjHEULtsDoSlZz4Y26Tt04Sug+kPTEJGwrGmJQ8xjWGV4zvGZdo0ld5VyHNpr0Q261jw 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 v21: - Update tools/include/uapi/linux/fs.h Changes in v19: - Update fs.h accourding to precious patch --- tools/include/uapi/linux/fs.h | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tools/include/uapi/linux/fs.h b/tools/include/uapi/linux/fs.h index b7b56871029c..ac684d99e68f 100644 --- a/tools/include/uapi/linux/fs.h +++ b/tools/include/uapi/linux/fs.h @@ -305,4 +305,59 @@ 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 + * (Ending address of the walk is also returned in it) + * @end: Ending address of the region + * @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 end; + __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 */