From patchwork Thu Jun 15 14:11:42 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: 13281303 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 F13C9EB64DB for ; Thu, 15 Jun 2023 14:13:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8EB2E6B0074; Thu, 15 Jun 2023 10:13:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C26B8E0003; Thu, 15 Jun 2023 10:13:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78CAD8E0002; Thu, 15 Jun 2023 10:13:23 -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 6A7386B0074 for ; Thu, 15 Jun 2023 10:13:23 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2E213A0892 for ; Thu, 15 Jun 2023 14:13:23 +0000 (UTC) X-FDA: 80905174686.18.0D3E132 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf25.hostedemail.com (Postfix) with ESMTP id E30FBA0067 for ; Thu, 15 Jun 2023 14:12:33 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=E5gfS0PT; spf=pass (imf25.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=1686838354; 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=ku9/Y8s2mP+xONHgtjbEBDk2m9YTYHojnpYbbrsLvSw=; b=BYaO1nEZTsdXhkrfHbzY7aNap0ssIo4P9R1hlgPVk6gdM17Ih7xGg+/dLCaWJbndfsHXRO nosH8brdCg2wxYc6uDyOkFX+4mULs0gOpAlde/TM5R9DATI9yEmrHa8cBSISCbNfbqwVls 7aGcOeMtlIwoFJk4VUcO5K2hWjWLnm0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686838354; a=rsa-sha256; cv=none; b=ePeYfxlP0cRxTHogssmMCW7qWqiIMJcl6uWtLFi6zhwZCVkLzui6OCr9WYiZg8rbjuo4S/ Hp3xUp3rPdYddjTVQYa5iwBFd/mpG1xRcQnXbvOXg/uLV7CMt+hjrdysW4yMKd75mEQRIu +VjVMT0mWntWw4zkkVhKTwIdknoDns8= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=E5gfS0PT; spf=pass (imf25.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 4A6AF6606F74; Thu, 15 Jun 2023 15:12:24 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1686838352; bh=P9YCBV1QZ95F3uqEp5i9HYUF9tuHDwaQOv3IScV4z0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E5gfS0PT7X0Y+vqsFeXenWrwrvluBLvAPBrZs3LVVK+s1d5dYHEQMZWOi/GfDW7lb nUHDuzZAz/DOZiwmFhWYWx7aL0B8p0i8iYnrwi4EkTJNGbeKUAY+/ZuLCzpDl0L1JM PbuGpHWiT6tPaXZL/7dkVRYAVJmpZ8qLqvLvmH2pcVtx2JCE00dEkvHvPxhenrHHoC sVwkevcHYx7HaYgl6GqmNIxdlz7s2OsvJtszkCn9oMVM8p05+u5cRpIicxZvrME/pF tBA11+YyC9loHAHH9NAqOmPLj8jNQf2XZapA0XX6Q1A+XZcTvBRk092i2RgOyH8E4p ymi3uoAI0lu+w== 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 v19 3/5] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Thu, 15 Jun 2023 19:11:42 +0500 Message-Id: <20230615141144.665148-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230615141144.665148-1-usama.anjum@collabora.com> References: <20230615141144.665148-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: E30FBA0067 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: sqqkamr1h64pntqf1dbgqufn8tdk1ngj X-HE-Tag: 1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DH9JxJ0nIDRpdn1UT8D9mDZ8QzihynXucZS1Mj0Pu2f6uI9l0pvCohLtjD38PTBdMz5oaWbvk61RBrm8r/fLGBElW+9KowRUUkqVApsJNnjObhpvlJGIavLu4gDbUYqLtrU5VCeRnIPo5PHCCobrwhjXeuJOLIuQq5f1VweyUicA0OdUgv3BESw 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 v19: - Update fs.h accourding to precious patch --- 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..a9fb44db84a3 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 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) + +/* + * 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 + * @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 */