From patchwork Wed Apr 19 11:07:14 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: 13216655 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 DF7F5C6FD18 for ; Wed, 19 Apr 2023 11:08:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F4978E0003; Wed, 19 Apr 2023 07:08:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A52D8E0001; Wed, 19 Apr 2023 07:08:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6943E8E0003; Wed, 19 Apr 2023 07:08:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 5B8B78E0001 for ; Wed, 19 Apr 2023 07:08:06 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 37F0880222 for ; Wed, 19 Apr 2023 11:08:06 +0000 (UTC) X-FDA: 80697866172.13.E537143 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf14.hostedemail.com (Postfix) with ESMTP id 666BE10001A for ; Wed, 19 Apr 2023 11:08:04 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=cOEZJiY7; spf=pass (imf14.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=1681902484; 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=ohcIWl/3Prd3J/JZKcZuEqJWxMbbo8AzLzM00VlzOOI2wJv5nZWUlCeFcFg6j4rfJC/DUM FPpmjbNzz3bUqqhO3qMZdwFbQj6M8eBKdXaIEWYVNIHsk5CxClA5Y3w+c9PfxeejaeMdvG XbOtCZtSF45mnnD4a4Yr9JCsGr7tUvY= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=cOEZJiY7; spf=pass (imf14.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681902484; a=rsa-sha256; cv=none; b=C4vBtZUW/TdK4k7dUM7qBLq+W9qI5lVSMeM04kaCBPmN9aTk7fRFaMYPX/4Hv3UJ50w7tV UR5mjAVGoa8UDqTbZ4XfD16TkgKVSuc0oStnNimtGsIXTYw8+7JlGUonfhi02J3+wM6hru sbmQoN9Wjl8UYUC3HDoyYCpBUgBQIfw= Received: from localhost.localdomain (unknown [39.37.187.173]) (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 20E6A6603264; Wed, 19 Apr 2023 12:07:55 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1681902483; bh=ZpDkuHO27naMA3P55LraZJjP93DvvWKsAguR36UqCHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cOEZJiY7vKf8ncUUTwaRtGuTXceTUUL9TUVZso4WNl/5+893AR+M0PMODG2a/KRpU Yg6C4hNXJxwq9Anb0SzR7Axx0dXVt4CoDFI2zXlZiyWeHzq6Xi6tcbsoS7b7WaOJEd dceH2suHVZ6ZcgoyLhLUvwOFia0LkCYF2qwJhPfeu3GaDOG2BnQsjAMcaakWNVm0iR EcVX6FDzTcChULjTlQVFtTyJAZ8tDUH6ffMpa0vGmacF2Zz5mKCJ0XKjHMclaVhob8 5jph0/QH1YoarsA+m2nHQfikbmPWA6V7Cm05kTMRUJPrDzW4VqbgrYZI1PCfN2++UQ +3xOUhCJeXz1Q== 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 v15 3/5] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Wed, 19 Apr 2023 16:07:14 +0500 Message-Id: <20230419110716.4113627-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230419110716.4113627-1-usama.anjum@collabora.com> References: <20230419110716.4113627-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 666BE10001A X-Rspam-User: X-Stat-Signature: nfygkamz1hshxdojjwkg5cy8x6ezfpqg X-HE-Tag: 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QUG8BhbJj4vsKrJK7kyKHUr/Efi0Bvx3uqtpa5o1ZHqzVzrrTWWsvylvmttwfogKrQ5e3Ph1wmDn51E4DHvOw7WALFBenB4vbUCLCgfWhyuoURGQs0qGsi2EeULKbQHke1wEH8jDMSAhIM7awIIAe+GLiY2uzmPb6B5mHIvhII5zRiqZ4bPNsZSfIZuHIn7ra2bd/uz+oxM9cMwesaGUmHqvNmU7zORc19VEvEdtO4c2dakMgsYcQQZaQiqMW+ZV9TuU6RDCRUvC 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 */