From patchwork Thu Apr 20 06:01:54 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: 13217926 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 ED9DBC77B73 for ; Thu, 20 Apr 2023 06:02:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7604F6B0078; Thu, 20 Apr 2023 02:02:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E6DA6B007B; Thu, 20 Apr 2023 02:02:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 561D06B007D; Thu, 20 Apr 2023 02:02:40 -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 47ADD6B0078 for ; Thu, 20 Apr 2023 02:02:40 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 1FED1C04AF for ; Thu, 20 Apr 2023 06:02:40 +0000 (UTC) X-FDA: 80700725280.29.F716A27 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf19.hostedemail.com (Postfix) with ESMTP id 38BC01A0011 for ; Thu, 20 Apr 2023 06:02:37 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=blhSG5rp; spf=pass (imf19.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.172 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=quarantine) header.from=collabora.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681970558; 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=2rGbnCmi5anYVXXiUXGuyAouYOZfihaHaNDZbBNAjqQ=; b=lDJJcqCgnA9cafHiG11QbBzqBlL8i4IkgY1RfHIgsB5jliFLGXBFAMizd4p/h1MdTMxIVD 8taS24QB5m0ksuiM62+AHi/MMLDVmWNa1GX/Wg+gyNpfp7QDpnTzjCy3LZdcwDK8SNqAp1 JwZxcbFCYyRYKpmky7sEvoAz8fpfToI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681970558; a=rsa-sha256; cv=none; b=2DUD2f+sMxk7cR5p/Brt1l0X+acqhBaGUXrACIiMjj2QsUxkclZ4UnExLet/e/otX5bUwH yxnwD9jw3M/PrpFJlSPCz75AH6iJjkc9jg+YyPDoM8JUgfSC6IlP6Ljb8F1Af3Kyo92Ss7 9IRrXx4chUFoftVPeP3U/WWbhM6KUG4= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=blhSG5rp; spf=pass (imf19.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.172 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=quarantine) header.from=collabora.com Received: from localhost.localdomain (unknown [39.37.187.173]) (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 C887B6603265; Thu, 20 Apr 2023 07:02:29 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1681970557; bh=ZpDkuHO27naMA3P55LraZJjP93DvvWKsAguR36UqCHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=blhSG5rptsEMpwAk+xhD3SlLaUTJyquMkb2yGS9umOuMXd0M+lrMHEBx5w5yBnrp4 VJP7AIwesIV089jkhP81O//HkqkZHJrttLoI3EY14bqmMP702CMet0HvhS+5smFnI0 PBCuXVR/cflawqyEZ3eWiFl31yy9kKVBqLGtxPEjA7AWAwPwGURLVZdxu6JVRjTVk1 KEjADchoqLBoKgH7WwB72qdG2xAA8SxrIGaZvBp6Tn+WV/8pEqosoLY8N38d60J4/D O39eeSjjf6Xmq12TAzYZlT5+qCh9lY7BWNAVgV+H4JRX70wACmaVcZ3MQIuW36eIpF TRVSIhesOb/pA== 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 RESEND v15 3/5] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Thu, 20 Apr 2023 11:01:54 +0500 Message-Id: <20230420060156.895881-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230420060156.895881-1-usama.anjum@collabora.com> References: <20230420060156.895881-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 38BC01A0011 X-Rspamd-Server: rspam09 X-Stat-Signature: gn9kqw6pb8t35qw9kk4ghy87rfrqjbfb X-HE-Tag: 1681970557-725165 X-HE-Meta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P+0/QUu0CHgNxiGgkeAWZ2Jtyjj0HVNLKBFKmoaBcVGOaHmq68zoaW3qsfAfmNpsOsVkJvIcIAEW+NJi58m3zXPvocz9oGecQLKKOlRryoIRq7dhmKmw52iGHFTGiax88OKekM6JUoMIWUtBJFzefadKSWFHmKPt5Hl3lEI5wlDSM+aOdqRV+NcclTw5gvpwwS2xsbgDay2J5xGSmx9ZWqI0GxAypL7IW47CdIikaKWDHgCNsfYZ7/1V6oL/E8ZY2QlEF 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 --- tools/include/uapi/linux/fs.h | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tools/include/uapi/linux/fs.h b/tools/include/uapi/linux/fs.h index b7b56871029c..47879c38ce2f 100644 --- a/tools/include/uapi/linux/fs.h +++ b/tools/include/uapi/linux/fs.h @@ -305,4 +305,57 @@ 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 the bitmap 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) + +/* + * struct page_region - Page region with bitmap 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 bitmap; +}; + +/* + * 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 */