ioctl_loop06: Check for unsupported LOOP_SET_BLOCK_SIZE ioctl
PATCH 1/1 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.
--- testcases/kernel/syscalls/ioctl/ioctl_loop06.c | 2 ++ 1 file changed, 2 insertions(+)
testcases/kernel/syscalls/ioctl/ioctl_loop06.c +2 -0
@@ -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" ); }
Signature · 5 lines
2.42.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
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 <[email protected]> On Behalf Of Martin Doucha
Sent: Friday, December 1, 2023 12:12 AM
To: [email protected]
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.
--- testcases/kernel/syscalls/ioctl/ioctl_loop06.c | 2 ++ 1 file changed, 2 insertions(+)
testcases/kernel/syscalls/ioctl/ioctl_loop06.c +2 -1
@@ -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
Signature · 4 lines
Mailing list info: https://lists.linux.it/listinfo/ltp -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 5 lines · Yang Xu (Fujitsu)
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?
Hmm, yes, I've missed that there's a TCONF check for LOOP_SET_BLOCK_SIZE in setup() already. Extending that would be better. I'll send v2 shortly.
Signature · 11 lines
Martin Doucha [email protected] SW Quality Engineer SUSE LINUX, s.r.o. CORSO IIa Krizikova 148/34 186 00 Prague 8 Czech Republic -- Mailing list info: https://lists.linux.it/listinfo/ltp