From: Eugene Syromyatnikov Date: Wed, 21 Feb 2018 23:18:10 +0000 (+0100) Subject: btrfs: print struct btrfs_ioctl_logical_ino_args.flags field X-Git-Tag: v4.22~117 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bad2d7437c5c6fc5b6fad126a3f8ce10c84570ad;p=strace btrfs: print struct btrfs_ioctl_logical_ino_args.flags field The field has been introduced in Linux commit v4.15-rc1~135^2~17. * btrfs.c: Implement decoding of struct btrfs_ioctl_logical_ino_args.flags field. * configure.ac: Check for struct btrfs_ioctl_logical_ino_args.flags presence in linux/btrfs.h. * tests/btrfs.c: Update expected output, add additional checks. * xlat/btrfs_logical_ino_args_flags.in: New file. --- diff --git a/btrfs.c b/btrfs.c index 39487f9b..c236a05c 100644 --- a/btrfs.c +++ b/btrfs.c @@ -138,6 +138,7 @@ struct btrfs_ioctl_search_args_v2 { #include "xlat/btrfs_features_compat_ro.h" #include "xlat/btrfs_features_incompat.h" #include "xlat/btrfs_key_types.h" +#include "xlat/btrfs_logical_ino_args_flags.h" #include "xlat/btrfs_qgroup_ctl_cmds.h" #include "xlat/btrfs_qgroup_inherit_flags.h" #include "xlat/btrfs_qgroup_limit_flags.h" @@ -953,6 +954,15 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl, if (entering(tcp)) { tprintf("logical=%" PRI__u64 ", size=%" PRI__u64, args.logical, args.size); + + tprintf(", flags="); + printflags64(btrfs_logical_ino_args_flags, +#ifdef HAVE_STRUCT_BTRFS_IOCTL_LOGICAL_INO_ARGS_FLAGS + args.flags +#else + args.reserved[3] +#endif + , "BTRFS_LOGICAL_INO_ARGS_???"); tprints(", inodes="); printaddr64(args.inodes); tprints("}"); diff --git a/configure.ac b/configure.ac index e65a2875..b4c1990f 100644 --- a/configure.ac +++ b/configure.ac @@ -565,7 +565,8 @@ AC_CHECK_HEADERS([linux/btrfs.h], [ struct btrfs_ioctl_feature_flags.compat_flags, struct btrfs_ioctl_fs_info_args.nodesize, struct btrfs_ioctl_defrag_range_args.start, - struct btrfs_ioctl_search_args_v2.buf_size + struct btrfs_ioctl_search_args_v2.buf_size, + struct btrfs_ioctl_logical_ino_args.flags ]),,, [ #include #include ]) AC_CHECK_DECLS(m4_normalize([BTRFS_COMPRESS_NONE, BTRFS_COMPRESS_ZLIB, diff --git a/tests/btrfs.c b/tests/btrfs.c index d0558114..1ff5eecd 100644 --- a/tests/btrfs.c +++ b/tests/btrfs.c @@ -1163,6 +1163,14 @@ btrfs_test_ino_path_ioctls(void) .fspath = 0, }; +#ifdef HAVE_BTRFS_IOCTL_LOGICAL_INO_ARGS + args.flags = +#else + args.reserved[3] = +#endif + 0xdeadc0defacefeeeULL; + + ioctl(-1, BTRFS_IOC_INO_PATHS, NULL); printf("ioctl(-1, BTRFS_IOC_INO_PATHS, NULL) = -1 EBADF (%m)\n"); @@ -1185,13 +1193,36 @@ btrfs_test_ino_path_ioctls(void) args.fspath = 0; ioctl(-1, BTRFS_IOC_LOGICAL_INO, &args); printf("ioctl(-1, BTRFS_IOC_LOGICAL_INO, {logical=%" PRI__u64 - ", size=%" PRI__u64", inodes=NULL}) = -1 EBADF (%m)\n", + ", size=%" PRI__u64 + ", flags=0xdeadc0defacefeee /* BTRFS_LOGICAL_INO_ARGS_??? */" + ", inodes=NULL}) = -1 EBADF (%m)\n", args.inum, args.size); args.fspath = (uintptr_t) buf; +#ifdef HAVE_BTRFS_IOCTL_LOGICAL_INO_ARGS + args.flags = +#else + args.reserved[3] = +#endif + 1; + + ioctl(-1, BTRFS_IOC_LOGICAL_INO, &args); + printf("ioctl(-1, BTRFS_IOC_LOGICAL_INO, {logical=%" PRI__u64 + ", size=%" PRI__u64 + ", flags=BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET" + ", inodes=0x%" PRI__x64 "}) = -1 EBADF (%m)\n", + args.inum, args.size, args.fspath); + +#ifdef HAVE_BTRFS_IOCTL_LOGICAL_INO_ARGS + args.flags = +#else + args.reserved[3] = +#endif + 0; + ioctl(-1, BTRFS_IOC_LOGICAL_INO, &args); printf("ioctl(-1, BTRFS_IOC_LOGICAL_INO, {logical=%" PRI__u64 - ", size=%" PRI__u64", inodes=0x%" PRI__x64 + ", size=%" PRI__u64", flags=0, inodes=0x%" PRI__x64 "}) = -1 EBADF (%m)\n", args.inum, args.size, args.fspath); #ifdef HAVE_LINUX_FIEMAP_H @@ -1287,7 +1318,7 @@ btrfs_test_ino_path_ioctls(void) args.inum = fiemap->fm_extents[0].fe_physical; printf("ioctl(%d, BTRFS_IOC_LOGICAL_INO, {logical=%" PRI__u64 - ", size=%" PRI__u64", inodes=0x%" PRI__x64"}", + ", size=%" PRI__u64", flags=0, inodes=0x%" PRI__x64"}", fd, args.inum, args.size, args.fspath); ioctl(fd, BTRFS_IOC_LOGICAL_INO, &args); printf(" => {inodes={bytes_left=%u, bytes_missing=%u, elem_cnt=%u, elem_missed=%u, val=", diff --git a/xlat/btrfs_logical_ino_args_flags.in b/xlat/btrfs_logical_ino_args_flags.in new file mode 100644 index 00000000..5eea6c24 --- /dev/null +++ b/xlat/btrfs_logical_ino_args_flags.in @@ -0,0 +1 @@ +BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET (1ULL << 0)