From patchwork Tue Jun 13 10:29:03 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: 13278319 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 18CDCC88CB4 for ; Tue, 13 Jun 2023 10:29:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB87D8E0007; Tue, 13 Jun 2023 06:29:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A67A38E0003; Tue, 13 Jun 2023 06:29:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 92FD18E0007; Tue, 13 Jun 2023 06:29:49 -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 86CB98E0003 for ; Tue, 13 Jun 2023 06:29:49 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3AACBC047F for ; Tue, 13 Jun 2023 10:29:49 +0000 (UTC) X-FDA: 80897353698.28.790F6C6 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf20.hostedemail.com (Postfix) with ESMTP id 53F5E1C001C for ; Tue, 13 Jun 2023 10:29:47 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=mfvF+nOt; 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; 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=1686652187; 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=y8w/64VQS7SlqNaLKBS4Ssc3UobycOHROrmQmkeUK+Fbtzw5IQmQ8avNWds0JHeZ4aKaRE gFynn8jRJNJfKeHfuJ1vWluJAOeHXIIbfq0crW7dRBLcupBYRB4ki6oJZyO8yXHedlHz5N 9+c/5e30IX5jij1l/fdN4G73iGUWXOk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686652187; a=rsa-sha256; cv=none; b=J3SSrANa3DzIohgBOHIBBAvi+lVhx1UpH00b16xOK7xtqG6eeKOYS8kSlpmz8Jm9bTwZI/ sJL9L1A/attpgJif98LBI/Ap+Y7Q1tHYFsQp89+ChdFSb+THQ4rQX5HK0ovDiFXpzG2N19 CdtFebWnJ93Sl5kUUllnrF1jssuRoGY= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=mfvF+nOt; 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; dmarc=pass (policy=quarantine) header.from=collabora.com Received: from localhost.localdomain (unknown [119.155.33.163]) (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 B228E6606EFD; Tue, 13 Jun 2023 11:29:39 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1686652186; bh=ZpDkuHO27naMA3P55LraZJjP93DvvWKsAguR36UqCHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mfvF+nOtpyHQFMBg2D3w9LTz7Kn54ImpW2PClqLOi4OngK1k5trrEZXNDwAVz9vIX o6ro+3oGkd8Hmcj0l2yHR1E7+yD4G3+8kmZ3BJCw8wm2DgTcBFn2DZLxS7/6hToT/l zshgZGd2yuZXN7Zx7egYupYdH8oR1uIlq142Rk43nFAIAmYKbQSK378xXdn30qasCp +b/i5KK7jvUIekToBg0x7uzplh+xJbFnqoXyYY9v8v5V5YDM8HwYPSjNrypDWKd1f0 t3si0p5tAPFraitBkqX/0Wgx+Qp7CEDCgGLwIE+j9ZLHM8NiDVWkbt782feZnsu0TS rlcE75hJxK+YQ== 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 v18 3/5] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Tue, 13 Jun 2023 15:29:03 +0500 Message-Id: <20230613102905.2808371-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230613102905.2808371-1-usama.anjum@collabora.com> References: <20230613102905.2808371-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 53F5E1C001C X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 66reah6bwrwhe6ziuoijdpw7s8urqkr6 X-HE-Tag: 1686652187-890892 X-H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dIzb4ive2KXHFLQbJZoOPc5wk7Ax/Qy+7B6xqp6f0/pSd7dt/TUZtRvkLiJUaFzzcKWO12IWZ2/r0ChAvUwtXOj/VwFkVdOpO+BXzc+H8HYsaLd67vdHjLDzHAwfb4tmH+snNEk0Qn/nrC/JTSbf+DCcCoSYDN+Z9cDsDK/MPNEyGkC 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 */