diff mbox series

[RFC,1/8] io_uring: move the current struct io_uring_sqe members to legacy sub struct

Message ID e9842775e56d4e5623ac04c7691f8d4887682aa5.1660291547.git.metze@samba.org (mailing list archive)
State New
Headers show
Series cleanup struct io_uring_sqe layout | expand

Commit Message

Stefan Metzmacher Aug. 12, 2022, 8:34 a.m. UTC
Adding more and more opcodes makes the layout of struct io_uring_sqe
really complex and very hard to keep an overview what fields are
required to be the same for all opcodes and which can be adjusted
per opcode.

Adding unnamed union and struct, doesn't change anything to current
callers.

Check with 'git show -w' it's mainly just an indentation change.

The next patches will fill the union with specific structure for
each .prep() function.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
---
 include/uapi/linux/io_uring.h | 129 ++++++++++++++++++----------------
 1 file changed, 67 insertions(+), 62 deletions(-)
diff mbox series

Patch

diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
index 1463cfecb56b..83f16bce3dc7 100644
--- a/include/uapi/linux/io_uring.h
+++ b/include/uapi/linux/io_uring.h
@@ -16,72 +16,77 @@ 
  * IO submission data structure (Submission Queue Entry)
  */
 struct io_uring_sqe {
-	__u8	opcode;		/* type of operation for this sqe */
-	__u8	flags;		/* IOSQE_ flags */
-	__u16	ioprio;		/* ioprio for the request */
-	__s32	fd;		/* file descriptor to do IO on */
 	union {
-		__u64	off;	/* offset into file */
-		__u64	addr2;
+		/* This is the legacy structure */
 		struct {
-			__u32	cmd_op;
-			__u32	__pad1;
+			__u8	opcode;		/* type of operation for this sqe */
+			__u8	flags;		/* IOSQE_ flags */
+			__u16	ioprio;		/* ioprio for the request */
+			__s32	fd;		/* file descriptor to do IO on */
+			union {
+				__u64	off;	/* offset into file */
+				__u64	addr2;
+				struct {
+					__u32	cmd_op;
+					__u32	__pad1;
+				};
+			};
+			union {
+				__u64	addr;	/* pointer to buffer or iovecs */
+				__u64	splice_off_in;
+			};
+			__u32	len;		/* buffer size or number of iovecs */
+			union {
+				__kernel_rwf_t	rw_flags;
+				__u32		fsync_flags;
+				__u16		poll_events;	/* compatibility */
+				__u32		poll32_events;	/* word-reversed for BE */
+				__u32		sync_range_flags;
+				__u32		msg_flags;
+				__u32		timeout_flags;
+				__u32		accept_flags;
+				__u32		cancel_flags;
+				__u32		open_flags;
+				__u32		statx_flags;
+				__u32		fadvise_advice;
+				__u32		splice_flags;
+				__u32		rename_flags;
+				__u32		unlink_flags;
+				__u32		hardlink_flags;
+				__u32		xattr_flags;
+				__u32		msg_ring_flags;
+			};
+			__u64	user_data;	/* data to be passed back at completion time */
+			/* pack this to avoid bogus arm OABI complaints */
+			union {
+				/* index into fixed buffers, if used */
+				__u16	buf_index;
+				/* for grouped buffer selection */
+				__u16	buf_group;
+			} __attribute__((packed));
+			/* personality to use, if used */
+			__u16	personality;
+			union {
+				__s32	splice_fd_in;
+				__u32	file_index;
+				struct {
+					__u16	notification_idx;
+					__u16	addr_len;
+				};
+			};
+			union {
+				struct {
+					__u64	addr3;
+					__u64	__pad2[1];
+				};
+				/*
+				 * If the ring is initialized with IORING_SETUP_SQE128, then
+				 * this field is used for 80 bytes of arbitrary command data
+				 */
+				__u8	cmd[0];
+			};
 		};
 	};
-	union {
-		__u64	addr;	/* pointer to buffer or iovecs */
-		__u64	splice_off_in;
-	};
-	__u32	len;		/* buffer size or number of iovecs */
-	union {
-		__kernel_rwf_t	rw_flags;
-		__u32		fsync_flags;
-		__u16		poll_events;	/* compatibility */
-		__u32		poll32_events;	/* word-reversed for BE */
-		__u32		sync_range_flags;
-		__u32		msg_flags;
-		__u32		timeout_flags;
-		__u32		accept_flags;
-		__u32		cancel_flags;
-		__u32		open_flags;
-		__u32		statx_flags;
-		__u32		fadvise_advice;
-		__u32		splice_flags;
-		__u32		rename_flags;
-		__u32		unlink_flags;
-		__u32		hardlink_flags;
-		__u32		xattr_flags;
-		__u32		msg_ring_flags;
-	};
-	__u64	user_data;	/* data to be passed back at completion time */
-	/* pack this to avoid bogus arm OABI complaints */
-	union {
-		/* index into fixed buffers, if used */
-		__u16	buf_index;
-		/* for grouped buffer selection */
-		__u16	buf_group;
-	} __attribute__((packed));
-	/* personality to use, if used */
-	__u16	personality;
-	union {
-		__s32	splice_fd_in;
-		__u32	file_index;
-		struct {
-			__u16	notification_idx;
-			__u16	addr_len;
-		};
-	};
-	union {
-		struct {
-			__u64	addr3;
-			__u64	__pad2[1];
-		};
-		/*
-		 * If the ring is initialized with IORING_SETUP_SQE128, then
-		 * this field is used for 80 bytes of arbitrary command data
-		 */
-		__u8	cmd[0];
-	};
 };
 
 /*