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

Martin Doucha mdoucha@suse.cz
Thu Nov 30 17:11:46 CET 2023


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



More information about the ltp mailing list