[PATCH liburing v2 1/7] syscall: Make io_uring syscall arguments consistent

Ammar Faizi
2022-08-30T00:56:58Z

Make the arguments of io_uring syscalls consistent with what is said in
the manpage. No functional change is intended.

Link: https://lore.kernel.org/io-uring/CADUfDZpE_gPyfN=dLKB6nu-++ZKyebpWTvYGNOmdP1-c_BLZZA@mail.gmail.com
Link: https://lore.kernel.org/io-uring/CADUfDZr0mPn_REb24aEPa477T+CYeoV5hcbURqX9kazCUqRp4A@mail.gmail.com
Suggested-by: Caleb Sander <csander@purestorage.com>
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
---
src/arch/generic/syscall.h | 19 ++++++++++---------
src/arch/syscall-defs.h | 19 ++++++++++---------
2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/arch/generic/syscall.h b/src/arch/generic/syscall.h
index 5a172e1..00730e0 100644
--- a/src/arch/generic/syscall.h
+++ b/src/arch/generic/syscall.h
@@ -5,15 +5,15 @@

#include <fcntl.h>

-static inline int __sys_io_uring_register(int fd, unsigned opcode,
- const void *arg, unsigned nr_args)
+static inline int __sys_io_uring_register(unsigned int fd, unsigned int opcode,
+ const void *arg, unsigned int nr_args)
{
int ret;
ret = syscall(__NR_io_uring_register, fd, opcode, arg, nr_args);
return (ret < 0) ? -errno : ret;
}

-static inline int __sys_io_uring_setup(unsigned entries,
+static inline int __sys_io_uring_setup(unsigned int entries,
struct io_uring_params *p)
{
int ret;
@@ -21,9 +21,10 @@ static inline int __sys_io_uring_setup(unsigned entries,
return (ret < 0) ? -errno : ret;
}

-static inline int __sys_io_uring_enter2(int fd, unsigned to_submit,
- unsigned min_complete, unsigned flags,
- sigset_t *sig, int sz)
+static inline int __sys_io_uring_enter2(unsigned int fd, unsigned int to_submit,
+ unsigned int min_complete,
+ unsigned int flags, sigset_t *sig,
+ size_t sz)
{
int ret;
ret = syscall(__NR_io_uring_enter, fd, to_submit, min_complete, flags,
@@ -31,9 +32,9 @@ static inline int __sys_io_uring_enter2(int fd, unsigned to_submit,
return (ret < 0) ? -errno : ret;
}

-static inline int __sys_io_uring_enter(int fd, unsigned to_submit,
- unsigned min_complete, unsigned flags,
- sigset_t *sig)
+static inline int __sys_io_uring_enter(unsigned int fd, unsigned int to_submit,
+ unsigned int min_complete,
+ unsigned int flags, sigset_t *sig)
{
return __sys_io_uring_enter2(fd, to_submit, min_complete, flags, sig,
_NSIG / 8);
diff --git a/src/arch/syscall-defs.h b/src/arch/syscall-defs.h
index 374aa0d..4afb2af 100644
--- a/src/arch/syscall-defs.h
+++ b/src/arch/syscall-defs.h
@@ -61,30 +61,31 @@ static inline int __sys_close(int fd)
return (int) __do_syscall1(__NR_close, fd);
}

-static inline int __sys_io_uring_register(int fd, unsigned opcode,
- const void *arg, unsigned nr_args)
+static inline int __sys_io_uring_register(unsigned int fd, unsigned int opcode,
+ const void *arg, unsigned int nr_args)
{
return (int) __do_syscall4(__NR_io_uring_register, fd, opcode, arg,
nr_args);
}

-static inline int __sys_io_uring_setup(unsigned entries,
+static inline int __sys_io_uring_setup(unsigned int entries,
struct io_uring_params *p)
{
return (int) __do_syscall2(__NR_io_uring_setup, entries, p);
}

-static inline int __sys_io_uring_enter2(int fd, unsigned to_submit,
- unsigned min_complete, unsigned flags,
- sigset_t *sig, int sz)
+static inline int __sys_io_uring_enter2(unsigned int fd, unsigned int to_submit,
+ unsigned int min_complete,
+ unsigned int flags, sigset_t *sig,
+ size_t sz)
{
return (int) __do_syscall6(__NR_io_uring_enter, fd, to_submit,
min_complete, flags, sig, sz);
}

-static inline int __sys_io_uring_enter(int fd, unsigned to_submit,
- unsigned min_complete, unsigned flags,
- sigset_t *sig)
+static inline int __sys_io_uring_enter(unsigned int fd, unsigned int to_submit,
+ unsigned int min_complete,
+ unsigned int flags, sigset_t *sig)
{
return __sys_io_uring_enter2(fd, to_submit, min_complete, flags, sig,
_NSIG / 8);
--
Ammar Faizi