From patchwork Wed Jun 28 09:54:24 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: 13295487 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 AFFC1EB64D7 for ; Wed, 28 Jun 2023 10:00:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 337768D0006; Wed, 28 Jun 2023 06:00:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E8298D0001; Wed, 28 Jun 2023 06:00:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 188F18D0006; Wed, 28 Jun 2023 06:00:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 075238D0001 for ; Wed, 28 Jun 2023 06:00:25 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D8667160D2C for ; Wed, 28 Jun 2023 10:00:24 +0000 (UTC) X-FDA: 80951711568.13.0CCC4A3 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf30.hostedemail.com (Postfix) with ESMTP id CFC7780026 for ; Wed, 28 Jun 2023 10:00:22 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=T6iltlQ4; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf30.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=1687946423; 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=A1tNlN8qLubMUZwng47n2YJLs9P/1YE3lKDj1pagNf/c+J4DeQ5sLyyQJ7t/FmiJk8m/Wn ODj95XMXlBkFT+J3lgUcTgOCtS+3HveiPGsZJLhoBWrZPvvcAmveVqGjdchANyOjZg1Zlz 3YYBL5kibWi2KstJMk0hWawKJH5i+4o= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=T6iltlQ4; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf30.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=1687946423; a=rsa-sha256; cv=none; b=bO5ILhN/37z9GnBIZCCV351y+bwsFaRrQlhvBMH6vjpDy2+uv2Mg9rePD4gco5qYObZ6P2 wTC3J+T9IF1CpKRpjYTo5NoCDJ47O7cnCCyPQccCgv47WY+Pm7pcSEm7iHEKReMEYOgDGf OufcXJ8CFLbO96o6ScPDrjNZd9iUI7w= Received: from localhost.localdomain (unknown [182.179.162.32]) (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 7F9166607172; Wed, 28 Jun 2023 11:00:12 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1687946421; bh=5buco7QtB4jur/NsS/yDxCuMSRfJbuncKSNIdEednz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T6iltlQ4hnI/hJVwo2ybcG8BbCcqw32ulnv+L5MbfXyZeXP/6kqxHkDEYNYezrhtc ULfsFdHC3e0aAhVDeHnYaWSdsnIijBOkURiuy4BzvZQeQSsyeDFkSO8kx1VDDPyLi6 if1nKnDLtq9NYrVlUGVgC7asNGRM5F+DqdiihG4xqJdgu/lA/jhybPYk1ZS0IB2H68 w3fcInHeW8EZ48rNEnFh7pXe1IvSm7smEg+UQLeYSibKqOTnBtaTAKrLY+e5YIDziN nqS8vCwI2Yns1yEZfv8Ueb53kIFmv7UIgZKigsCtxPPuHX8y9OTN6en4LbILs3i7No F6lIcTH+V48Wg== 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 v22 3/5] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Wed, 28 Jun 2023 14:54:24 +0500 Message-Id: <20230628095426.1886064-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230628095426.1886064-1-usama.anjum@collabora.com> References: <20230628095426.1886064-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: kfz5ftad69n8drhqqkxco3nnu51umwsa X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: CFC7780026 X-HE-Tag: 1687946422-528040 X-HE-Meta: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NIttf03z/xxJvtfuHH3E0yq3yxX2giUVoRNwh4a+qsq2+M3cxTBhzDvoMzuOglIDxSNs2thPGQKdgSfKD7BRE4utKu0U8U3bMwWNC4r/n8mWTcK3oG2K8TU5L3iBSApjNkz7DtD+zSYe0NVzcgolclCSYCuE 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 */