From patchwork Thu Jul 13 10:14:13 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: 13311770 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 09A2CEB64DD for ; Thu, 13 Jul 2023 10:14:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A03978D0006; Thu, 13 Jul 2023 06:14:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 98ADB8D0001; Thu, 13 Jul 2023 06:14:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82C8E8D0006; Thu, 13 Jul 2023 06:14:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 757DF8D0001 for ; Thu, 13 Jul 2023 06:14:58 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3DAA68014A for ; Thu, 13 Jul 2023 10:14:58 +0000 (UTC) X-FDA: 81006180276.13.AF40ED5 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf01.hostedemail.com (Postfix) with ESMTP id 6285B40007 for ; Thu, 13 Jul 2023 10:14:56 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=PvGLzxJ7; spf=pass (imf01.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=1689243296; 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=bknfue3i6eRq+mnnKRz/ox2pIhMCfJfOgt6Y0hAKP2jnosTB2rKss75hnX2D5RasOJSkCs UP+RxfoggPraSHRZkXuFTTuHS3ekv9QNaAMoCkjxDAx2XE59nFUKoZ5FhEbqYJut2Uxma6 Vm0Gun5cZWbD3EwoYS9oKJtNJc/ofrk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689243296; a=rsa-sha256; cv=none; b=R+9eGYdpTCLOI1X4Hj6BtKKBDt/AzMbNy0TaEBgAM85BWvWPqYklEg2GkfTK1lev/JfElM w1uq57rUNDXB5hEKgmxaEhSHkbc89993vBtTP7uyjgaZQ+ChwM9v7Yu4b7Mfp0UwQRQFle Qp5omWrPH6YhLzeSNUgjV7GukEfHGBk= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=PvGLzxJ7; spf=pass (imf01.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.45.151.35]) (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 BED7E6606F62; Thu, 13 Jul 2023 11:14:48 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1689243295; bh=5buco7QtB4jur/NsS/yDxCuMSRfJbuncKSNIdEednz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PvGLzxJ7F5jdqklNVtgby62C9tywkBI3jnlfwtULnVuh6eincQpfUHpNHKDrmWeQb /yl0HpmEqxEWJI9f+GSdgnz9RnpRgXPYhoRS0JgYBG7CI4RFrPf/rFjUkz5nPUEF9N 3tb7Bu2uCbMUcbrU1Kz/mjTTAzC8LlzPyWHgy9j4fDiywl2dkoS2+C9Gq1F6DqkKu8 KUNqWyh0n3tlFVYzabQf+wbr9/dYs8BPtHKebtlQHCa1hgpqc+SXhABqbJHhvyLOHc 62IomXapv4PssrcJA9S9N1QSJezcN9Ovdlsnj9H0k4gjiytrMdfOtG/bjttbWHyLBA 24AdNJNwi7GpQ== 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 v25 3/5] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Thu, 13 Jul 2023 15:14:13 +0500 Message-Id: <20230713101415.108875-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230713101415.108875-1-usama.anjum@collabora.com> References: <20230713101415.108875-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 6285B40007 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: bjm6znaobfecoqr993d39iynrkxtnzoh X-HE-Tag: 1689243296-933514 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bxznCcXBqfG/9ouxFF4VnYhnP2j/Mcy+jzFuOdZRpDVdF1oGjwGM633UAIGWWKFb2TN/lNssG4wrYmesnkDcHJ0mqVyH7dvQxMo+BApQIW6F1We6wC3jQB8qMO2osEgb/sAwiAYorkMv9pQV2V22Eqrq3WTgmr5h9M38jIFLtEZYnoaYqUTbFeiJkWXkA7TQbQakTotE9bIjApl+0KSZqhziE/FG8k+ELnlrkwIVnICUCqG5No1uJmsTuE= 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 */