From patchwork Tue Jan 30 14:49:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 194185 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1270595dyb; Tue, 30 Jan 2024 06:50:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IHxyvoN8Oqb8H47Tt5Y6FSIWH9HrExfpftDKLikCsFDcZifqhJ2JpkB0csufhzbfnwDKQS1 X-Received: by 2002:a05:622a:130f:b0:42a:a952:6e38 with SMTP id v15-20020a05622a130f00b0042aa9526e38mr3866583qtk.94.1706626213808; Tue, 30 Jan 2024 06:50:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706626213; cv=pass; d=google.com; s=arc-20160816; b=gJB8AqbhGGlgTe6s/XwDfRkWiYFoGEgN9QADrMLbVSpxV9ny0jH9C4PDPUdnik60dJ C+VgyU+5AfdIqag69BMrWrprn+wFPhgucteaf67qkExH8VE9kfCae289MaPXH1me36Gl 3B6StakSy3E3d34zNOQO6S0j7YCc9oJuG1JR5HZ2kXfFCKDc+BnM+xKcDmNB0RxYFtLZ EgN0+eOy3rWX2Zg3Fj90lzr98fswQl1Kq1Y9FshIOXBt5kZMnXFrgiWRrjf8uMKnU/2i R5vGFzy82aiBD+HgWrNXESGJgmbmjD+cUSOc8aMZTmLolzQtEwD3cLkb2yd1gkffsetD 7rkQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=r99wmZRIoUDkiiUtSCZnzEQltHfOdFja1omSYmQRIp4=; fh=j48nMfANqENGnIyfMEhimWj6w+VpTZlwQNGqiweUFl0=; b=VGiXx9ojZPssCS5I7bNC5V8cGVzT2Ewl+WVN6ERbH2s6HZ1ECuhqrOaFiQ2Dsrd1H6 MgYvWYH7lsO7iUyK8mOvJb8dc1MaCNxCCOBdENce1nJ47BoL5tYdINdL29mLbUIVUXRN nrRsfeqHyjuy0Ye+geLyUFhvJxv/e6wzAtsdXI2uT+2C6simU0UGDCO/jIxc3bV3Kf+V 0CtX8K65Mb+BsMvTz4Yx54+TSY43AF3+M7pnlzIKTnemIfRVG8m1yFTqDLFPhyohUB0c /dojp7hFBZGxZ4i6zFsapeWZ4MTTXukVAH+ZpYtc+NFgifLP06kkMi5CIiHIh5f0qUn5 6WqQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="CjaKvfM/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-44768-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44768-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f26-20020a05620a12fa00b0078405755fd1si2962294qkl.544.2024.01.30.06.50.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 06:50:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44768-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="CjaKvfM/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-44768-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44768-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 27C931C2040D for ; Tue, 30 Jan 2024 14:50:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D83F37E761; Tue, 30 Jan 2024 14:49:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CjaKvfM/" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0B516BB2B for ; Tue, 30 Jan 2024 14:49:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706626187; cv=none; b=O/gCkQsqBoIU4UQRaVLtjNSLfNKXl98Xg8kzH5gNC9zRceZqhrFB2fpF5tcxeFXjtiOaVCU0UujrOR4905vzFW1fVGYRDq41nGFGLzQZVT4q9PfYFY9uuE1izOno6DkUg3OgF9MDbukfjkMzmWFzrFrJ7guUc0lgeuz4e3VMK48= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706626187; c=relaxed/simple; bh=B62oaFM0vBB+o7VxltDa38Ve4oQtWNobEnD6Wez7Ycg=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=TcU6RcZ43YafsIFY1okfyXzZKsEr5aoskBaH+w3Lzyfn57qeaxkuK4YhBm5MZIUBFPE2656OUfJd+u9RON7168/n/qwEGvFDPw131T23Ch7U7Zi+lN/PoW9vDox+Sxgw25coNf/hI+x9gpgFcnbN6r+SCDuvsi070hV5Mo2em+E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CjaKvfM/; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05099C43390; Tue, 30 Jan 2024 14:49:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706626187; bh=B62oaFM0vBB+o7VxltDa38Ve4oQtWNobEnD6Wez7Ycg=; h=Date:From:To:Cc:Subject:From; b=CjaKvfM/j4hULH69Rq0aCR273Y9BsgX2+vr1lvcixGTAqFCfWScfGhVCGI4iAQ9kO Bsplxfh/4E0mPxzpcHruA5lWM95gd4imlu4+Cvp+RspnBuqh6eo9PWr+bnJOU6GmSJ j+Jk1oO6D2tCYMXNJrMFrm1Nse3Px6lLa5xzevtZp494wpbMOEU3Gfd6wuIjw927/4 vO8+Zittp3GseHvwcJKWkbA5mQ36i7r3oa+yAb37wsvZwN1Vn26htyZ5kVHmj41R8N MXBCnvXMBfzWjIAT2tzBgHhuD/t3HcoB1SKQPnya6NfZmzkW2GI2mvJpo1n27G4DTH maqkFkUsQou3A== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 915A240441; Tue, 30 Jan 2024 11:49:44 -0300 (-03) Date: Tue, 30 Jan 2024 11:49:44 -0300 From: Arnaldo Carvalho de Melo To: linux-kernel@vger.kernel.org Cc: Adrian Hunter , Christian Brauner , Ian Rogers , Jiri Olsa , Miklos Szeredi , Namhyung Kim Subject: [PATCH 1/1 fyi] tools include UAPI: Sync linux/mount.h copy with the kernel sources Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789527288740128592 X-GMAIL-MSGID: 1789527288740128592 tldr; Just FYI, I'm carrying this on the perf tools tree. - Arnaldo Full explanation: There used to be no copies, with tools/ code using kernel headers directly. From time to time tools/perf/ broke due to legitimate kernel hacking. At some point Linus complained about such direct usage. Then we adopted the current model. The way these headers are used in perf are not restricted to just including them to compile something. There are sometimes used in scripts that convert defines into string tables, etc, so some change may break one of these scripts, or new MSRs may use some different #define pattern, etc. E.g.: $ ls -1 tools/perf/trace/beauty/*.sh | head -5 tools/perf/trace/beauty/arch_errno_names.sh tools/perf/trace/beauty/drm_ioctl.sh tools/perf/trace/beauty/fadvise.sh tools/perf/trace/beauty/fsconfig.sh tools/perf/trace/beauty/fsmount.sh $ $ tools/perf/trace/beauty/fadvise.sh static const char *fadvise_advices[] = { [0] = "NORMAL", [1] = "RANDOM", [2] = "SEQUENTIAL", [3] = "WILLNEED", [4] = "DONTNEED", [5] = "NOREUSE", }; $ The tools/perf/check-headers.sh script, part of the tools/ build process, points out changes in the original files. So its important not to touch the copies in tools/ when doing changes in the original kernel headers, that will be done later, when check-headers.sh inform about the change to the perf tools hackers. --- To pick the changes from: 35e27a5744131996 ("fs: keep struct mnt_id_req extensible") b4c2bea8ceaa50cd ("add listmount(2) syscall") 46eae99ef73302f9 ("add statmount(2) syscall") That doesn't change anything in tools this time as nothing that is harvested by the beauty scripts got changed: $ ls -1 tools/perf/trace/beauty/*mount*sh tools/perf/trace/beauty/fsmount.sh tools/perf/trace/beauty/mount_flags.sh tools/perf/trace/beauty/move_mount_flags.sh $ This addresses this perf build warning. Warning: Kernel ABI header differences: diff -u tools/include/uapi/linux/mount.h include/uapi/linux/mount.h Cc: Adrian Hunter Cc: Christian Brauner Cc: Ian Rogers Cc: Jiri Olsa Cc: Miklos Szeredi Cc: Namhyung Kim Link: https://lore.kernel.org/lkml/ Signed-off-by: Arnaldo Carvalho de Melo --- tools/include/uapi/linux/mount.h | 70 ++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/tools/include/uapi/linux/mount.h b/tools/include/uapi/linux/mount.h index bb242fdcfe6b29bf..ad5478dbad007341 100644 --- a/tools/include/uapi/linux/mount.h +++ b/tools/include/uapi/linux/mount.h @@ -138,4 +138,74 @@ struct mount_attr { /* List of all mount_attr versions. */ #define MOUNT_ATTR_SIZE_VER0 32 /* sizeof first published struct */ + +/* + * Structure for getting mount/superblock/filesystem info with statmount(2). + * + * The interface is similar to statx(2): individual fields or groups can be + * selected with the @mask argument of statmount(). Kernel will set the @mask + * field according to the supported fields. + * + * If string fields are selected, then the caller needs to pass a buffer that + * has space after the fixed part of the structure. Nul terminated strings are + * copied there and offsets relative to @str are stored in the relevant fields. + * If the buffer is too small, then EOVERFLOW is returned. The actually used + * size is returned in @size. + */ +struct statmount { + __u32 size; /* Total size, including strings */ + __u32 __spare1; + __u64 mask; /* What results were written */ + __u32 sb_dev_major; /* Device ID */ + __u32 sb_dev_minor; + __u64 sb_magic; /* ..._SUPER_MAGIC */ + __u32 sb_flags; /* SB_{RDONLY,SYNCHRONOUS,DIRSYNC,LAZYTIME} */ + __u32 fs_type; /* [str] Filesystem type */ + __u64 mnt_id; /* Unique ID of mount */ + __u64 mnt_parent_id; /* Unique ID of parent (for root == mnt_id) */ + __u32 mnt_id_old; /* Reused IDs used in proc/.../mountinfo */ + __u32 mnt_parent_id_old; + __u64 mnt_attr; /* MOUNT_ATTR_... */ + __u64 mnt_propagation; /* MS_{SHARED,SLAVE,PRIVATE,UNBINDABLE} */ + __u64 mnt_peer_group; /* ID of shared peer group */ + __u64 mnt_master; /* Mount receives propagation from this ID */ + __u64 propagate_from; /* Propagation from in current namespace */ + __u32 mnt_root; /* [str] Root of mount relative to root of fs */ + __u32 mnt_point; /* [str] Mountpoint relative to current root */ + __u64 __spare2[50]; + char str[]; /* Variable size part containing strings */ +}; + +/* + * Structure for passing mount ID and miscellaneous parameters to statmount(2) + * and listmount(2). + * + * For statmount(2) @param represents the request mask. + * For listmount(2) @param represents the last listed mount id (or zero). + */ +struct mnt_id_req { + __u32 size; + __u32 spare; + __u64 mnt_id; + __u64 param; +}; + +/* List of all mnt_id_req versions. */ +#define MNT_ID_REQ_SIZE_VER0 24 /* sizeof first published struct */ + +/* + * @mask bits for statmount(2) + */ +#define STATMOUNT_SB_BASIC 0x00000001U /* Want/got sb_... */ +#define STATMOUNT_MNT_BASIC 0x00000002U /* Want/got mnt_... */ +#define STATMOUNT_PROPAGATE_FROM 0x00000004U /* Want/got propagate_from */ +#define STATMOUNT_MNT_ROOT 0x00000008U /* Want/got mnt_root */ +#define STATMOUNT_MNT_POINT 0x00000010U /* Want/got mnt_point */ +#define STATMOUNT_FS_TYPE 0x00000020U /* Want/got fs_type */ + +/* + * Special @mnt_id values that can be passed to listmount + */ +#define LSMT_ROOT 0xffffffffffffffff /* root mount */ + #endif /* _UAPI_LINUX_MOUNT_H */