summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2019-11-14 00:27:42 +0300
committerJens Axboe <axboe@kernel.dk>2019-11-13 14:33:59 -0700
commit3c9d958095c2e26ca43783a1d0c1c95784c844e6 (patch)
tree75947da50025d5d72b419129157a3470471dc2b1
parente1420b89cd5954d4ca72cc6ab3005cc78ee9061a (diff)
downloadliburing-3c9d958095c2e26ca43783a1d0c1c95784c844e6.tar.gz
liburing-3c9d958095c2e26ca43783a1d0c1c95784c844e6.tar.bz2
io_uring: invalid fd for file-less operations
If an operation doesn't need a file, set fd to an invalid value. This would help to spot an unwanted fdget() in the kernel, and is conceptually more correct (though negotiable) Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--src/include/liburing.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/include/liburing.h b/src/include/liburing.h
index 17bc80e..892efcf 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -240,7 +240,7 @@ static inline void io_uring_prep_poll_add(struct io_uring_sqe *sqe, int fd,
static inline void io_uring_prep_poll_remove(struct io_uring_sqe *sqe,
void *user_data)
{
- io_uring_prep_rw(IORING_OP_POLL_REMOVE, sqe, 0, user_data, 0, 0);
+ io_uring_prep_rw(IORING_OP_POLL_REMOVE, sqe, -1, user_data, 0, 0);
}
static inline void io_uring_prep_fsync(struct io_uring_sqe *sqe, int fd,
@@ -252,21 +252,21 @@ static inline void io_uring_prep_fsync(struct io_uring_sqe *sqe, int fd,
static inline void io_uring_prep_nop(struct io_uring_sqe *sqe)
{
- io_uring_prep_rw(IORING_OP_NOP, sqe, 0, NULL, 0, 0);
+ io_uring_prep_rw(IORING_OP_NOP, sqe, -1, NULL, 0, 0);
}
static inline void io_uring_prep_timeout(struct io_uring_sqe *sqe,
struct __kernel_timespec *ts,
unsigned count, unsigned flags)
{
- io_uring_prep_rw(IORING_OP_TIMEOUT, sqe, 0, ts, 1, count);
+ io_uring_prep_rw(IORING_OP_TIMEOUT, sqe, -1, ts, 1, count);
sqe->timeout_flags = flags;
}
static inline void io_uring_prep_timeout_remove(struct io_uring_sqe *sqe,
__u64 user_data, unsigned flags)
{
- io_uring_prep_rw(IORING_OP_TIMEOUT_REMOVE, sqe, 0, (void *)user_data, 0, 0);
+ io_uring_prep_rw(IORING_OP_TIMEOUT_REMOVE, sqe, -1, (void *)user_data, 0, 0);
sqe->timeout_flags = flags;
}
@@ -281,7 +281,7 @@ static inline void io_uring_prep_accept(struct io_uring_sqe *sqe, int fd,
static inline void io_uring_prep_cancel(struct io_uring_sqe *sqe, void *user_data,
int flags)
{
- io_uring_prep_rw(IORING_OP_ASYNC_CANCEL, sqe, 0, user_data, 0, 0);
+ io_uring_prep_rw(IORING_OP_ASYNC_CANCEL, sqe, -1, user_data, 0, 0);
sqe->cancel_flags = flags;
}
@@ -289,7 +289,7 @@ static inline void io_uring_prep_link_timeout(struct io_uring_sqe *sqe,
struct __kernel_timespec *ts,
unsigned flags)
{
- io_uring_prep_rw(IORING_OP_LINK_TIMEOUT, sqe, 0, ts, 1, 0);
+ io_uring_prep_rw(IORING_OP_LINK_TIMEOUT, sqe, -1, ts, 1, 0);
sqe->timeout_flags = flags;
}