[PATCH v2 07/15] blktrace: add definitions for blk_user_trace_setup2

Johannes Thumshirn
2025-09-25T15:03:06Z

Add definitions for a version 2 of the blk_user_trace_setup ioctl. This
new will enable a different struct layout of the binary data passed to
user-space when using a new version of the blktrace utility requesting the
new struct layout.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
include/uapi/linux/blktrace_api.h | 15 +++++++++++++++
include/uapi/linux/fs.h | 1 +
2 files changed, 16 insertions(+)

diff --git a/include/uapi/linux/blktrace_api.h b/include/uapi/linux/blktrace_api.h
index 1bfb635e309b..a3b1f35ac026 100644
--- a/include/uapi/linux/blktrace_api.h
+++ b/include/uapi/linux/blktrace_api.h
@@ -143,4 +143,19 @@ struct blk_user_trace_setup {
__u32 pid;
};

+/*
+ * User setup structure passed with BLKTRACESETUP2
+ */
+struct blk_user_trace_setup2 {
+ char name[32]; /* output */
+ __u64 act_mask; /* input */
+ __u32 buf_size; /* input */
+ __u32 buf_nr; /* input */
+ __u64 start_lba;
+ __u64 end_lba;
+ __u32 pid;
+ __u32 flags; /* currently unused */
+ __u64 reserved[7];
+};
+
#endif /* _UAPIBLKTRACE_H */
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index 0bd678a4a10e..a85d0b52a3f6 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -300,6 +300,7 @@ struct file_attr {
#define BLKGETDISKSEQ _IOR(0x12,128,__u64)
/* 130-136 are used by zoned block device ioctls (uapi/linux/blkzoned.h) */
/* 137-141 are used by blk-crypto ioctls (uapi/linux/blk-crypto.h) */
+#define BLKTRACESETUP2 _IOWR(0x12, 142, struct blk_user_trace_setup2)

#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
#define FIBMAP _IO(0x00,1) /* bmap access */
--
2.51.0