Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] lapi/io_uring.h: Optimization io_uring_setup_supported_by_kernel()
@ 2022-09-16  1:59 Zhao Gongyi via ltp
  2022-09-16  9:36 ` Cyril Hrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Zhao Gongyi via ltp @ 2022-09-16  1:59 UTC (permalink / raw)
  To: ltp

Optimization function io_uring_setup_supported_by_kernel() when
CONFIG_IO_URING is not set.

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
 include/lapi/io_uring.h | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h
index 397324511..24e57b069 100644
--- a/include/lapi/io_uring.h
+++ b/include/lapi/io_uring.h
@@ -297,13 +297,18 @@ static inline int io_uring_enter(int fd, unsigned int to_submit,
 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)
+	ret = syscall(__NR_io_uring_setup, NULL, 0);
+	if (ret != -1) {
+		SAFE_CLOSE(ret);
+		return
+	}
+
+	if (errno == ENOSYS) {
+		if ((tst_kvercmp(5, 1, 0)) < 0) {
 			tst_brk(TCONF,
 				"Test not supported on kernel version < v5.1");
+		}
+		tst_brk(TCONF, "CONFIG_IO_URING not set?");
 	}
 }

--
2.17.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-16  9:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-16  1:59 [LTP] [PATCH] lapi/io_uring.h: Optimization io_uring_setup_supported_by_kernel() Zhao Gongyi via ltp
2022-09-16  9:36 ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox