syscalls/statx04: TCONF on BTRFS for kernel < 4.13
PATCH 1/1 syscalls/statx04: TCONF on BTRFS for kernel < 4.13
BTRFS support for statx flags was added in 4.13:04a87e347282 ("Btrfs: add statx support")
Signed-off-by Petr Vorel <[email protected]>
--- testcases/kernel/syscalls/statx/statx04.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
testcases/kernel/syscalls/statx/statx04.c +12 -0
@@ -32,6 +32,7 @@#define MOUNT_POINT "mntpoint"#define TESTDIR_FLAGGED MOUNT_POINT"/test_dir1"#define TESTDIR_UNFLAGGED MOUNT_POINT"/test_dir2" +#define BTRFS_STATX_SUPPORT "4.13.0"static int fd, clear_flags;
@@ -152,6 +153,17 @@ static void setup(void)SAFE_MKDIR (TESTDIR_FLAGGED ,0777 );SAFE_MKDIR (TESTDIR_UNFLAGGED ,0777 ); +if (!strcmp (tst_device->fs_type,"btrfs" )) { +int v1, v2, v3; +if (tst_parse_kver (BTRFS_STATX_SUPPORT , &v1, &v2, &v3)) +tst_res (TWARN , +"Invalid kernel version %s, expected %%d.%%d.%%d" , +BTRFS_STATX_SUPPORT ); +if (tst_kvercmp (v1, v2, v3) <0 ) +tst_brk (TCONF ,"BTRFS supports statx from kernel %s " , +BTRFS_STATX_SUPPORT ); + } +caid_flags_setup (); }
Signature · 1 line
2.19.0
PATCH 1/1 syscalls/statx04: TCONF on BTRFS for kernel < 4.13
Hi!
Quoted 15 lines
testcases/kernel/syscalls/statx/statx04.c +1
-0@@ -32,6 +32,7 @@#define MOUNT_POINT "mntpoint"#define TESTDIR_FLAGGED MOUNT_POINT"/test_dir1"#define TESTDIR_UNFLAGGED MOUNT_POINT"/test_dir2" +#define BTRFS_STATX_SUPPORT "4.13.0"static int fd, clear_flags;@@ -152,6 +153,17 @@ static void setup(void)SAFE_MKDIR (TESTDIR_FLAGGED ,0777 );SAFE_MKDIR (TESTDIR_UNFLAGGED ,0777 );
testcases/kernel/syscalls/statx/statx04.c static void setup(void) · line 164
Quoted 10 lines
testcases/kernel/syscalls/statx/statx04.c +9
-0+if (!strcmp (tst_device->fs_type,"btrfs" )) { +int v1, v2, v3; +if (tst_parse_kver (BTRFS_STATX_SUPPORT , &v1, &v2, &v3)) +tst_res (TWARN , +"Invalid kernel version %s, expected %%d.%%d.%%d" , +BTRFS_STATX_SUPPORT ); +if (tst_kvercmp (v1, v2, v3) <0 ) +tst_brk (TCONF ,"BTRFS supports statx from kernel %s " , +BTRFS_STATX_SUPPORT );
Why not just:
if (!strcmp(tst_device->fs_type, "btrfs") && tst_kvercmp(4, 13, 0) < 0) tst_brk(TCONF, "Btrfs statx() supported since 4.13");
There is no point in parsing a statically defined string that will never change with tst_parse_kver().
Quoted 8 lines
testcases/kernel/syscalls/statx/statx04.c +2
-0+ } +caid_flags_setup (); }Signature · 1 line
2.19.0
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 syscalls/statx04: TCONF on BTRFS for kernel < 4.13
Hi Cyril,
Quoted 8 lines
Why not just:
if (!strcmp(tst_device->fs_type, "btrfs") && tst_kvercmp(4, 13, 0) < 0) tst_brk(TCONF, "Btrfs statx() supported since 4.13");There is no point in parsing a statically defined string that will never change with
tst_parse_kver().
Sure, make sense.
Thanks for pointing out silly code.
Pushed with your reviewed-by tag.
Kind regards,
Petr