From patchwork Thu May 25 08:55:15 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: 13254954 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 B3FD9C7EE2E for ; Thu, 25 May 2023 08:56:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 52AC4900007; Thu, 25 May 2023 04:56:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 48AE9900002; Thu, 25 May 2023 04:56:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32BEB900007; Thu, 25 May 2023 04:56:09 -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 2000C900002 for ; Thu, 25 May 2023 04:56:09 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id F04D51A0AE6 for ; Thu, 25 May 2023 08:56:08 +0000 (UTC) X-FDA: 80828170416.01.B854FEE Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf16.hostedemail.com (Postfix) with ESMTP id 3D1CB18000E for ; Thu, 25 May 2023 08:56:06 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b="ZUF/Vwdd"; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf16.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=1685004967; 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=E+gN6i8DcUyJQxB+ORpWq0+tvZE+iCFSxP7uPYRLDO5Mx1orrmlhQygFAHMo7w7of0hFEF RCrBwmdBx70eG6Ff3R6B5HK8K9qe71d8U4pcUEd8vQp6JTgn/kkdJ7jhuIR8rzwxO5uIjK BPyDuZ99sU4MHJd2vs3DEfqxOydE1Mw= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b="ZUF/Vwdd"; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf16.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=1685004967; a=rsa-sha256; cv=none; b=bczHLQQnRolJq0JNEV69+O8ywWWzmDGk+EqLkNFag9lsMvUcXINqTvPMbxvowIVALrQ5Y7 dBZh6PXqYctn6JuK/RU87o87XS8iNUVCDZu/Mdp314SlegBXA9F2GqLmIQhbMaONHlVUbG uKrIXU6jCF9wB1iMpqzFs2BqgHEPag8= Received: from localhost.localdomain (unknown [119.155.11.156]) (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 6516D6602239; Thu, 25 May 2023 09:55:59 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685004966; bh=ZpDkuHO27naMA3P55LraZJjP93DvvWKsAguR36UqCHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZUF/Vwddpqn4gQJS6D8jDumUXh1kNhj498Kn+Nu1JrV4pHg6czX9m4imSYLYx+FIJ ko7EF4UQcpWs6Y7vCUkPrDwjHoqMdCK3HHWulD0uzkBDWyD5XFsKBUciMVVNN9H319 R+ZY8A3mAGfsZ51OW1bewROgQOP4vQLrzWSHKlfE+eyAqAawuDABa3guTLLLAO3U0H nW9tsvtnU/ifi09qP4vkU9RxXRAIYI+OFMhAJU0CPuSF3IGorJuoWLpNnHlasPZeys BCg8MObv7lKna2uB1C+YmocvncoguWkLCCNKcdiEbrZW6rYpA06U3QJDF9fym9t0X8 LoKNmWq1yovcw== 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 v16 3/5] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Thu, 25 May 2023 13:55:15 +0500 Message-Id: <20230525085517.281529-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230525085517.281529-1-usama.anjum@collabora.com> References: <20230525085517.281529-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 3D1CB18000E X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 183bt9ooikdcth8f4bpxyweq31ccjeoe X-HE-Tag: 1685004966-557580 X-HE-Meta: U2FsdGVkX1+KZ4Bp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Acgfo8HfZ/3enVmgB0uB+mVh/1VwUvYbFxIm3Gcls7wK79kFWBOzMpaq9fyM4NuctVSwV1hdqgA51QfaKzVAMP9HbxjwwmslqydBnzP5CfX27TRaRAyhV5iajTGxT6zKgLH6DYGbDqRb+BSDYgMePvrF 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 */