]> granicus.if.org Git - strace/commitdiff
btrfs: print struct btrfs_ioctl_logical_ino_args.flags field
authorEugene Syromyatnikov <evgsyr@gmail.com>
Wed, 21 Feb 2018 23:18:10 +0000 (00:18 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 6 Mar 2018 23:52:08 +0000 (23:52 +0000)
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.

btrfs.c
configure.ac
tests/btrfs.c
xlat/btrfs_logical_ino_args_flags.in [new file with mode: 0644]

diff --git a/btrfs.c b/btrfs.c
index 39487f9b760aee0c3a6f208e8da6b9ede32fb7e9..c236a05c5ee546acf35a8c84dee5139ce3e76c00 100644 (file)
--- 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("}");
index e65a28757040d394749c4af9b0fa09ad78939581..b4c1990f7a48ebeb1bd01e96b945cd25df903bbb 100644 (file)
@@ -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 <stdio.h>
 #include <linux/btrfs.h>])
        AC_CHECK_DECLS(m4_normalize([BTRFS_COMPRESS_NONE, BTRFS_COMPRESS_ZLIB,
index d0558114d60b093e0ee96989fdb28ff6c2ee8a6c..1ff5eecda9ff40f458f00c55e62af1cf3c9ea3f3 100644 (file)
@@ -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 (file)
index 0000000..5eea6c2
--- /dev/null
@@ -0,0 +1 @@
+BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET   (1ULL << 0)