[PATCH 02/16] blktrace: add definitions for blk_user_trace_setup2

Johannes Thumshirn posted 16 patches 3 weeks, 2 days ago
There is a newer version of this series
[PATCH 02/16] blktrace: add definitions for blk_user_trace_setup2
Posted by Johannes Thumshirn 3 weeks, 2 days ago
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 | 14 ++++++++++++++
 include/uapi/linux/fs.h           |  1 +
 2 files changed, 15 insertions(+)

diff --git a/include/uapi/linux/blktrace_api.h b/include/uapi/linux/blktrace_api.h
index 1bfb635e309b..ba61374f90d8 100644
--- a/include/uapi/linux/blktrace_api.h
+++ b/include/uapi/linux/blktrace_api.h
@@ -143,4 +143,18 @@ 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 reserved;                 /* for futute use */
+};
+
 #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
Re: [PATCH 02/16] blktrace: add definitions for blk_user_trace_setup2
Posted by Christoph Hellwig 1 week, 6 days ago
>  
> +/*
> + * 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 reserved;                 /* for futute use */

I'd rename __reserved to flags, and check that it is zero, and then
add a few more __u64 for extensibility.