Message ID | 20220829030521.3373516-2-ammar.faizi@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Export io_uring syscall functions | expand |
On Sun, Aug 28, 2022 at 8:07 PM Ammar Faizi <ammarfaizi2@gnuweeb.org> wrote: > > --- a/src/include/liburing.h > +++ b/src/include/liburing.h > @@ -202,6 +202,14 @@ int io_uring_register_file_alloc_range(struct io_uring *ring, > int io_uring_register_notifications(struct io_uring *ring, unsigned nr, > struct io_uring_notification_slot *slots); > int io_uring_unregister_notifications(struct io_uring *ring); > +int io_uring_enter(unsigned int fd, unsigned int to_submit, > + unsigned int min_complete, unsigned int flags, > + sigset_t *sig); > +int io_uring_enter2(int fd, unsigned to_submit, unsigned min_complete, > + unsigned flags, sigset_t *sig, int sz); > +int io_uring_setup(unsigned entries, struct io_uring_params *p); > +int io_uring_register(int fd, unsigned opcode, const void *arg, > + unsigned nr_args); Can we be consistent about using "int fd"? And either standardize on "unsigned" or "unsigned int"? Looks like syscalls should maybe be separated by an empty line from the register/unregister functions in the header file. > --- /dev/null > +++ b/src/syscall.c > @@ -0,0 +1,30 @@ > +/* SPDX-License-Identifier: MIT */ > + > +#include "lib.h" Looks like this include is unused? Other than that, Reviewed-by: Caleb Sander <csander@purestorage.com>
On Sun, Aug 28, 2022 at 8:07 PM Ammar Faizi <ammarfaizi2@gnuweeb.org> wrote: > > --- a/src/include/liburing.h > +++ b/src/include/liburing.h > @@ -202,6 +202,14 @@ int io_uring_register_file_alloc_range(struct io_uring *ring, > int io_uring_register_notifications(struct io_uring *ring, unsigned nr, > struct io_uring_notification_slot *slots); > int io_uring_unregister_notifications(struct io_uring *ring); > +int io_uring_enter(unsigned int fd, unsigned int to_submit, > + unsigned int min_complete, unsigned int flags, > + sigset_t *sig); > +int io_uring_enter2(int fd, unsigned to_submit, unsigned min_complete, > + unsigned flags, sigset_t *sig, int sz); Also, from the io_uring_enter() man page, it appears that "void *" would be a more appropriate type for the pointer argument in io_uring_enter2(). And "size_t" for sz. --Caleb
diff --git a/src/Makefile b/src/Makefile index dad379d..73a98ba 100644 --- a/src/Makefile +++ b/src/Makefile @@ -32,7 +32,7 @@ endif all: $(all_targets) -liburing_srcs := setup.c queue.c register.c +liburing_srcs := setup.c queue.c register.c syscall.c ifeq ($(CONFIG_NOLIBC),y) liburing_srcs += nolibc.c diff --git a/src/include/liburing.h b/src/include/liburing.h index 66c5095..7db1ea9 100644 --- a/src/include/liburing.h +++ b/src/include/liburing.h @@ -202,6 +202,14 @@ int io_uring_register_file_alloc_range(struct io_uring *ring, int io_uring_register_notifications(struct io_uring *ring, unsigned nr, struct io_uring_notification_slot *slots); int io_uring_unregister_notifications(struct io_uring *ring); +int io_uring_enter(unsigned int fd, unsigned int to_submit, + unsigned int min_complete, unsigned int flags, + sigset_t *sig); +int io_uring_enter2(int fd, unsigned to_submit, unsigned min_complete, + unsigned flags, sigset_t *sig, int sz); +int io_uring_setup(unsigned entries, struct io_uring_params *p); +int io_uring_register(int fd, unsigned opcode, const void *arg, + unsigned nr_args); /* * Helper for the peek/wait single cqe functions. Exported because of that, diff --git a/src/liburing.map b/src/liburing.map index 7d8f143..8573dfc 100644 --- a/src/liburing.map +++ b/src/liburing.map @@ -62,4 +62,8 @@ LIBURING_2.3 { io_uring_register_file_alloc_range; io_uring_register_notifications; io_uring_unregister_notifications; + io_uring_enter; + io_uring_enter2; + io_uring_setup; + io_uring_register; } LIBURING_2.2; diff --git a/src/syscall.c b/src/syscall.c new file mode 100644 index 0000000..fcc6808 --- /dev/null +++ b/src/syscall.c @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: MIT */ + +#include "lib.h" +#include "syscall.h" +#include <liburing.h> + +int io_uring_enter(unsigned int fd, unsigned int to_submit, + unsigned int min_complete, unsigned int flags, + sigset_t *sig) +{ + return __sys_io_uring_enter(fd, to_submit, min_complete, flags, sig); +} + +int io_uring_enter2(int fd, unsigned to_submit, unsigned min_complete, + unsigned flags, sigset_t *sig, int sz) +{ + return __sys_io_uring_enter2(fd, to_submit, min_complete, flags, sig, + sz); +} + +int io_uring_setup(unsigned entries, struct io_uring_params *p) +{ + return __sys_io_uring_setup(entries, p); +} + +int io_uring_register(int fd, unsigned opcode, const void *arg, + unsigned nr_args) +{ + return __sys_io_uring_register(fd, opcode, arg, nr_args); +}