Add support for splice(2). - output file is specified as sqe->fd, so it's handled by generic code - hash_reg_file handled by generic code as well - len is 32bit, but should be fine - the fd_in is registered file, when SPLICE_F_FD_IN_FIXED is set, which is a splice flag (i.e. sqe->splice_flags).
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -23,7 +23,10 @@ struct io_uring_sqe { · 22 unmodified lines | ||
| 23 | 23 | __u64 off; /* offset into file */ |
| 24 | 24 | __u64 addr2; |
| 25 | 25 | }; |
| 26 | − __u64 addr; /* pointer to buffer or iovecs */ | |
| 26 | + union { | |
| 27 | + __u64 addr; /* pointer to buffer or iovecs */ | |
| 28 | + __u64 splice_off_in; | |
| 29 | + }; | |
| 27 | 30 | __u32 len; /* buffer size or number of iovecs */ |
| 28 | 31 | union { |
| 29 | 32 | __kernel_rwf_t rw_flags; |
| @@ -37,6 +40,7 @@ struct io_uring_sqe { · 7 unmodified lines | ||
| 37 | 40 | __u32 open_flags; |
| 38 | 41 | __u32 statx_flags; |
| 39 | 42 | __u32 fadvise_advice; |
| 43 | + __u32 splice_flags; | |
| 40 | 44 | }; |
| 41 | 45 | __u64 user_data; /* data to be passed back at completion time */ |
| 42 | 46 | union { |
| @@ -45,6 +49,7 @@ struct io_uring_sqe { · 2 unmodified lines | ||
| 45 | 49 | __u16 buf_index; |
| 46 | 50 | /* personality to use, if used */ |
| 47 | 51 | __u16 personality; |
| 52 | + __s32 splice_fd_in; | |
| 48 | 53 | }; |
| 49 | 54 | __u64 __pad2[3]; |
| 50 | 55 | }; |
| @@ -113,6 +118,7 @@ enum { · 62 unmodified lines | ||
| 113 | 118 | IORING_OP_RECV, |
| 114 | 119 | IORING_OP_OPENAT2, |
| 115 | 120 | IORING_OP_EPOLL_CTL, |
| 121 | + IORING_OP_SPLICE, | |
| 116 | 122 | |
| 117 | 123 | /* this goes last, obviously */ |
| 118 | 124 | IORING_OP_LAST, |
| @@ -128,6 +134,12 @@ enum { · 9 unmodified lines | ||
| 128 | 134 | */ |
| 129 | 135 | #define IORING_TIMEOUT_ABS (1U << 0) |
| 130 | 136 | |
| 137 | +/* | |
| 138 | + * sqe->splice_flags | |
| 139 | + * extends splice(2) flags | |
| 140 | + */ | |
| 141 | +#define SPLICE_F_FD_IN_FIXED (1U << 31) /* the last bit of __u32 */ | |
| 142 | + | |
| 131 | 143 | /* |
| 132 | 144 | * IO completion data structure (Completion Queue Entry) |
| 133 | 145 | */ |