[LTP] [PATCH] ioctl_loop06: Check for unsupported LOOP_SET_BLOCK_SIZE ioctl

Yang Xu (Fujitsu) xuyang2018.jy@fujitsu.com
Fri Dec 1 02:57:20 CET 2023


Hi Martin

I guess commit message can add more clear information ie old kernel 4.x.

Also, why not add this check in setup() since we have did it in there?


Best Regards
Yang Xu 

-----Original Message-----
From: ltp <ltp-bounces+xuyang2018.jy=fujitsu.com@lists.linux.it> On Behalf Of Martin Doucha
Sent: Friday, December 1, 2023 12:12 AM
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] ioctl_loop06: Check for unsupported LOOP_SET_BLOCK_SIZE ioctl

Loop device ioctl() returns EINVAL error if the command is not supported. However, in compat mode, it'll return ENOTTY error instead.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/kernel/syscalls/ioctl/ioctl_loop06.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop06.c b/testcases/kernel/syscalls/ioctl/ioctl_loop06.c
index 6d009af6a..a0119bc7a 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_loop06.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_loop06.c
@@ -63,6 +63,8 @@ static void verify_ioctl_loop(unsigned int n)
 	}
 	if (TST_ERR == EINVAL)
 		tst_res(TPASS | TTERRNO, "Set block size failed as expected");
+	else if (TST_ERR == ENOTTY)
+		tst_res(TCONF | TTERRNO, "LOOP_SET_BLOCK_SIZE not supported");
 	else
 		tst_res(TFAIL | TTERRNO, "Set block size failed expected EINVAL got");  }
--
2.42.1


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


More information about the ltp mailing list