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 | __u64 off; /* offset into file */ | 23 | __u64 off; /* offset into file */ |
| 24 | __u64 addr2; | 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 | __u32 len; /* buffer size or number of iovecs */ | 30 | __u32 len; /* buffer size or number of iovecs */ |
| 28 | union { | 31 | union { |
| 29 | __kernel_rwf_t rw_flags; | 32 | __kernel_rwf_t rw_flags; |
| @@ -37,6 +40,7 @@ struct io_uring_sqe { · 7 unmodified lines | |||
| 37 | __u32 open_flags; | 40 | __u32 open_flags; |
| 38 | __u32 statx_flags; | 41 | __u32 statx_flags; |
| 39 | __u32 fadvise_advice; | 42 | __u32 fadvise_advice; |
| 43 | __u32 splice_flags; | ||
| 40 | }; | 44 | }; |
| 41 | __u64 user_data; /* data to be passed back at completion time */ | 45 | __u64 user_data; /* data to be passed back at completion time */ |
| 42 | union { | 46 | union { |
| @@ -45,6 +49,7 @@ struct io_uring_sqe { · 2 unmodified lines | |||
| 45 | __u16 buf_index; | 49 | __u16 buf_index; |
| 46 | /* personality to use, if used */ | 50 | /* personality to use, if used */ |
| 47 | __u16 personality; | 51 | __u16 personality; |
| 52 | __s32 splice_fd_in; | ||
| 48 | }; | 53 | }; |
| 49 | __u64 __pad2[3]; | 54 | __u64 __pad2[3]; |
| 50 | }; | 55 | }; |
| @@ -113,6 +118,7 @@ enum { · 62 unmodified lines | |||
| 113 | IORING_OP_RECV, | 118 | IORING_OP_RECV, |
| 114 | IORING_OP_OPENAT2, | 119 | IORING_OP_OPENAT2, |
| 115 | IORING_OP_EPOLL_CTL, | 120 | IORING_OP_EPOLL_CTL, |
| 121 | IORING_OP_SPLICE, | ||
| 116 | 122 | ||
| 117 | /* this goes last, obviously */ | 123 | /* this goes last, obviously */ |
| 118 | IORING_OP_LAST, | 124 | IORING_OP_LAST, |
| @@ -128,6 +134,12 @@ enum { · 9 unmodified lines | |||
| 128 | */ | 134 | */ |
| 129 | #define IORING_TIMEOUT_ABS (1U << 0) | 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 | * IO completion data structure (Completion Queue Entry) | 144 | * IO completion data structure (Completion Queue Entry) |
| 133 | */ | 145 | */ |