From patchwork Mon Apr 17 12:56:28 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: 13213848 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 AFDCCC77B72 for ; Mon, 17 Apr 2023 12:57:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 54F1F8E0003; Mon, 17 Apr 2023 08:57:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D8978E0001; Mon, 17 Apr 2023 08:57:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3524A8E0003; Mon, 17 Apr 2023 08:57:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 266878E0001 for ; Mon, 17 Apr 2023 08:57:21 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id EB9D3ABF94 for ; Mon, 17 Apr 2023 12:57:20 +0000 (UTC) X-FDA: 80690883840.27.4579B7B Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by imf26.hostedemail.com (Postfix) with ESMTP id 3987514001A for ; Mon, 17 Apr 2023 12:57:18 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=JsyPkv1w; spf=pass (imf26.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=1681736239; 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=F5yvAEyztZU9MnoufqL0nJopsV9NpvtRsq2huOciewvPiiG3D7tTxkiiK2Zi3EBC/So6A9 lU2W000vqkZ6QasicMTDXg/bSbpOehbGPsCuDh7MwtT91bjx+PJ+iJUZK5DA+3eTmr+35C NItVyFKzqcpAg9qh7u3DWQrDCgS7gJg= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=JsyPkv1w; spf=pass (imf26.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=1681736239; a=rsa-sha256; cv=none; b=qKDeys1+84J2CDz4jBc7wnQmWug5X3Po9PEHOjafv+e9i4UStSgY5RqjhWqECioYVlaZoJ xkXGgrQJcyL8CEdqDsJmWM5nzcRLeLVAxZxyDE2VNyU0fX2S8KWVT/2WhMtO5Vt+cKIG7Z ILBALojkTJoWzEPg/UUhrZxyg39zdnQ= 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 E8BDE6603237; Mon, 17 Apr 2023 13:57:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1681736238; bh=ZpDkuHO27naMA3P55LraZJjP93DvvWKsAguR36UqCHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JsyPkv1wEMdN1syicLfNVVqWXefHlCC69dZWmHKFb12UNwgVkNTd1I7jVE8btnmtE n7DTTQgYdGJPpitvR912Yis4+2W+ZPiT+Ez293+pnVNPr3TgKD+gR9hBJounNZJNj7 nEDIMP/M0vbAEoeCN86vuaF8CEVS9KFCG3z5lZQ7qLTRaZynPJrG+hvWbQ56V4oofS 2XqFnfFLGoaNTGGUjvIn5eeYtDYsr24/qygd4UbuUiuAXalhzLpgzE+m5Rdv2c0NO9 qpNNTSXTZWJoYKoSjaCKfX1p0xgTkj0PW3RPPDbkVLpyIbRaoud20j1Y6R2ewEoAeO 4/grKIa3hKDZg== 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 v13 3/5] tools headers UAPI: Update linux/fs.h with the kernel sources Date: Mon, 17 Apr 2023 17:56:28 +0500 Message-Id: <20230417125630.1146906-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230417125630.1146906-1-usama.anjum@collabora.com> References: <20230417125630.1146906-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3987514001A X-Rspam-User: X-Stat-Signature: kyxuxx7xnjqe8cu6qhf9rindqqoe56qk X-HE-Tag: 1681736238-850574 X-HE-Meta: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ct7NiddmVJsRMxdBASv1wQRnG2pBZ6AqbDzNZ5nzvslBJkGr/sU3gU7rNZA+d0XT8hR1TKinA/l9wSR1IaPtowl4yDOtKsInYtenfoo80jllyAFEfz3R1AS2Y6doD+uUABRV/bSp/D9KVVTOKcO0QRuyd7VW7RPMKhhfPVS0= 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 */