perf beauty: Move uapi/linux/mount.h copy out of the directory used to build perf
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 11 Mar 2024 20:07:33 +0000 (17:07 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 21 Mar 2024 13:41:27 +0000 (10:41 -0300)
It is mostly used only to generate string tables, not to build perf, so
move it to the tools/perf/trace/beauty/include/ hierarchy, that is used
just for scraping.

This is a something that should've have happened, as happened with the
linux/socket.h scrapper, do it now as Ian suggested while doing an
audit/refactor session in the headers used by perf.

No other tools/ living code uses it, just <linux/mount.h> coming from
either 'make install_headers' or from the system /usr/include/
directory.

Suggested-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/CAP-5=fWZVrpRufO4w-S4EcSi9STXcTAN2ERLwTSN7yrSSA-otQ@mail.gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/include/uapi/linux/mount.h [deleted file]
tools/perf/Makefile.perf
tools/perf/check-headers.sh
tools/perf/trace/beauty/fsconfig.sh
tools/perf/trace/beauty/fsmount.sh
tools/perf/trace/beauty/fspick.sh
tools/perf/trace/beauty/include/uapi/linux/mount.h [new file with mode: 0644]
tools/perf/trace/beauty/mount_flags.sh
tools/perf/trace/beauty/move_mount_flags.sh

diff --git a/tools/include/uapi/linux/mount.h b/tools/include/uapi/linux/mount.h
deleted file mode 100644 (file)
index ad5478d..0000000
+++ /dev/null
@@ -1,211 +0,0 @@
-#ifndef _UAPI_LINUX_MOUNT_H
-#define _UAPI_LINUX_MOUNT_H
-
-#include <linux/types.h>
-
-/*
- * These are the fs-independent mount-flags: up to 32 flags are supported
- *
- * Usage of these is restricted within the kernel to core mount(2) code and
- * callers of sys_mount() only.  Filesystems should be using the SB_*
- * equivalent instead.
- */
-#define MS_RDONLY       1      /* Mount read-only */
-#define MS_NOSUID       2      /* Ignore suid and sgid bits */
-#define MS_NODEV        4      /* Disallow access to device special files */
-#define MS_NOEXEC       8      /* Disallow program execution */
-#define MS_SYNCHRONOUS 16      /* Writes are synced at once */
-#define MS_REMOUNT     32      /* Alter flags of a mounted FS */
-#define MS_MANDLOCK    64      /* Allow mandatory locks on an FS */
-#define MS_DIRSYNC     128     /* Directory modifications are synchronous */
-#define MS_NOSYMFOLLOW 256     /* Do not follow symlinks */
-#define MS_NOATIME     1024    /* Do not update access times. */
-#define MS_NODIRATIME  2048    /* Do not update directory access times */
-#define MS_BIND                4096
-#define MS_MOVE                8192
-#define MS_REC         16384
-#define MS_VERBOSE     32768   /* War is peace. Verbosity is silence.
-                                  MS_VERBOSE is deprecated. */
-#define MS_SILENT      32768
-#define MS_POSIXACL    (1<<16) /* VFS does not apply the umask */
-#define MS_UNBINDABLE  (1<<17) /* change to unbindable */
-#define MS_PRIVATE     (1<<18) /* change to private */
-#define MS_SLAVE       (1<<19) /* change to slave */
-#define MS_SHARED      (1<<20) /* change to shared */
-#define MS_RELATIME    (1<<21) /* Update atime relative to mtime/ctime. */
-#define MS_KERNMOUNT   (1<<22) /* this is a kern_mount call */
-#define MS_I_VERSION   (1<<23) /* Update inode I_version field */
-#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
-#define MS_LAZYTIME    (1<<25) /* Update the on-disk [acm]times lazily */
-
-/* These sb flags are internal to the kernel */
-#define MS_SUBMOUNT     (1<<26)
-#define MS_NOREMOTELOCK        (1<<27)
-#define MS_NOSEC       (1<<28)
-#define MS_BORN                (1<<29)
-#define MS_ACTIVE      (1<<30)
-#define MS_NOUSER      (1<<31)
-
-/*
- * Superblock flags that can be altered by MS_REMOUNT
- */
-#define MS_RMT_MASK    (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|\
-                        MS_LAZYTIME)
-
-/*
- * Old magic mount flag and mask
- */
-#define MS_MGC_VAL 0xC0ED0000
-#define MS_MGC_MSK 0xffff0000
-
-/*
- * open_tree() flags.
- */
-#define OPEN_TREE_CLONE                1               /* Clone the target tree and attach the clone */
-#define OPEN_TREE_CLOEXEC      O_CLOEXEC       /* Close the file on execve() */
-
-/*
- * move_mount() flags.
- */
-#define MOVE_MOUNT_F_SYMLINKS          0x00000001 /* Follow symlinks on from path */
-#define MOVE_MOUNT_F_AUTOMOUNTS                0x00000002 /* Follow automounts on from path */
-#define MOVE_MOUNT_F_EMPTY_PATH                0x00000004 /* Empty from path permitted */
-#define MOVE_MOUNT_T_SYMLINKS          0x00000010 /* Follow symlinks on to path */
-#define MOVE_MOUNT_T_AUTOMOUNTS                0x00000020 /* Follow automounts on to path */
-#define MOVE_MOUNT_T_EMPTY_PATH                0x00000040 /* Empty to path permitted */
-#define MOVE_MOUNT_SET_GROUP           0x00000100 /* Set sharing group instead */
-#define MOVE_MOUNT_BENEATH             0x00000200 /* Mount beneath top mount */
-#define MOVE_MOUNT__MASK               0x00000377
-
-/*
- * fsopen() flags.
- */
-#define FSOPEN_CLOEXEC         0x00000001
-
-/*
- * fspick() flags.
- */
-#define FSPICK_CLOEXEC         0x00000001
-#define FSPICK_SYMLINK_NOFOLLOW        0x00000002
-#define FSPICK_NO_AUTOMOUNT    0x00000004
-#define FSPICK_EMPTY_PATH      0x00000008
-
-/*
- * The type of fsconfig() call made.
- */
-enum fsconfig_command {
-       FSCONFIG_SET_FLAG       = 0,    /* Set parameter, supplying no value */
-       FSCONFIG_SET_STRING     = 1,    /* Set parameter, supplying a string value */
-       FSCONFIG_SET_BINARY     = 2,    /* Set parameter, supplying a binary blob value */
-       FSCONFIG_SET_PATH       = 3,    /* Set parameter, supplying an object by path */
-       FSCONFIG_SET_PATH_EMPTY = 4,    /* Set parameter, supplying an object by (empty) path */
-       FSCONFIG_SET_FD         = 5,    /* Set parameter, supplying an object by fd */
-       FSCONFIG_CMD_CREATE     = 6,    /* Create new or reuse existing superblock */
-       FSCONFIG_CMD_RECONFIGURE = 7,   /* Invoke superblock reconfiguration */
-       FSCONFIG_CMD_CREATE_EXCL = 8,   /* Create new superblock, fail if reusing existing superblock */
-};
-
-/*
- * fsmount() flags.
- */
-#define FSMOUNT_CLOEXEC                0x00000001
-
-/*
- * Mount attributes.
- */
-#define MOUNT_ATTR_RDONLY      0x00000001 /* Mount read-only */
-#define MOUNT_ATTR_NOSUID      0x00000002 /* Ignore suid and sgid bits */
-#define MOUNT_ATTR_NODEV       0x00000004 /* Disallow access to device special files */
-#define MOUNT_ATTR_NOEXEC      0x00000008 /* Disallow program execution */
-#define MOUNT_ATTR__ATIME      0x00000070 /* Setting on how atime should be updated */
-#define MOUNT_ATTR_RELATIME    0x00000000 /* - Update atime relative to mtime/ctime. */
-#define MOUNT_ATTR_NOATIME     0x00000010 /* - Do not update access times. */
-#define MOUNT_ATTR_STRICTATIME 0x00000020 /* - Always perform atime updates */
-#define MOUNT_ATTR_NODIRATIME  0x00000080 /* Do not update directory access times */
-#define MOUNT_ATTR_IDMAP       0x00100000 /* Idmap mount to @userns_fd in struct mount_attr. */
-#define MOUNT_ATTR_NOSYMFOLLOW 0x00200000 /* Do not follow symlinks */
-
-/*
- * mount_setattr()
- */
-struct mount_attr {
-       __u64 attr_set;
-       __u64 attr_clr;
-       __u64 propagation;
-       __u64 userns_fd;
-};
-
-/* 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 */
index 643e9fa6ec89c58c51cbaf0bd335010e25eb5c3d..523c3b7d6c9d3f5129eb73e67d9070ceb5ef604a 100644 (file)
@@ -500,20 +500,20 @@ $(fadvise_advice_array): $(linux_uapi_dir)/in.h $(fadvise_advice_tbl)
 fsmount_arrays := $(beauty_outdir)/fsmount_arrays.c
 fsmount_tbls := $(srctree)/tools/perf/trace/beauty/fsmount.sh
 
-$(fsmount_arrays): $(linux_uapi_dir)/mount.h $(fsmount_tbls)
-       $(Q)$(SHELL) '$(fsmount_tbls)' $(linux_uapi_dir) > $@
+$(fsmount_arrays): $(beauty_uapi_linux_dir)/mount.h $(fsmount_tbls)
+       $(Q)$(SHELL) '$(fsmount_tbls)' $(beauty_uapi_linux_dir) > $@
 
 fspick_arrays := $(beauty_outdir)/fspick_arrays.c
 fspick_tbls := $(srctree)/tools/perf/trace/beauty/fspick.sh
 
-$(fspick_arrays): $(linux_uapi_dir)/mount.h $(fspick_tbls)
-       $(Q)$(SHELL) '$(fspick_tbls)' $(linux_uapi_dir) > $@
+$(fspick_arrays): $(beauty_uapi_linux_dir)/mount.h $(fspick_tbls)
+       $(Q)$(SHELL) '$(fspick_tbls)' $(beauty_uapi_linux_dir) > $@
 
 fsconfig_arrays := $(beauty_outdir)/fsconfig_arrays.c
 fsconfig_tbls := $(srctree)/tools/perf/trace/beauty/fsconfig.sh
 
-$(fsconfig_arrays): $(linux_uapi_dir)/mount.h $(fsconfig_tbls)
-       $(Q)$(SHELL) '$(fsconfig_tbls)' $(linux_uapi_dir) > $@
+$(fsconfig_arrays): $(beauty_uapi_linux_dir)/mount.h $(fsconfig_tbls)
+       $(Q)$(SHELL) '$(fsconfig_tbls)' $(beauty_uapi_linux_dir) > $@
 
 pkey_alloc_access_rights_array := $(beauty_outdir)/pkey_alloc_access_rights_array.c
 asm_generic_hdr_dir := $(srctree)/tools/include/uapi/asm-generic/
@@ -598,15 +598,14 @@ $(mremap_flags_array): $(linux_uapi_dir)/mman.h $(mremap_flags_tbl)
 mount_flags_array := $(beauty_outdir)/mount_flags_array.c
 mount_flags_tbl := $(srctree)/tools/perf/trace/beauty/mount_flags.sh
 
-$(mount_flags_array): $(linux_uapi_dir)/mount.h $(mount_flags_tbl)
-       $(Q)$(SHELL) '$(mount_flags_tbl)' $(linux_uapi_dir) > $@
+$(mount_flags_array): $(beauty_uapi_linux_dir)/mount.h $(mount_flags_tbl)
+       $(Q)$(SHELL) '$(mount_flags_tbl)' $(beauty_uapi_linux_dir) > $@
 
 move_mount_flags_array := $(beauty_outdir)/move_mount_flags_array.c
 move_mount_flags_tbl := $(srctree)/tools/perf/trace/beauty/move_mount_flags.sh
 
-$(move_mount_flags_array): $(linux_uapi_dir)/mount.h $(move_mount_flags_tbl)
-       $(Q)$(SHELL) '$(move_mount_flags_tbl)' $(linux_uapi_dir) > $@
-
+$(move_mount_flags_array): $(beauty_uapi_linux_dir)/mount.h $(move_mount_flags_tbl)
+       $(Q)$(SHELL) '$(move_mount_flags_tbl)' $(beauty_uapi_linux_dir) > $@
 
 mmap_prot_array := $(beauty_outdir)/mmap_prot_array.c
 mmap_prot_tbl := $(srctree)/tools/perf/trace/beauty/mmap_prot.sh
index 015f74137b755eaf76dcba030a03bb66d96461ac..c2c26d6b87ef52f9a4192441d3519247c6982fc2 100755 (executable)
@@ -15,7 +15,6 @@ FILES=(
   "include/uapi/linux/kcmp.h"
   "include/uapi/linux/kvm.h"
   "include/uapi/linux/in.h"
-  "include/uapi/linux/mount.h"
   "include/uapi/linux/openat2.h"
   "include/uapi/linux/perf_event.h"
   "include/uapi/linux/prctl.h"
@@ -98,6 +97,7 @@ declare -a BEAUTY_FILES
 BEAUTY_FILES=(
   "include/linux/socket.h"
   "include/uapi/linux/fs.h"
+  "include/uapi/linux/mount.h"
 )
 
 declare -a FAILURES
index bc6ef7bb7a5f93c2043ffe5c248ec6bd815a4dca..09cee79de00ca35d3b6e14d823ad7ceea3d38ea8 100755 (executable)
@@ -2,12 +2,12 @@
 # SPDX-License-Identifier: LGPL-2.1
 
 if [ $# -ne 1 ] ; then
-       linux_header_dir=tools/include/uapi/linux
+       beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
 else
-       linux_header_dir=$1
+       beauty_uapi_linux_dir=$1
 fi
 
-linux_mount=${linux_header_dir}/mount.h
+linux_mount=${beauty_uapi_linux_dir}/mount.h
 
 printf "static const char *fsconfig_cmds[] = {\n"
 ms='[[:space:]]*'
index cba8897a751fd487602e9d0dc0c0b8b5a8333aee..6b67a54cdeee64b391e7f481c6254cf153df63f9 100755 (executable)
@@ -2,12 +2,12 @@
 # SPDX-License-Identifier: LGPL-2.1
 
 if [ $# -ne 1 ] ; then
-       linux_header_dir=tools/include/uapi/linux
+       beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
 else
-       linux_header_dir=$1
+       beauty_uapi_linux_dir=$1
 fi
 
-linux_mount=${linux_header_dir}/mount.h
+linux_mount=${beauty_uapi_linux_dir}/mount.h
 
 # Remove MOUNT_ATTR_RELATIME as it is zeros, handle it a special way in the beautifier
 # Only handle MOUNT_ATTR_ followed by a capital letter/num as __ is special case
index 1f088329b96ef0f26c40be22498ce18f124edc3a..0d9951c22b952ed19777cfaf638cd5f7b47ae4e8 100755 (executable)
@@ -2,12 +2,12 @@
 # SPDX-License-Identifier: LGPL-2.1
 
 if [ $# -ne 1 ] ; then
-       linux_header_dir=tools/include/uapi/linux
+       beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
 else
-       linux_header_dir=$1
+       beauty_uapi_linux_dir=$1
 fi
 
-linux_mount=${linux_header_dir}/mount.h
+linux_mount=${beauty_uapi_linux_dir}/mount.h
 
 printf "static const char *fspick_flags[] = {\n"
 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+FSPICK_([[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
diff --git a/tools/perf/trace/beauty/include/uapi/linux/mount.h b/tools/perf/trace/beauty/include/uapi/linux/mount.h
new file mode 100644 (file)
index 0000000..ad5478d
--- /dev/null
@@ -0,0 +1,211 @@
+#ifndef _UAPI_LINUX_MOUNT_H
+#define _UAPI_LINUX_MOUNT_H
+
+#include <linux/types.h>
+
+/*
+ * These are the fs-independent mount-flags: up to 32 flags are supported
+ *
+ * Usage of these is restricted within the kernel to core mount(2) code and
+ * callers of sys_mount() only.  Filesystems should be using the SB_*
+ * equivalent instead.
+ */
+#define MS_RDONLY       1      /* Mount read-only */
+#define MS_NOSUID       2      /* Ignore suid and sgid bits */
+#define MS_NODEV        4      /* Disallow access to device special files */
+#define MS_NOEXEC       8      /* Disallow program execution */
+#define MS_SYNCHRONOUS 16      /* Writes are synced at once */
+#define MS_REMOUNT     32      /* Alter flags of a mounted FS */
+#define MS_MANDLOCK    64      /* Allow mandatory locks on an FS */
+#define MS_DIRSYNC     128     /* Directory modifications are synchronous */
+#define MS_NOSYMFOLLOW 256     /* Do not follow symlinks */
+#define MS_NOATIME     1024    /* Do not update access times. */
+#define MS_NODIRATIME  2048    /* Do not update directory access times */
+#define MS_BIND                4096
+#define MS_MOVE                8192
+#define MS_REC         16384
+#define MS_VERBOSE     32768   /* War is peace. Verbosity is silence.
+                                  MS_VERBOSE is deprecated. */
+#define MS_SILENT      32768
+#define MS_POSIXACL    (1<<16) /* VFS does not apply the umask */
+#define MS_UNBINDABLE  (1<<17) /* change to unbindable */
+#define MS_PRIVATE     (1<<18) /* change to private */
+#define MS_SLAVE       (1<<19) /* change to slave */
+#define MS_SHARED      (1<<20) /* change to shared */
+#define MS_RELATIME    (1<<21) /* Update atime relative to mtime/ctime. */
+#define MS_KERNMOUNT   (1<<22) /* this is a kern_mount call */
+#define MS_I_VERSION   (1<<23) /* Update inode I_version field */
+#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
+#define MS_LAZYTIME    (1<<25) /* Update the on-disk [acm]times lazily */
+
+/* These sb flags are internal to the kernel */
+#define MS_SUBMOUNT     (1<<26)
+#define MS_NOREMOTELOCK        (1<<27)
+#define MS_NOSEC       (1<<28)
+#define MS_BORN                (1<<29)
+#define MS_ACTIVE      (1<<30)
+#define MS_NOUSER      (1<<31)
+
+/*
+ * Superblock flags that can be altered by MS_REMOUNT
+ */
+#define MS_RMT_MASK    (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|\
+                        MS_LAZYTIME)
+
+/*
+ * Old magic mount flag and mask
+ */
+#define MS_MGC_VAL 0xC0ED0000
+#define MS_MGC_MSK 0xffff0000
+
+/*
+ * open_tree() flags.
+ */
+#define OPEN_TREE_CLONE                1               /* Clone the target tree and attach the clone */
+#define OPEN_TREE_CLOEXEC      O_CLOEXEC       /* Close the file on execve() */
+
+/*
+ * move_mount() flags.
+ */
+#define MOVE_MOUNT_F_SYMLINKS          0x00000001 /* Follow symlinks on from path */
+#define MOVE_MOUNT_F_AUTOMOUNTS                0x00000002 /* Follow automounts on from path */
+#define MOVE_MOUNT_F_EMPTY_PATH                0x00000004 /* Empty from path permitted */
+#define MOVE_MOUNT_T_SYMLINKS          0x00000010 /* Follow symlinks on to path */
+#define MOVE_MOUNT_T_AUTOMOUNTS                0x00000020 /* Follow automounts on to path */
+#define MOVE_MOUNT_T_EMPTY_PATH                0x00000040 /* Empty to path permitted */
+#define MOVE_MOUNT_SET_GROUP           0x00000100 /* Set sharing group instead */
+#define MOVE_MOUNT_BENEATH             0x00000200 /* Mount beneath top mount */
+#define MOVE_MOUNT__MASK               0x00000377
+
+/*
+ * fsopen() flags.
+ */
+#define FSOPEN_CLOEXEC         0x00000001
+
+/*
+ * fspick() flags.
+ */
+#define FSPICK_CLOEXEC         0x00000001
+#define FSPICK_SYMLINK_NOFOLLOW        0x00000002
+#define FSPICK_NO_AUTOMOUNT    0x00000004
+#define FSPICK_EMPTY_PATH      0x00000008
+
+/*
+ * The type of fsconfig() call made.
+ */
+enum fsconfig_command {
+       FSCONFIG_SET_FLAG       = 0,    /* Set parameter, supplying no value */
+       FSCONFIG_SET_STRING     = 1,    /* Set parameter, supplying a string value */
+       FSCONFIG_SET_BINARY     = 2,    /* Set parameter, supplying a binary blob value */
+       FSCONFIG_SET_PATH       = 3,    /* Set parameter, supplying an object by path */
+       FSCONFIG_SET_PATH_EMPTY = 4,    /* Set parameter, supplying an object by (empty) path */
+       FSCONFIG_SET_FD         = 5,    /* Set parameter, supplying an object by fd */
+       FSCONFIG_CMD_CREATE     = 6,    /* Create new or reuse existing superblock */
+       FSCONFIG_CMD_RECONFIGURE = 7,   /* Invoke superblock reconfiguration */
+       FSCONFIG_CMD_CREATE_EXCL = 8,   /* Create new superblock, fail if reusing existing superblock */
+};
+
+/*
+ * fsmount() flags.
+ */
+#define FSMOUNT_CLOEXEC                0x00000001
+
+/*
+ * Mount attributes.
+ */
+#define MOUNT_ATTR_RDONLY      0x00000001 /* Mount read-only */
+#define MOUNT_ATTR_NOSUID      0x00000002 /* Ignore suid and sgid bits */
+#define MOUNT_ATTR_NODEV       0x00000004 /* Disallow access to device special files */
+#define MOUNT_ATTR_NOEXEC      0x00000008 /* Disallow program execution */
+#define MOUNT_ATTR__ATIME      0x00000070 /* Setting on how atime should be updated */
+#define MOUNT_ATTR_RELATIME    0x00000000 /* - Update atime relative to mtime/ctime. */
+#define MOUNT_ATTR_NOATIME     0x00000010 /* - Do not update access times. */
+#define MOUNT_ATTR_STRICTATIME 0x00000020 /* - Always perform atime updates */
+#define MOUNT_ATTR_NODIRATIME  0x00000080 /* Do not update directory access times */
+#define MOUNT_ATTR_IDMAP       0x00100000 /* Idmap mount to @userns_fd in struct mount_attr. */
+#define MOUNT_ATTR_NOSYMFOLLOW 0x00200000 /* Do not follow symlinks */
+
+/*
+ * mount_setattr()
+ */
+struct mount_attr {
+       __u64 attr_set;
+       __u64 attr_clr;
+       __u64 propagation;
+       __u64 userns_fd;
+};
+
+/* 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 */
index 730099a9a67c1e57be52d00fc4b27dfc72faf9f9..ff578f7b451b5a1d3a3382e2e93c1da53c9a52e9 100755 (executable)
@@ -1,15 +1,15 @@
 #!/bin/sh
 # SPDX-License-Identifier: LGPL-2.1
 
-[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
+[ $# -eq 1 ] && beauty_uapi_linux_dir=$1 || beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
 
 printf "static const char *mount_flags[] = {\n"
 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MS_([[:alnum:]_]+)[[:space:]]+([[:digit:]]+)[[:space:]]*.*'
-grep -E $regex ${header_dir}/mount.h | grep -E -v '(MSK|VERBOSE|MGC_VAL)\>' | \
+grep -E $regex ${beauty_uapi_linux_dir}/mount.h | grep -E -v '(MSK|VERBOSE|MGC_VAL)\>' | \
        sed -r "s/$regex/\2 \2 \1/g" | sort -n | \
        xargs printf "\t[%s ? (ilog2(%s) + 1) : 0] = \"%s\",\n"
 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MS_([[:alnum:]_]+)[[:space:]]+\(1<<([[:digit:]]+)\)[[:space:]]*.*'
-grep -E $regex ${header_dir}/mount.h | \
+grep -E $regex ${beauty_uapi_linux_dir}/mount.h | \
        sed -r "s/$regex/\2 \1/g" | \
        xargs printf "\t[%s + 1] = \"%s\",\n"
 printf "};\n"
index ce5e632d14484bd2e1a0f55f86e5286824ece9c4..c0dde9020bc38c2137e52384a9fe45d9bc8592c0 100755 (executable)
@@ -2,12 +2,12 @@
 # SPDX-License-Identifier: LGPL-2.1
 
 if [ $# -ne 1 ] ; then
-       linux_header_dir=tools/include/uapi/linux
+       beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
 else
-       linux_header_dir=$1
+       beauty_uapi_linux_dir=$1
 fi
 
-linux_mount=${linux_header_dir}/mount.h
+linux_mount=${beauty_uapi_linux_dir}/mount.h
 
 printf "static const char *move_mount_flags[] = {\n"
 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MOVE_MOUNT_([^_]+[[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'