From patchwork Tue Aug 8 10:43:07 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: 13345954 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 1C405C001B0 for ; Tue, 8 Aug 2023 10:43:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7647A6B0074; Tue, 8 Aug 2023 06:43:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6EE418D0002; Tue, 8 Aug 2023 06:43:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 567D88D0001; Tue, 8 Aug 2023 06:43:51 -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 48A906B0074 for ; Tue, 8 Aug 2023 06:43:51 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 1E67BC03D8 for ; Tue, 8 Aug 2023 10:43:51 +0000 (UTC) X-FDA: 81100601862.12.F7E34D2 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf26.hostedemail.com (Postfix) with ESMTP id 52BCB140019 for ; Tue, 8 Aug 2023 10:43:49 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b="Rn3PHXT/"; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf26.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=1691491429; 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=RpXJb1nfRm54EJuzs6XbadCR5mX4PggAHsE/igNKqMQ=; b=Nm+pJO9jWI1ByaoPqK1LXz91OAuyEbaahkY2/2gervUT50UNC3vzjYY21CiN+KRTrmJTzd qb2J+L5W0/HlalyBUhhMlOh0YPeGC/lZsa4cPJB219dqg603cR4Q2EUyXNz/VSq9HDjce8 /Ncbn9o2Xg9SGdTECyXYnNfDT5oid0E= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b="Rn3PHXT/"; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf26.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=1691491429; a=rsa-sha256; cv=none; b=LMXBFQviBApYlEFWsGQc83h4kBpd2IZj8dyRPUQA/q1B7tpVD+82+pi7ebbYlEWI0FDW0g byl9TksEQ8TcMX7+tDKZR9Hb3pQUipf5OyoNkqyr8+5k08MbnLjjc4kVdoxafRvXguS9M7 TPJr5ItmP9JQTKO+fz06kfOPoT9L8Ic= Received: from localhost.localdomain (unknown [59.103.218.230]) (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 59FAF6607200; Tue, 8 Aug 2023 11:43:42 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1691491428; bh=w6fRj7IgTvvx5EsyHLfunAonFs0TRl2SHloFjajvkUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rn3PHXT/5jiKxoyKdjxgrMliM1yxwpVXBPZ3vXKzcp9IIr3nOwpoTKsJL+iZe8OLQ 4yux5CdWX+FrM7u5yeiXadjHWMbk90jxsr3DFPacC9UwHwTRUgbNa+oksKSCvJ3z8N WYPHe2P60IKmO+nn0fcFRQoXio8xxlqFnnNjvEpjdrmMWN5gQ0QO+FkfZ2yUi9j8gv NLskLQZ9KAklSK6Uf7ZIeZ8etmI9IftSdEMWU07K+U3UdMGjN4UDnJg16f4LUc2EDU QX/YASdYnr47fQkZWW2n6feQw76YiY+pQ3y65Ivf4bNLWZPA/xJEfw1H28YhxgErbt D3nQ7VQXQF8bQ== 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 v27 4/6] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Tue, 8 Aug 2023 15:43:07 +0500 Message-Id: <20230808104309.357852-5-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230808104309.357852-1-usama.anjum@collabora.com> References: <20230808104309.357852-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 52BCB140019 X-Stat-Signature: n3sratf6c1h7b46r6drahpmnhj5r6q4s X-HE-Tag: 1691491429-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KbYxIDrtLWcAsqrujmsomOtueFXRdfT/82IfzwdRdPeEeoKM7DJ+f6L9Q52KHpacevCf9wkCQJ+8aab6eJo8k6BMG0eyReeZD/taDzHAWtuWDiShRQBV3OXZE+j1sUbv94Ok7eVi4EKbPXYqtAmGg3ZxNJYTXtXCv54Gc6q3Arn 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 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..1c9d38af1015e 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) + +/* 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) +#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 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 */