Switch to IORING_OP_POLL_ADD/REMOVE
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -54,8 +54,8 @@ struct io_uring_sqe {
|
|||||||
#define IORING_OP_FSYNC 3
|
#define IORING_OP_FSYNC 3
|
||||||
#define IORING_OP_READ_FIXED 4
|
#define IORING_OP_READ_FIXED 4
|
||||||
#define IORING_OP_WRITE_FIXED 5
|
#define IORING_OP_WRITE_FIXED 5
|
||||||
#define IORING_OP_POLL 6
|
#define IORING_OP_POLL_ADD 6
|
||||||
#define IORING_OP_POLL_CANCEL 7
|
#define IORING_OP_POLL_REMOVE 7
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sqe->fsync_flags
|
* sqe->fsync_flags
|
||||||
|
|||||||
@@ -94,20 +94,20 @@ static inline void io_uring_prep_writev(struct io_uring_sqe *sqe, int fd,
|
|||||||
sqe->len = nr_vecs;
|
sqe->len = nr_vecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void io_uring_prep_poll(struct io_uring_sqe *sqe, int fd,
|
static inline void io_uring_prep_poll_add(struct io_uring_sqe *sqe, int fd,
|
||||||
short poll_mask)
|
short poll_mask)
|
||||||
{
|
{
|
||||||
memset(sqe, 0, sizeof(*sqe));
|
memset(sqe, 0, sizeof(*sqe));
|
||||||
sqe->opcode = IORING_OP_POLL;
|
sqe->opcode = IORING_OP_POLL_ADD;
|
||||||
sqe->fd = fd;
|
sqe->fd = fd;
|
||||||
sqe->poll_events = poll_mask;
|
sqe->poll_events = poll_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void io_uring_prep_poll_cancel(struct io_uring_sqe *sqe,
|
static inline void io_uring_prep_poll_remove(struct io_uring_sqe *sqe,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
memset(sqe, 0, sizeof(*sqe));
|
memset(sqe, 0, sizeof(*sqe));
|
||||||
sqe->opcode = IORING_OP_POLL_CANCEL;
|
sqe->opcode = IORING_OP_POLL_REMOVE;
|
||||||
sqe->addr = (unsigned long) user_data;
|
sqe->addr = (unsigned long) user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
io_uring_prep_poll(sqe, pipe1[0], POLLIN);
|
io_uring_prep_poll_add(sqe, pipe1[0], POLLIN);
|
||||||
io_uring_sqe_set_data(sqe, sqe);
|
io_uring_sqe_set_data(sqe, sqe);
|
||||||
addr = sqe;
|
addr = sqe;
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
io_uring_prep_poll_cancel(sqe, addr);
|
io_uring_prep_poll_remove(sqe, addr);
|
||||||
io_uring_sqe_set_data(sqe, sqe);
|
io_uring_sqe_set_data(sqe, sqe);
|
||||||
|
|
||||||
ret = io_uring_submit(&ring);
|
ret = io_uring_submit(&ring);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
io_uring_prep_poll(sqe, pipe1[0], POLLIN);
|
io_uring_prep_poll_add(sqe, pipe1[0], POLLIN);
|
||||||
|
|
||||||
ret = io_uring_submit(&cring);
|
ret = io_uring_submit(&cring);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
@@ -91,7 +91,7 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
io_uring_prep_poll(sqe, pipe2[0], POLLIN);
|
io_uring_prep_poll_add(sqe, pipe2[0], POLLIN);
|
||||||
io_uring_sqe_set_data(sqe, sqe);
|
io_uring_sqe_set_data(sqe, sqe);
|
||||||
|
|
||||||
ret = io_uring_submit(&pring);
|
ret = io_uring_submit(&pring);
|
||||||
|
|||||||
Reference in New Issue
Block a user