From patchwork Wed Jun 21 07:24:02 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: 13286775 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 774D4C001B3 for ; Wed, 21 Jun 2023 07:24:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0125C8D0008; Wed, 21 Jun 2023 03:24:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F06348D0001; Wed, 21 Jun 2023 03:24:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF2E98D0008; Wed, 21 Jun 2023 03:24:51 -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 D637D8D0001 for ; Wed, 21 Jun 2023 03:24:51 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id CD3914078B for ; Wed, 21 Jun 2023 07:24:50 +0000 (UTC) X-FDA: 80925917940.13.53362F9 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf20.hostedemail.com (Postfix) with ESMTP id EC7271C0010 for ; Wed, 21 Jun 2023 07:24:48 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=A0nUAGWV; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf20.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=1687332289; 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=tflQA2AK1JIQFWo9owKIh7PFUAY4ms+DpXRjqJjPVaI=; b=l+qIMj3MKIg+R+nQxehKwAX4/YCAWbaJGmYS2Bp78FYWs0AczXZuQ0gPLDAdQPqGj1R5ky B5u+8iuacUr7umVTZlbJHM64RPKn+TDgYyJuWfAoJIzfTies8m2iGnxGqs+uMstNq/7db4 bxz0KRhLZZZ2fksZt5Vggax9ghBGPc8= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=A0nUAGWV; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf20.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=1687332289; a=rsa-sha256; cv=none; b=B0LXZCbgIpH82fTAxnsryMlA12phwswUC1ngugSLqLeCKzAhmnjDN1wxAnp2fjf/lfv1HE 1dzcUsolypLBNGsFWGzqmd69/xVbwKcGtzdlX9e8jsGGiL4L6ENPbhjOR0zTT2bTNPL2Nf buvI5KlhgRsFxmbBYhQDHYxmMnPpXvo= Received: from localhost.localdomain (unknown [182.179.162.32]) (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 18F326606F90; Wed, 21 Jun 2023 08:24:40 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1687332287; bh=DAOwVTuhGwSLTXi2XkXO+pqlt7qRt0sZ4TECXHyflfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A0nUAGWVbb1vSBGFhNT3b5jq+JlrK8Vq2h8fb4Xm1jcI7ZyamWhTm/Yx5ukOcLbWE yj1SgVvTgRfvt4QhKTdrQkmqogAcyDTbWE37/oMuYPjBVW+EmK4ERfcleUdfcs4Ess qxNDrSV207I3NOqv8XCgmYngKbSqkTlvdlB+EohaJ360GMKYMotjUedANgNppM62j9 +Tw2GVqK7NHSJapx28WZS5TpV/2aU/t9/ALr1GNT06i6OsQrtcapfHzLH91Pf8364/ s7kGrmy32eUVHlMf9KT3vE2yudo2/getplRmMiiQz09Ctk4GcwKCOhPw7K94zBDtgb vmfgRRf2BZUFg== 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 v20 3/5] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Wed, 21 Jun 2023 12:24:02 +0500 Message-Id: <20230621072404.2918101-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230621072404.2918101-1-usama.anjum@collabora.com> References: <20230621072404.2918101-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: EC7271C0010 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: s4r13rfomxb99i6wkjynefqz8cpop5m3 X-HE-Tag: 1687332288-293272 X-HE-Meta: U2FsdG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pfiIHCUCFabZPa8xHxD4qVf/hxrRTgMyyYx/ezOt5IDuUbaufsypGpa0BGFnWtjWC/CmlruT9jE9afE1VkMIGzXNdWzeWRVXNd0l7CkV8k6yxGrq+ysRLGu2hHcIvLYXZW45eGCVX90kSjyu3FKB3Twch6t9krNZt 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 v20: - Update tools/include/uapi/linux/fs.h Changes in v19: - Update fs.h accourding to precious patch --- tools/include/uapi/linux/fs.h | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tools/include/uapi/linux/fs.h b/tools/include/uapi/linux/fs.h index b7b56871029c..00dba03d4b8f 100644 --- a/tools/include/uapi/linux/fs.h +++ b/tools/include/uapi/linux/fs.h @@ -305,4 +305,58 @@ 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 + * @len: Length of the region (All the pages in this length are included) + * @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 len; + __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 */