[LTP] [PATCH 1/1] syscalls/statx04: TCONF on BTRFS for kernel < 4.13
Cyril Hrubis
chrubis@suse.cz
Mon Oct 8 13:54:11 CEST 2018
Hi!
> diff --git a/testcases/kernel/syscalls/statx/statx04.c b/testcases/kernel/syscalls/statx/statx04.c
> index 8caf092db..2e1dc8569 100644
> --- a/testcases/kernel/syscalls/statx/statx04.c
> +++ b/testcases/kernel/syscalls/statx/statx04.c
> @@ -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);
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().
> + }
> +
> caid_flags_setup();
> }
>
> --
> 2.19.0
>
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list