15 Commits

Author SHA1 Message Date
fangzhiyi18 0ae77b95ef 升级2.7
Signed-off-by: fangzhiyi18 <fangzhiyi1@huawei.com>
2024-10-21 02:53:20 +00:00
Ammar Faizi 12f4f47bac test/io_uring_{enter,setup,register}: Use the exported syscall functions
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.

Reviewed-by: Caleb Sander <csander@purestorage.com>
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Link: https://lore.kernel.org/r/20220830005122.885209-7-ammar.faizi@intel.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-08-30 08:14:18 -06:00
Ammar Faizi ea621a9688 Delete src/syscall.c and get back to use __sys_io_uring* functions
Back when I was adding nolibc support for liburing, I added new
wrapper functions for io_uring system calls. They are ____sys_io_uring*
functions (with 4 underscores), all defined as an inline function.

I left __sys_uring* functions (with 2 underscores) live in syscall.c
because I thought it might break the user if we delete them. But it
turned out that I was wrong, no user should use these functions
because we don't export them. This situation is reflected in
liburing.map and liburing.h which don't have those functions.

Do these:

  1) Delete src/syscall.c.
  2) Rename ____sys_io_uring* to __sys_io_uring*.
  3) Fix tests that still depend on libc `errno` for checking
     __sys_io_uring* functions error code.

to:

  1) Reduce the burden of maintaining syscall.c.
  2) Simplify the Makefile, no need extra branch to compile syscall.c
     with a specific condition.
  3) Simplify function naming and kill the confusion of deciding
     using __sys_uring* or ____sys_io_uring* when adding a new test that
     directly calls them. Because now we always use __sys_io_uring*.
     ____sys_io_uring* functions no longer exist.

After this patch, __sys_io_uring* functions now return -errno instead
of -1 when fails.

Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Link: https://lore.kernel.org/r/20220721090443.733104-1-ammarfaizi2@gnuweeb.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-07-21 09:32:28 -06:00
Eli Schwartz 4475e75034 tests: more work on updating exit codes to use enum-based status reporting
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
Link: https://lore.kernel.org/r/20220706034059.2817423-4-eschwartz93@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-07-06 06:44:52 -06:00
Jens Axboe 2fa6759005 test/io_uring_setup: quiet it down
We expect tests to only complain on error, silence all the useless
garbage this old test prints.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-06-23 09:45:45 -06:00
Ammar Faizi 75b7e969a4 test/io_uring_setup: Don't use __errno as local variable name
This commit fixes build for armv8l.

On some systems, the macro `errno` is defined as
`#define errno (*__errno())`

It is clear that `__errno` is a global function on such systems.

The problem is, `io_uring_setup.c` uses `int __errno` as a local
variable, so it shadows the `__errno` function, result in the
following error:

```
       CC io_uring_setup
  io_uring_setup.c:116:12: error: called object type 'int' is not a function or function pointer
          __errno = errno;
                    ^~~~~
  /usr/include/errno.h:58:24: note: expanded from macro 'errno'
  #define errno (*__errno())
                  ~~~~~~~^
  1 error generated.
  make[1]: *** [Makefile:163: io_uring_setup] Error 1
  make[1]: *** Waiting for unfinished jobs....
```

Fix this by not using `__errno` as local variable name.

Reported-by: Louvian Lyndal <louvianlyndal@gmail.com>
Tested-by: Louvian Lyndal <louvianlyndal@gmail.com>
Signed-off-by: Ammar Faizi <ammarfaizi2@gmail.com>
Link: https://lore.kernel.org/r/2d53ef3f50713749511865a7f89e27c5378e316d.1631692342.git.ammarfaizi2@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2021-09-15 06:40:49 -06:00
Jens Axboe 6c32e92bb0 test: add potential argument, ignore if unused
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-05-19 17:36:19 -06:00
Jens Axboe e502435779 Add SPDX license identifiers
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-02-11 20:34:12 -07:00
Jens Axboe 3825bdbc58 Update io_uring.h
Move bits from the pending 5.6 changes in.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-01-23 20:03:35 -07:00
Jens Axboe 96144ea798 Split out system call bits from library interface
Rename the io_uring_* system calls to __sys_io_uring_* and make them
locals.

We only have the system calls because they are not in glibc yet, and
it's somewhat confusing that they share the same namespace as the
library functions. With this change, any exported io_uring_* function
is a library function.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-12-01 11:22:24 -07:00
Jens Axboe e2937e9e77 test/io_uring_setup: add support for io_uring_params->features
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-09-06 13:21:05 -06:00
Stefan Hajnoczi c31c7ec4bc src/Makefile: keep private headers in <liburing/*.h>
It is not possible to install barrier.h and compat.h into the top-level
/usr/include directly since they are likely to conflict with other
software.  io_uring.h could be confused with the system's kernel header
file.

Put liburing headers into <liburing/*.h> so there is no chance of
conflicts or confusion.

Existing applications continue to build successfully since the location
of <liburing.h> is unchanged.  In-tree examples and tests require
modification because src/liburing.h is moved to src/include/liburing.h.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-07-24 09:11:44 -06:00
Jens Axboe 10a5903db8 test/io_uring_setup: don't fail SQPOLL test case for non-root
SQPOLL requires root, if the tests are run as a user, we'll get
EPERM instead of EINVAL. Don't fail the test because of that, just
mention it in the log.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-01 16:06:59 -06:00
Shenghui Wang eb9d065415 liburing: improve output for test/io_uring_setup.c
For the IORING_SETUP_SQPOLL|IORING_SETUP_SQ_AFF test case, add_pipe is
not set, and the output is like:
"...flags: IORING_SETUP_SQPOLLIORING_SETUP_SQ_AFF...".

Set add_pipe for IORING_SETUP_SQPOLL flag so that the output is like:
"...flags: IORING_SETUP_SQPOLL|IORING_SETUP_SQ_AFF...".

Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Shenghui Wang <shhuiw@foxmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-01 10:06:02 -06:00
Jeff Moyer 765ba233c8 add syscall unit tests
Add tests for io_uring_setup, io_uring_register and io_uring_enter.
The test coverage is nowhere near complete and the reporting is not
uniform.  But, it's a start.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-03-04 15:37:40 -07:00