[LTP] [PATCH 2/2] io_uring.h: Remove io_uring_setup_supported_by_kernel()

Cyril Hrubis chrubis@suse.cz
Thu Sep 15 12:01:18 CEST 2022


Hi!
> -static inline void io_uring_setup_supported_by_kernel(void)
> -{
> -	long ret;
> -	if ((tst_kvercmp(5, 1, 0)) < 0) {
> -		ret = syscall(__NR_io_uring_setup, NULL, 0);
> -		if (ret != -1)
> -			SAFE_CLOSE(ret);
> -		else if (errno == ENOSYS)
> -			tst_brk(TCONF,
> -				"Test not supported on kernel version < v5.1");
> -	}
> -}

I guess I see the problem now, with the CONFIG_IO_URING not set this
will fail to detect that io_uring() is not supported. So the easiest
solution here would be:

diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h
index 397324511..43d28f74a 100644
--- a/include/lapi/io_uring.h
+++ b/include/lapi/io_uring.h
@@ -297,14 +297,22 @@ static inline int io_uring_enter(int fd, unsigned int to_submit,
 static inline void io_uring_setup_supported_by_kernel(void)
 {
        long ret;
+
+       ret = syscall(__NR_io_uring_setup, NULL, 0);
+
+       if (ret != -1) {
+               SAFE_CLOSE(ret);
+               return;
+       }
+
        if ((tst_kvercmp(5, 1, 0)) < 0) {
-               ret = syscall(__NR_io_uring_setup, NULL, 0);
-               if (ret != -1)
-                       SAFE_CLOSE(ret);
-               else if (errno == ENOSYS)
+               if (errno == ENOSYS)
                        tst_brk(TCONF,
                                "Test not supported on kernel version < v5.1");
        }
+
+       if (errno == ENOSYS)
+               tst_brk(TCONF, "CONFIG_IO_URING not set?");
 }


-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list