From patchwork Thu Apr 6 07:40:03 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: 13202958 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 B8058C76196 for ; Thu, 6 Apr 2023 07:40:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 48AC56B007B; Thu, 6 Apr 2023 03:40:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 43B146B007D; Thu, 6 Apr 2023 03:40:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DC3A6B007E; Thu, 6 Apr 2023 03:40:55 -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 1F6436B007B for ; Thu, 6 Apr 2023 03:40:55 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E318FAC8FB for ; Thu, 6 Apr 2023 07:40:54 +0000 (UTC) X-FDA: 80650169628.01.4D4C279 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf27.hostedemail.com (Postfix) with ESMTP id 225834000B for ; Thu, 6 Apr 2023 07:40:52 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=R3HSl6tS; spf=pass (imf27.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=1680766853; 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=UQvL/9kx3/uoqBt0rm5I0Ymkhk/R+rZ33jNcKhyPHpeUhRpBxn5W3Qh315dH+yRVf5OtL/ Bk/Bbvt0L7iUyD8tDGF1a9XO5wtZgImRtRw2ZDMZ0S9V99rvU0Levm0H1q1VN66SD9GKbd UQ22yc1pf85FHhv3Ee5Pnx/B16hjk/A= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=R3HSl6tS; spf=pass (imf27.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=1680766853; a=rsa-sha256; cv=none; b=zvk5Ul7vyH+5EEtYBHK9wd4BkAk81cBsn2LIngFQjxREAd9M49gkFhCG6McXzYG/eDLGsC w+lVzBcUi2mfKnun6N+depuZt1BRLuVnM/dTprxzxarmROsH94Ls/+XRjq4QfeG3//v6R/ 072NZbC+VbdQIWTmsXSniGBDoMuS8Wg= Received: from localhost.localdomain (unknown [119.155.57.40]) (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 DF21C66031CD; Thu, 6 Apr 2023 08:40:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680766852; bh=ZpDkuHO27naMA3P55LraZJjP93DvvWKsAguR36UqCHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R3HSl6tST/r945gW+l9B+q4O1NayADmanIR1iKJrRolxcxw11arbTM7Lx+23hwLGs cs2HjE9Dgd8lVnII/6np+TnvNZBgrFUfLOrgQmMG2RdegptWfypX/snL/t+GOlC/Y7 h/4WK6c+qBy4W3MTU4mKKv7MfpZtKOpqPeI5ULmvnLfcZ+L5y7mqpLAVDPrP56b3Me FxPjnfkwnTU28BygBIis900g0Cx/1fuTWl8XIqYphTCoqC7Is2az9sB9aIBX6z6m/0 ZDL4aRZfrZrRskDewvF1yNjYyOgexTNi/BucdkwrTEzeDOWXb81Lo8+d/yP+Kg9XMP MBcDRXk53XsEg== 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 v12 3/5] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Thu, 6 Apr 2023 12:40:03 +0500 Message-Id: <20230406074005.1784728-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230406074005.1784728-1-usama.anjum@collabora.com> References: <20230406074005.1784728-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 225834000B X-Stat-Signature: e71wte4itix3gxpgykzuxn8ttd99mpqx X-Rspam-User: X-HE-Tag: 1680766852-762079 X-HE-Meta: U2FsdGVk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L+iwozfxpCEFE0yR22Bbmv+FTTv9YHtb4Xx5gPA5OFnOquTXNCXFZwgAP+wm+qh0G2HSeSpsAJsjl7b/tFngZpqTArofWSJSAA7YJVFFvxNFJePtLrc8GNoXaaG0HjWrEq6rVev8y77gYVSo1NYW76gqIGY/jIo= 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 */