From 80272cbeb42bcd0b39a75685a50b0009b77cd380 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 23 Oct 2024 11:13:23 -0600 Subject: [PATCH] Rename '*ret' to '*err' for io_uring_setup_buf_ring() Do that both in the source and in the man page, it better describes what the purpose of this variable is - in case of error (eg NULL return), it'll be filled with the error that occurred. Signed-off-by: Jens Axboe --- man/io_uring_setup_buf_ring.3 | 6 +++--- src/include/liburing.h | 2 +- src/setup.c | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/man/io_uring_setup_buf_ring.3 b/man/io_uring_setup_buf_ring.3 index 49b92ce94..df3b3afd7 100644 --- a/man/io_uring_setup_buf_ring.3 +++ b/man/io_uring_setup_buf_ring.3 @@ -13,7 +13,7 @@ io_uring_setup_buf_ring \- setup and register buffer ring for provided buffers .BI " unsigned int " nentries ", .BI " int " bgid ", .BI " unsigned int " flags ", -.BI " int *" ret ");" +.BI " int *" err ");" .BI " .fi .SH DESCRIPTION @@ -41,7 +41,7 @@ a power-of 2 in size. is the chosen buffer group ID, .I flags are modifier flags for the operation, and -.I *ret +.I *err is is a pointer to an integer for the error value if any part of the ring allocation and registration fails. @@ -78,7 +78,7 @@ On success returns a pointer to the buffer ring. On failure it returns .BR NULL and sets -.I *ret +.I *err to -errno. .SH NOTES Note that even if the kernel supports this feature, registering a provided diff --git a/src/include/liburing.h b/src/include/liburing.h index f5903d7c0..6eae13897 100644 --- a/src/include/liburing.h +++ b/src/include/liburing.h @@ -281,7 +281,7 @@ int io_uring_register(unsigned int fd, unsigned int opcode, const void *arg, struct io_uring_buf_ring *io_uring_setup_buf_ring(struct io_uring *ring, unsigned int nentries, int bgid, unsigned int flags, - int *ret); + int *err); int io_uring_free_buf_ring(struct io_uring *ring, struct io_uring_buf_ring *br, unsigned int nentries, int bgid); diff --git a/src/setup.c b/src/setup.c index fcf1a3d91..da2020ea6 100644 --- a/src/setup.c +++ b/src/setup.c @@ -595,7 +595,7 @@ __cold ssize_t io_uring_mlock_size(unsigned entries, unsigned flags) #if defined(__hppa__) static struct io_uring_buf_ring *br_setup(struct io_uring *ring, unsigned int nentries, int bgid, - unsigned int flags, int *ret) + unsigned int flags, int *err) { struct io_uring_buf_ring *br; struct io_uring_buf_reg reg; @@ -608,10 +608,10 @@ static struct io_uring_buf_ring *br_setup(struct io_uring *ring, reg.bgid = bgid; reg.flags = IOU_PBUF_RING_MMAP; - *ret = 0; + *err = 0; lret = io_uring_register_buf_ring(ring, ®, flags); if (lret) { - *ret = lret; + *err = lret; return NULL; } @@ -620,7 +620,7 @@ static struct io_uring_buf_ring *br_setup(struct io_uring *ring, br = __sys_mmap(NULL, ring_size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, ring->ring_fd, off); if (IS_ERR(br)) { - *ret = PTR_ERR(br); + *err = PTR_ERR(br); return NULL; } @@ -629,7 +629,7 @@ static struct io_uring_buf_ring *br_setup(struct io_uring *ring, #else static struct io_uring_buf_ring *br_setup(struct io_uring *ring, unsigned int nentries, int bgid, - unsigned int flags, int *ret) + unsigned int flags, int *err) { struct io_uring_buf_ring *br; struct io_uring_buf_reg reg; @@ -641,7 +641,7 @@ static struct io_uring_buf_ring *br_setup(struct io_uring *ring, br = __sys_mmap(NULL, ring_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); if (IS_ERR(br)) { - *ret = PTR_ERR(br); + *err = PTR_ERR(br); return NULL; } @@ -649,11 +649,11 @@ static struct io_uring_buf_ring *br_setup(struct io_uring *ring, reg.ring_entries = nentries; reg.bgid = bgid; - *ret = 0; + *err = 0; lret = io_uring_register_buf_ring(ring, ®, flags); if (lret) { __sys_munmap(br, ring_size); - *ret = lret; + *err = lret; br = NULL; } @@ -664,11 +664,11 @@ static struct io_uring_buf_ring *br_setup(struct io_uring *ring, struct io_uring_buf_ring *io_uring_setup_buf_ring(struct io_uring *ring, unsigned int nentries, int bgid, unsigned int flags, - int *ret) + int *err) { struct io_uring_buf_ring *br; - br = br_setup(ring, nentries, bgid, flags, ret); + br = br_setup(ring, nentries, bgid, flags, err); if (br) io_uring_buf_ring_init(br);