summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Syromyatnikov <evgsyr@gmail.com>2018-02-22 00:18:10 +0100
committerDmitry V. Levin <ldv@altlinux.org>2018-03-06 23:52:08 +0000
commitbad2d7437c5c6fc5b6fad126a3f8ce10c84570ad (patch)
tree9571bfbcf66242b4dd953f886f1ea72ab8944c7c
parent1ed1866ebdd16aa8c585237fef9212f77a5bfb4a (diff)
downloadstrace-bad2d7437c5c6fc5b6fad126a3f8ce10c84570ad.tar.gz
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.
-rw-r--r--btrfs.c10
-rw-r--r--configure.ac3
-rw-r--r--tests/btrfs.c37
-rw-r--r--xlat/btrfs_logical_ino_args_flags.in1
4 files changed, 47 insertions, 4 deletions
diff --git a/btrfs.c b/btrfs.c
index 39487f9b7..c236a05c5 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 e65a28757..b4c1990f7 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 <stdio.h>
#include <linux/btrfs.h>])
AC_CHECK_DECLS(m4_normalize([BTRFS_COMPRESS_NONE, BTRFS_COMPRESS_ZLIB,
diff --git a/tests/btrfs.c b/tests/btrfs.c
index d0558114d..1ff5eecda 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 000000000..5eea6c240
--- /dev/null
+++ b/xlat/btrfs_logical_ino_args_flags.in
@@ -0,0 +1 @@
+BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET (1ULL << 0)