diff mbox series

[v1] io_uring02.c: Check EOPNOTSUPP errno

Message ID 20230120061247.8361-1-wegao@suse.com
State Accepted
Headers show
Series [v1] io_uring02.c: Check EOPNOTSUPP errno | expand

Commit Message

Wei Gao Jan. 20, 2023, 6:12 a.m. UTC
Add check for errno == EOPNOTSUPP and quit with TCONF instead of TBROK

Signed-off-by: Wei Gao <wegao@suse.com>
---
 lib/tst_safe_io_uring.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Petr Vorel Jan. 20, 2023, 7:46 a.m. UTC | #1
Hi Wei,

> Add check for errno == EOPNOTSUPP and quit with TCONF instead of TBROK

> Signed-off-by: Wei Gao <wegao@suse.com>
> ---
>  lib/tst_safe_io_uring.c | 4 ++++
>  1 file changed, 4 insertions(+)

> diff --git a/lib/tst_safe_io_uring.c b/lib/tst_safe_io_uring.c
> index f300fd38c..923c3e43d 100644
> --- a/lib/tst_safe_io_uring.c
> +++ b/lib/tst_safe_io_uring.c
> @@ -15,6 +15,10 @@ int safe_io_uring_init(const char *file, const int lineno,
>  	uring->fd = io_uring_setup(entries, params);

>  	if (uring->fd == -1) {
> +		if (errno == EOPNOTSUPP) {
> +			tst_brk(TCONF,
> +				"io_uring_setup() is not supported");
> +		}

I merged with these changes:

		if (errno == EOPNOTSUPP)
			tst_brk(TCONF, "CONFIG_IO_URING is not enabled");

* changed subject to: "tst_safe_io_uring.c: Check EOPNOTSUPP errno"
* Adjusted commit message (no io_uring_*() syscall will be working due
  CONFIG_IO_URING not enabled in the kernel).
* simplify if style

Thanks!

Kind regards,
Petr
Wei Gao Jan. 20, 2023, 7:48 a.m. UTC | #2
Hi Petr

Thanks a lot!

Regards
Gao Wei

-----Original Message-----
From: Petr Vorel <pvorel@suse.cz> 
Sent: 20 January 2023 15:47
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1] io_uring02.c: Check EOPNOTSUPP errno

Hi Wei,

> Add check for errno == EOPNOTSUPP and quit with TCONF instead of TBROK

> Signed-off-by: Wei Gao <wegao@suse.com>
> ---
>  lib/tst_safe_io_uring.c | 4 ++++
>  1 file changed, 4 insertions(+)

> diff --git a/lib/tst_safe_io_uring.c b/lib/tst_safe_io_uring.c index 
> f300fd38c..923c3e43d 100644
> --- a/lib/tst_safe_io_uring.c
> +++ b/lib/tst_safe_io_uring.c
> @@ -15,6 +15,10 @@ int safe_io_uring_init(const char *file, const int lineno,
>  	uring->fd = io_uring_setup(entries, params);

>  	if (uring->fd == -1) {
> +		if (errno == EOPNOTSUPP) {
> +			tst_brk(TCONF,
> +				"io_uring_setup() is not supported");
> +		}

I merged with these changes:

		if (errno == EOPNOTSUPP)
			tst_brk(TCONF, "CONFIG_IO_URING is not enabled");

* changed subject to: "tst_safe_io_uring.c: Check EOPNOTSUPP errno"
* Adjusted commit message (no io_uring_*() syscall will be working due
  CONFIG_IO_URING not enabled in the kernel).
* simplify if style

Thanks!

Kind regards,
Petr
diff mbox series

Patch

diff --git a/lib/tst_safe_io_uring.c b/lib/tst_safe_io_uring.c
index f300fd38c..923c3e43d 100644
--- a/lib/tst_safe_io_uring.c
+++ b/lib/tst_safe_io_uring.c
@@ -15,6 +15,10 @@  int safe_io_uring_init(const char *file, const int lineno,
 	uring->fd = io_uring_setup(entries, params);
 
 	if (uring->fd == -1) {
+		if (errno == EOPNOTSUPP) {
+			tst_brk(TCONF,
+				"io_uring_setup() is not supported");
+		}
 		tst_brk_(file, lineno, TBROK | TERRNO,
 			"io_uring_setup() failed");
 		return uring->fd;