From patchwork Tue Jul 11 12:52:39 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: 13308669 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 B970CEB64DC for ; Tue, 11 Jul 2023 12:53:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5752B6B0075; Tue, 11 Jul 2023 08:53:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 525C56B0078; Tue, 11 Jul 2023 08:53:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C6E76B007D; Tue, 11 Jul 2023 08:53:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2DD346B0075 for ; Tue, 11 Jul 2023 08:53:42 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0642316020E for ; Tue, 11 Jul 2023 12:53:42 +0000 (UTC) X-FDA: 80999322684.13.8ED10F4 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf22.hostedemail.com (Postfix) with ESMTP id 31C4EC0011 for ; Tue, 11 Jul 2023 12:53:39 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b="KRhaIK0/"; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf22.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=1689080020; 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=8wiGM7Q7eAABgqXCBfO0EzWj9ozwqucI7Vc0VSe2/BM=; b=ZTCS4WgD3m3Y0eX42+Et8DlUENxB2tcgpl5wIAxZcYcq9bCEHgKmnQ0j61Y0f3ZpLyUUfs Z+hqjTphv/VwOVA6YcCLx4W6eci2IVtu2KdpAFjU9nc8XvuZG5tK6wamN68QZgZ5FVYAD5 Zf9SDhmswQ4SPJj9NiZFJaAR2tfrCl0= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b="KRhaIK0/"; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf22.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=1689080020; a=rsa-sha256; cv=none; b=ooGU7eChZvfahvt1CQcRF1Dkh+Plx2L2MPRn0Hk9oxvvc9OOAcTOsc/4BOdRpO7Irs7Ldb +v6oh95f8vIkwYpXuV9jI4hBjrmwHmWJMByMySgPqfmIsiiwMszdHYmfRt4Fx5aW6wJBoR sPAsyN9rnzeLeYftz435ggaAczWBaK4= Received: from localhost.localdomain (unknown [119.155.40.122]) (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 7A8EE6607013; Tue, 11 Jul 2023 13:53:31 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1689080019; bh=5buco7QtB4jur/NsS/yDxCuMSRfJbuncKSNIdEednz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KRhaIK0/lH6VM/ilTrYSbtRQVut/Epn7J34PfRsOOuTr6NIzzLcBZ60c0h1ZXin47 wcVGslNjEOBColL26OJcDZEM9ZIvMbn8f2g4lwh/uVkU0YS85ITOx0780Z1ovfrOUd aEdw0kpimCLl4TuTfaasIkJHqveQjkrkGB9wF9dL/W9j8DPe9oEzXuHF/NTFf5RS7q uunzXTXufas3r3/GaJsTql7s7/mzSHQk6tcUv2Ne70zkCRhqVtft+MTjoo0Ys8+QE5 X3gYO0UTJEOW20/Q5yO+Lhqa6bKireAobpVXp/FqjIN1dHe9AwB4yl+h5GNHjgJLht w3MfsEIOHXvSg== 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 v24 3/5] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Tue, 11 Jul 2023 17:52:39 +0500 Message-Id: <20230711125241.1587820-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230711125241.1587820-1-usama.anjum@collabora.com> References: <20230711125241.1587820-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 31C4EC0011 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 4zstzsywhd4j75pdxajzsk5jxmk3r7uu X-HE-Tag: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z9i+F5tYBbsCEVeKR/Pb/HoKJbkyUljMrfQTLWEcP/E9liUCQRUPIH/A0hAi9tJdQIaq76asrjcGz8LHMfJT9aRmol0Ybr6Tdu/WtCDh/FwkhSntcoZeRPIGYnzPZhYavvWQTdfjZ74kX4qGJxq9ySfPQ7RGlxBOCT+4jqsK+63A2OBOK/g8rqpaWWm8iL9Fz7QJ+5p6EiXu4jSePMAQtXKb6stZ4tOyI75ow3qQslxkqZilFIINOPghmWVNyi5dDAQMhBiH6dExQ= 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 v21: - Update tools/include/uapi/linux/fs.h Changes in v19: - Update fs.h accourding to precious patch --- tools/include/uapi/linux/fs.h | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tools/include/uapi/linux/fs.h b/tools/include/uapi/linux/fs.h index b7b56871029c..ac684d99e68f 100644 --- a/tools/include/uapi/linux/fs.h +++ b/tools/include/uapi/linux/fs.h @@ -305,4 +305,59 @@ 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 + * (Ending address of the walk is also returned in it) + * @end: Ending address of the region + * @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 end; + __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 */