From a992ffa48292f1175ea2621de58fb4cde3bb62dd Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 10 Jan 2019 15:11:07 -0700 Subject: io_queue_init: pass in flags, not io_uring_params We don't need any of the information in there in the caller, and this makes it harder to abuse as we don't require the caller to have memset() the struct first. Signed-off-by: Jens Axboe --- src/io_uring.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/io_uring.c') diff --git a/src/io_uring.c b/src/io_uring.c index bf79b9f..a75d135 100644 --- a/src/io_uring.c +++ b/src/io_uring.c @@ -188,17 +188,20 @@ err: * Returns -1 on error, or zero on success. On success, 'ring' * contains the necessary information to read/write to the rings. */ -int io_uring_queue_init(unsigned entries, struct io_uring_params *p, - struct io_uring *ring) +int io_uring_queue_init(unsigned entries, struct io_uring *ring, unsigned flags) { + struct io_uring_params p; int fd, ret; - fd = io_uring_setup(entries, p); + memset(&p, 0, sizeof(p)); + p.flags = flags; + + fd = io_uring_setup(entries, &p); if (fd < 0) return fd; memset(ring, 0, sizeof(*ring)); - ret = io_uring_mmap(fd, p, &ring->sq, &ring->cq); + ret = io_uring_mmap(fd, &p, &ring->sq, &ring->cq); if (!ret) ring->ring_fd = fd; return ret; -- cgit