Skip to contentSkip to conversation

tools headers: Update the fs headers with the kernel

PATCH In review [email protected] 2 participants 2 messages Jun 9, 2025 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools headers: Update the fs headers with the kernel

tldr; Just FYI, I'm carrying this on the perf tools tree.

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.

See further details at:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/include/uapi/README

---

To pick up changes from:

5d894321c49e6137 ("fs: add atomic write unit max opt to statx") a516403787e08119 ("fs/proc: extend the PAGEMAP_SCAN ioctl to report guard regions") c07d3aede2b26830 ("fscrypt: add support for hardware-wrapped keys")

These are used to beautify fs syscall arguments, albeit the changes in this update are not affecting those beautifiers.

This addresses these tools/ build warnings:

Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/stat.h include/uapi/linux/stat.h
diff -u tools/perf/trace/beauty/include/uapi/linux/fs.h include/uapi/linux/fs.h diff -u tools/perf/trace/beauty/include/uapi/linux/mount.h include/uapi/linux/mount.h diff -u tools/perf/trace/beauty/include/uapi/linux/stat.h include/uapi/linux/stat.h

Please see tools/include/uapi/README for details (it's in the first patch of this series).

Cc Adrian Hunter <[email protected]>
Cc Andrei Vagin <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Andrii Nakryiko <[email protected]>
Cc Darrick J. Wong <[email protected]>
Cc Eric Biggers <[email protected]>
Cc Ian Rogers <[email protected]>
Cc James Clark <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc John Garry <[email protected]>
Cc Kan Liang <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/include/uapi/linux/fscrypt.h                | 6 ++++--
 tools/include/uapi/linux/stat.h                   | 8 ++++++--
 tools/perf/trace/beauty/include/uapi/linux/fs.h   | 1 +
 tools/perf/trace/beauty/include/uapi/linux/stat.h | 8 ++++++--
 4 files changed, 17 insertions(+), 6 deletions(-)
tools/include/uapi/linux/fscrypt.h +4 -2
index 7a8f4c2901873f25..3aff99f2696a05cb 100644
@@ -119,7 +119,7 @@ struct fscrypt_key_specifier {
  */
 struct fscrypt_provisioning_key_payload {
 	__u32 type;
-	__u32 __reserved;
+	__u32 flags;
 	__u8 raw[];
 };
 
@@ -128,7 +128,9 @@ struct fscrypt_add_key_arg {
 	struct fscrypt_key_specifier key_spec;
 	__u32 raw_size;
 	__u32 key_id;
-	__u32 __reserved[8];
+#define FSCRYPT_ADD_KEY_FLAG_HW_WRAPPED	0x00000001
+	__u32 flags;
+	__u32 __reserved[7];
 	__u8 raw[];
 };
 
tools/include/uapi/linux/stat.h +6 -2
index f78ee3670dd5d7c8..1686861aae20a6e4 100644
@@ -182,8 +182,12 @@ struct statx {
 	/* File offset alignment for direct I/O reads */
 	__u32	stx_dio_read_offset_align;
 
-	/* 0xb8 */
-	__u64	__spare3[9];	/* Spare space for future expansion */
+	/* Optimised max atomic write unit in bytes */
+	__u32	stx_atomic_write_unit_max_opt;
+	__u32	__spare2[1];
+
+	/* 0xc0 */
+	__u64	__spare3[8];	/* Spare space for future expansion */
 
 	/* 0x100 */
 };
tools/perf/trace/beauty/include/uapi/linux/fs.h +1 -0
index e762e1af650c4bf0..0098b0ce8ccb1f19 100644
@@ -361,6 +361,7 @@ typedef int __bitwise __kernel_rwf_t;
 #define PAGE_IS_PFNZERO		(1 << 5)
 #define PAGE_IS_HUGE		(1 << 6)
 #define PAGE_IS_SOFT_DIRTY	(1 << 7)
+#define PAGE_IS_GUARD		(1 << 8)
 
 /*
  * struct page_region - Page region with flags
tools/perf/trace/beauty/include/uapi/linux/stat.h +6 -2
index f78ee3670dd5d7c8..1686861aae20a6e4 100644
@@ -182,8 +182,12 @@ struct statx {
 	/* File offset alignment for direct I/O reads */
 	__u32	stx_dio_read_offset_align;
 
-	/* 0xb8 */
-	__u64	__spare3[9];	/* Spare space for future expansion */
+	/* Optimised max atomic write unit in bytes */
+	__u32	stx_atomic_write_unit_max_opt;
+	__u32	__spare2[1];
+
+	/* 0xc0 */
+	__u64	__spare3[8];	/* Spare space for future expansion */
 
 	/* 0x100 */
 };
Signature · 1 line
2.49.0
#1 lore raw
Quoted 7 lines · Arnaldo Carvalho de Melo

This addresses these tools/ build warnings:

Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/stat.h include/uapi/linux/stat.h diff -u tools/perf/trace/beauty/include/uapi/linux/fs.h include/uapi/linux/fs.h

diff -u tools/perf/trace/beauty/include/uapi/linux/mount.h include/uapi/linux/mount.h

Sorry, mount.h isn't touched, its include/uapi/linux/fscrypt.h instead, I fixed it yup locally.

- Arnaldo

Quoted 103 lines

diff -u tools/perf/trace/beauty/include/uapi/linux/stat.h include/uapi/linux/stat.h

Please see tools/include/uapi/README for details (it's in the first patch of this series).

Cc Adrian Hunter <[email protected]>
Cc Andrei Vagin <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Andrii Nakryiko <[email protected]>
Cc Darrick J. Wong <[email protected]>
Cc Eric Biggers <[email protected]>
Cc Ian Rogers <[email protected]>
Cc James Clark <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc John Garry <[email protected]>
Cc Kan Liang <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/include/uapi/linux/fscrypt.h                | 6 ++++--
 tools/include/uapi/linux/stat.h                   | 8 ++++++--
 tools/perf/trace/beauty/include/uapi/linux/fs.h   | 1 +
 tools/perf/trace/beauty/include/uapi/linux/stat.h | 8 ++++++--
 4 files changed, 17 insertions(+), 6 deletions(-)
tools/include/uapi/linux/fscrypt.h +4 -2
index 7a8f4c2901873f25..3aff99f2696a05cb 100644
@@ -119,7 +119,7 @@ struct fscrypt_key_specifier {
  */
 struct fscrypt_provisioning_key_payload {
 	__u32 type;
-	__u32 __reserved;
+	__u32 flags;
 	__u8 raw[];
 };
 
@@ -128,7 +128,9 @@ struct fscrypt_add_key_arg {
 	struct fscrypt_key_specifier key_spec;
 	__u32 raw_size;
 	__u32 key_id;
-	__u32 __reserved[8];
+#define FSCRYPT_ADD_KEY_FLAG_HW_WRAPPED	0x00000001
+	__u32 flags;
+	__u32 __reserved[7];
 	__u8 raw[];
 };
 
tools/include/uapi/linux/stat.h +6 -2
index f78ee3670dd5d7c8..1686861aae20a6e4 100644
@@ -182,8 +182,12 @@ struct statx {
 	/* File offset alignment for direct I/O reads */
 	__u32	stx_dio_read_offset_align;
 
-	/* 0xb8 */
-	__u64	__spare3[9];	/* Spare space for future expansion */
+	/* Optimised max atomic write unit in bytes */
+	__u32	stx_atomic_write_unit_max_opt;
+	__u32	__spare2[1];
+
+	/* 0xc0 */
+	__u64	__spare3[8];	/* Spare space for future expansion */
 
 	/* 0x100 */
 };
tools/perf/trace/beauty/include/uapi/linux/fs.h +1 -0
index e762e1af650c4bf0..0098b0ce8ccb1f19 100644
@@ -361,6 +361,7 @@ typedef int __bitwise __kernel_rwf_t;
 #define PAGE_IS_PFNZERO		(1 << 5)
 #define PAGE_IS_HUGE		(1 << 6)
 #define PAGE_IS_SOFT_DIRTY	(1 << 7)
+#define PAGE_IS_GUARD		(1 << 8)
 
 /*
  * struct page_region - Page region with flags
tools/perf/trace/beauty/include/uapi/linux/stat.h +6 -2
index f78ee3670dd5d7c8..1686861aae20a6e4 100644
@@ -182,8 +182,12 @@ struct statx {
 	/* File offset alignment for direct I/O reads */
 	__u32	stx_dio_read_offset_align;
 
-	/* 0xb8 */
-	__u64	__spare3[9];	/* Spare space for future expansion */
+	/* Optimised max atomic write unit in bytes */
+	__u32	stx_atomic_write_unit_max_opt;
+	__u32	__spare2[1];
+
+	/* 0xc0 */
+	__u64	__spare3[8];	/* Spare space for future expansion */
 
 	/* 0x100 */
 };
Signature · 1 line
2.49.0