public inbox for [email protected]
 help / color / mirror / Atom feed
From: Caleb Sander <[email protected]>
To: Ammar Faizi <[email protected]>
Cc: Jens Axboe <[email protected]>,
	Muhammad Rizki <[email protected]>,
	 Kanna Scarlet <[email protected]>,
	io-uring Mailing List <[email protected]>,
	 Linux Kernel Mailing List <[email protected]>,
	 "GNU/Weeb Mailing List" <[email protected]>
Subject: Re: [RFC PATCH liburing v1 4/4] test/io_uring_{enter,setup,register}: Use the exported syscall functions
Date: Mon, 29 Aug 2022 12:58:12 -0700	[thread overview]
Message-ID: <CADUfDZqbbhhaR0NFepHxMt3TnxRTYOgTZCFe1A2PRSY7z9jCRQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>

Reviewed-by: Caleb Sander <[email protected]>

On Sun, Aug 28, 2022 at 8:08 PM Ammar Faizi <[email protected]> wrote:
>
> From: Ammar Faizi <[email protected]>
>
> These tests use the internal definition of __sys_io_uring* functions.
> A previous commit exported new functions that do the same thing with
> those __sys_io_uring* functions. Test the exported functions instead of
> the internal functions.
>
> No functional change is intended.
>
> Cc: Caleb Sander <[email protected]>
> Signed-off-by: Ammar Faizi <[email protected]>
> ---
>  test/io_uring_enter.c    | 10 +++++-----
>  test/io_uring_register.c | 34 ++++++++++++++++------------------
>  test/io_uring_setup.c    |  4 ++--
>  3 files changed, 23 insertions(+), 25 deletions(-)
>
> diff --git a/test/io_uring_enter.c b/test/io_uring_enter.c
> index 67cc8c5..ecd54ff 100644
> --- a/test/io_uring_enter.c
> +++ b/test/io_uring_enter.c
> @@ -38,7 +38,7 @@ static int expect_fail(int fd, unsigned int to_submit,
>  {
>         int ret;
>
> -       ret = __sys_io_uring_enter(fd, to_submit, min_complete, flags, sig);
> +       ret = io_uring_enter(fd, to_submit, min_complete, flags, sig);
>         if (ret >= 0) {
>                 fprintf(stderr, "expected %s, but call succeeded\n", strerror(-error));
>                 return 1;
> @@ -62,7 +62,7 @@ static int try_io_uring_enter(int fd, unsigned int to_submit,
>                 return expect_fail(fd, to_submit, min_complete, flags, sig,
>                                    expect);
>
> -       ret = __sys_io_uring_enter(fd, to_submit, min_complete, flags, sig);
> +       ret = io_uring_enter(fd, to_submit, min_complete, flags, sig);
>         if (ret != expect) {
>                 fprintf(stderr, "Expected %d, got %d\n", expect, ret);
>                 return 1;
> @@ -211,8 +211,8 @@ int main(int argc, char **argv)
>         /* fill the sq ring */
>         sq_entries = ring.sq.ring_entries;
>         submit_io(&ring, sq_entries);
> -       ret = __sys_io_uring_enter(ring.ring_fd, 0, sq_entries,
> -                                       IORING_ENTER_GETEVENTS, NULL);
> +       ret = io_uring_enter(ring.ring_fd, 0, sq_entries,
> +                            IORING_ENTER_GETEVENTS, NULL);
>         if (ret < 0) {
>                 fprintf(stderr, "io_uring_enter: %s\n", strerror(-ret));
>                 status = 1;
> @@ -246,7 +246,7 @@ int main(int argc, char **argv)
>          */
>         io_uring_smp_store_release(sq->ktail, ktail);
>
> -       ret = __sys_io_uring_enter(ring.ring_fd, 1, 0, 0, NULL);
> +       ret = io_uring_enter(ring.ring_fd, 1, 0, 0, NULL);
>         /* now check to see if our sqe was dropped */
>         if (*sq->kdropped == dropped) {
>                 fprintf(stderr, "dropped counter did not increase\n");
> diff --git a/test/io_uring_register.c b/test/io_uring_register.c
> index 4609354..dd4af7c 100644
> --- a/test/io_uring_register.c
> +++ b/test/io_uring_register.c
> @@ -36,17 +36,17 @@ static int expect_fail(int fd, unsigned int opcode, void *arg,
>  {
>         int ret;
>
> -       ret = __sys_io_uring_register(fd, opcode, arg, nr_args);
> +       ret = io_uring_register(fd, opcode, arg, nr_args);
>         if (ret >= 0) {
>                 int ret2 = 0;
>
>                 fprintf(stderr, "expected %s, but call succeeded\n", strerror(error));
>                 if (opcode == IORING_REGISTER_BUFFERS) {
> -                       ret2 = __sys_io_uring_register(fd,
> -                                       IORING_UNREGISTER_BUFFERS, 0, 0);
> +                       ret2 = io_uring_register(fd, IORING_UNREGISTER_BUFFERS,
> +                                                0, 0);
>                 } else if (opcode == IORING_REGISTER_FILES) {
> -                       ret2 = __sys_io_uring_register(fd,
> -                                       IORING_UNREGISTER_FILES, 0, 0);
> +                       ret2 = io_uring_register(fd, IORING_UNREGISTER_FILES, 0,
> +                                                0);
>                 }
>                 if (ret2) {
>                         fprintf(stderr, "internal error: failed to unregister\n");
> @@ -66,7 +66,7 @@ static int new_io_uring(int entries, struct io_uring_params *p)
>  {
>         int fd;
>
> -       fd = __sys_io_uring_setup(entries, p);
> +       fd = io_uring_setup(entries, p);
>         if (fd < 0) {
>                 perror("io_uring_setup");
>                 exit(1);
> @@ -186,15 +186,14 @@ static int test_max_fds(int uring_fd)
>          */
>         nr_fds = UINT_MAX;
>         while (nr_fds) {
> -               ret = __sys_io_uring_register(uring_fd, IORING_REGISTER_FILES,
> -                                               fd_as, nr_fds);
> +               ret = io_uring_register(uring_fd, IORING_REGISTER_FILES, fd_as,
> +                                       nr_fds);
>                 if (ret != 0) {
>                         nr_fds /= 2;
>                         continue;
>                 }
>                 status = 0;
> -               ret = __sys_io_uring_register(uring_fd, IORING_UNREGISTER_FILES,
> -                                               0, 0);
> +               ret = io_uring_register(uring_fd, IORING_UNREGISTER_FILES, 0, 0);
>                 if (ret < 0) {
>                         ret = errno;
>                         errno = ret;
> @@ -230,7 +229,7 @@ static int test_memlock_exceeded(int fd)
>         iov.iov_base = buf;
>
>         while (iov.iov_len) {
> -               ret = __sys_io_uring_register(fd, IORING_REGISTER_BUFFERS, &iov, 1);
> +               ret = io_uring_register(fd, IORING_REGISTER_BUFFERS, &iov, 1);
>                 if (ret < 0) {
>                         if (errno == ENOMEM) {
>                                 iov.iov_len /= 2;
> @@ -244,8 +243,7 @@ static int test_memlock_exceeded(int fd)
>                         free(buf);
>                         return 1;
>                 }
> -               ret = __sys_io_uring_register(fd, IORING_UNREGISTER_BUFFERS,
> -                                               NULL, 0);
> +               ret = io_uring_register(fd, IORING_UNREGISTER_BUFFERS, NULL, 0);
>                 if (ret != 0) {
>                         fprintf(stderr, "error: unregister failed with %d\n", errno);
>                         free(buf);
> @@ -283,14 +281,14 @@ static int test_iovec_nr(int fd)
>
>         /* reduce to UIO_MAXIOV */
>         nr = UIO_MAXIOV;
> -       ret = __sys_io_uring_register(fd, IORING_REGISTER_BUFFERS, iovs, nr);
> +       ret = io_uring_register(fd, IORING_REGISTER_BUFFERS, iovs, nr);
>         if (ret && (errno == ENOMEM || errno == EPERM) && geteuid()) {
>                 fprintf(stderr, "can't register large iovec for regular users, skip\n");
>         } else if (ret != 0) {
>                 fprintf(stderr, "expected success, got %d\n", errno);
>                 status = 1;
>         } else {
> -               __sys_io_uring_register(fd, IORING_UNREGISTER_BUFFERS, 0, 0);
> +               io_uring_register(fd, IORING_UNREGISTER_BUFFERS, 0, 0);
>         }
>         free(buf);
>         free(iovs);
> @@ -344,7 +342,7 @@ static int test_iovec_size(int fd)
>                  */
>                 iov.iov_base = buf;
>                 iov.iov_len = 2*1024*1024;
> -               ret = __sys_io_uring_register(fd, IORING_REGISTER_BUFFERS, &iov, 1);
> +               ret = io_uring_register(fd, IORING_REGISTER_BUFFERS, &iov, 1);
>                 if (ret < 0) {
>                         if (ret == -ENOMEM)
>                                 printf("Unable to test registering of a huge "
> @@ -356,8 +354,8 @@ static int test_iovec_size(int fd)
>                                 status = 1;
>                         }
>                 } else {
> -                       ret = __sys_io_uring_register(fd,
> -                                       IORING_UNREGISTER_BUFFERS, 0, 0);
> +                       ret = io_uring_register(fd, IORING_UNREGISTER_BUFFERS,
> +                                               0, 0);
>                         if (ret < 0) {
>                                 fprintf(stderr, "io_uring_unregister: %s\n",
>                                         strerror(-ret));
> diff --git a/test/io_uring_setup.c b/test/io_uring_setup.c
> index 67d5f4f..d945421 100644
> --- a/test/io_uring_setup.c
> +++ b/test/io_uring_setup.c
> @@ -102,7 +102,7 @@ try_io_uring_setup(unsigned entries, struct io_uring_params *p, int expect)
>  {
>         int ret;
>
> -       ret = __sys_io_uring_setup(entries, p);
> +       ret = io_uring_setup(entries, p);
>         if (ret != expect) {
>                 fprintf(stderr, "expected %d, got %d\n", expect, ret);
>                 /* if we got a valid uring, close it */
> @@ -164,7 +164,7 @@ main(int argc, char **argv)
>
>         /* read/write on io_uring_fd */
>         memset(&p, 0, sizeof(p));
> -       fd = __sys_io_uring_setup(1, &p);
> +       fd = io_uring_setup(1, &p);
>         if (fd < 0) {
>                 fprintf(stderr, "io_uring_setup failed with %d, expected success\n",
>                        -fd);
> --
> Ammar Faizi
>

      reply	other threads:[~2022-08-29 19:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29  3:07 [RFC PATCH liburing v1 0/4] Export io_uring syscall functions Ammar Faizi
2022-08-29  3:07 ` [RFC PATCH liburing v1 1/4] syscall: Add " Ammar Faizi
2022-08-29 19:46   ` Caleb Sander
2022-08-29 19:53   ` Caleb Sander
2022-08-29  3:07 ` [RFC PATCH liburing v1 2/4] man: Clarify "man 2" entry for io_uring syscalls Ammar Faizi
2022-08-29  3:07 ` [RFC PATCH liburing v1 3/4] man: Alias `io_uring_enter2()` to `io_uring_enter()` Ammar Faizi
2022-08-29 19:56   ` Caleb Sander
2022-08-29  3:07 ` [RFC PATCH liburing v1 4/4] test/io_uring_{enter,setup,register}: Use the exported syscall functions Ammar Faizi
2022-08-29 19:58   ` Caleb Sander [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADUfDZqbbhhaR0NFepHxMt3TnxRTYOgTZCFe1A2PRSY7z9jCRQ@mail.gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox