Remove old liburing version support as it's now included
This commit is contained in:
@@ -18,106 +18,6 @@
|
||||
|
||||
#define RINGLOOP_DEFAULT_SIZE 1024
|
||||
|
||||
#ifndef IORING_RECV_MULTISHOT /* liburing-2.3 check */
|
||||
#define IORING_OP_SENDMSG_ZC 48
|
||||
#endif
|
||||
|
||||
static inline void my_uring_prep_rw(int op, struct io_uring_sqe *sqe, int fd, const void *addr, unsigned len, off_t offset)
|
||||
{
|
||||
// Prepare a read/write operation without clearing user_data
|
||||
// Very recently, 22 Dec 2021, liburing finally got this change too (8ecd3fd959634df81d66af8b3a69c16202a014e8)
|
||||
// But all versions prior to it (sadly) clear user_data
|
||||
__u64 user_data = sqe->user_data;
|
||||
io_uring_prep_rw(op, sqe, fd, addr, len, offset);
|
||||
sqe->user_data = user_data;
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_readv(struct io_uring_sqe *sqe, int fd, const struct iovec *iovecs, unsigned nr_vecs, off_t offset)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_READV, sqe, fd, iovecs, nr_vecs, offset);
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_read_fixed(struct io_uring_sqe *sqe, int fd, void *buf, unsigned nbytes, off_t offset, int buf_index)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_READ_FIXED, sqe, fd, buf, nbytes, offset);
|
||||
sqe->buf_index = buf_index;
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_writev(struct io_uring_sqe *sqe, int fd, const struct iovec *iovecs, unsigned nr_vecs, off_t offset)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_WRITEV, sqe, fd, iovecs, nr_vecs, offset);
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_write_fixed(struct io_uring_sqe *sqe, int fd, const void *buf, unsigned nbytes, off_t offset, int buf_index)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_WRITE_FIXED, sqe, fd, buf, nbytes, offset);
|
||||
sqe->buf_index = buf_index;
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_recvmsg(struct io_uring_sqe *sqe, int fd, struct msghdr *msg, unsigned flags)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_RECVMSG, sqe, fd, msg, 1, 0);
|
||||
sqe->msg_flags = flags;
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_sendmsg(struct io_uring_sqe *sqe, int fd, const struct msghdr *msg, unsigned flags)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_SENDMSG, sqe, fd, msg, 1, 0);
|
||||
sqe->msg_flags = flags;
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_sendmsg_zc(struct io_uring_sqe *sqe, int fd, const struct msghdr *msg, unsigned flags)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_SENDMSG_ZC, sqe, fd, msg, 1, 0);
|
||||
sqe->msg_flags = flags;
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_poll_add(struct io_uring_sqe *sqe, int fd, short poll_mask)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_POLL_ADD, sqe, fd, NULL, 0, 0);
|
||||
sqe->poll_events = poll_mask;
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_poll_remove(struct io_uring_sqe *sqe, void *user_data)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_POLL_REMOVE, sqe, 0, user_data, 0, 0);
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_fsync(struct io_uring_sqe *sqe, int fd, unsigned fsync_flags)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_FSYNC, sqe, fd, NULL, 0, 0);
|
||||
sqe->fsync_flags = fsync_flags;
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_nop(struct io_uring_sqe *sqe)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_NOP, sqe, 0, NULL, 0, 0);
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_timeout(struct io_uring_sqe *sqe, struct __kernel_timespec *ts, unsigned count, unsigned flags)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_TIMEOUT, sqe, 0, ts, 1, count);
|
||||
sqe->timeout_flags = flags;
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_timeout_remove(struct io_uring_sqe *sqe, __u64 user_data, unsigned flags)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_TIMEOUT_REMOVE, sqe, 0, (void *)user_data, 0, 0);
|
||||
sqe->timeout_flags = flags;
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_accept(struct io_uring_sqe *sqe, int fd, struct sockaddr *addr, socklen_t *addrlen, int flags)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_ACCEPT, sqe, fd, addr, 0, (__u64) addrlen);
|
||||
sqe->accept_flags = flags;
|
||||
}
|
||||
|
||||
static inline void my_uring_prep_cancel(struct io_uring_sqe *sqe, void *user_data, int flags)
|
||||
{
|
||||
my_uring_prep_rw(IORING_OP_ASYNC_CANCEL, sqe, 0, user_data, 0, 0);
|
||||
sqe->cancel_flags = flags;
|
||||
}
|
||||
|
||||
struct ring_data_t
|
||||
{
|
||||
struct iovec iov; // for single-entry read/write operations
|
||||
|
||||
Reference in New Issue
Block a user