]> granicus.if.org Git - strace/commitdiff
btrfs.c: print __u64 fields with pointer semantics using printaddr64
authorEugene Syromyatnikov <evgsyr@gmail.com>
Wed, 21 Feb 2018 22:20:46 +0000 (23:20 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 6 Mar 2018 23:52:08 +0000 (23:52 +0000)
* btrfs.c (btrfs_ioctl) <case BTRFS_IOC_INO_PATHS>: Print fspath field
with printaddr64.
(btrfs_ioctl) <case BTRFS_IOC_LOGICAL_INO>: Print inodes field with
printaddr64.
* tests/btrfs.c: Add checks for NULL in fspath and inodes fields.
* NEWS: Mention it.

NEWS
btrfs.c
tests/btrfs.c

diff --git a/NEWS b/NEWS
index ced14e09606063dbaf1cbd1278a75c639f943633..002af1072f2921ecd8282866ebae97ef99787fa7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ Noteworthy changes in release ?.?? (????-??-??)
   * IPv6 addresses shown in socket information in -yy mode are now printed
     in brackets.
   * Enhanced decoding of prctl and ptrace syscalls.
+  * Enhanced decoding of BTRFS_IOC_INO_PATHS and BTRFS_IOC_LOGICAL_INO ioctl
+    commands.
   * Enhanced NETLINK_ROUTE protocol decoding.
   * Updated lists of signal codes.
   * Updated lists of BPF_*, BTN_*, ETH_P_*, INET_DIAG_BC_*, KEY_*, POLL*, RWF_*,
diff --git a/btrfs.c b/btrfs.c
index 3016ec843c67646859122690f33b72dd03d55ba5..39487f9b760aee0c3a6f208e8da6b9ede32fb7e9 100644 (file)
--- a/btrfs.c
+++ b/btrfs.c
@@ -922,7 +922,9 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
                if (entering(tcp)) {
                        tprintf("inum=%" PRI__u64 ", size=%" PRI__u64,
                                args.inum, args.size);
-                       tprintf(", fspath=0x%" PRI__x64 "}", args.fspath);
+                       tprints(", fspath=");
+                       printaddr64(args.fspath);
+                       tprints("}");
                        return 0;
                }
 
@@ -951,7 +953,9 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
                if (entering(tcp)) {
                        tprintf("logical=%" PRI__u64 ", size=%" PRI__u64,
                                args.logical, args.size);
-                       tprintf(", inodes=0x%" PRI__x64 "}", args.inodes);
+                       tprints(", inodes=");
+                       printaddr64(args.inodes);
+                       tprints("}");
                        return 0;
                }
 
index 337795f6cd0fd3bdddf0ec80c61976346aaaa16d..d0558114d60b093e0ee96989fdb28ff6c2ee8a6c 100644 (file)
@@ -1160,7 +1160,7 @@ btrfs_test_ino_path_ioctls(void)
        struct btrfs_ioctl_ino_path_args args = {
                .inum = 256,
                .size = sizeof(buf),
-               .fspath = (unsigned long)buf,
+               .fspath = 0,
        };
 
        ioctl(-1, BTRFS_IOC_INO_PATHS, NULL);
@@ -1169,12 +1169,26 @@ btrfs_test_ino_path_ioctls(void)
        ioctl(-1, BTRFS_IOC_LOGICAL_INO, NULL);
        printf("ioctl(-1, BTRFS_IOC_LOGICAL_INO, NULL) = -1 EBADF (%m)\n");
 
+       ioctl(-1, BTRFS_IOC_INO_PATHS, &args);
+       printf("ioctl(-1, BTRFS_IOC_INO_PATHS, "
+              "{inum=%" PRI__u64", size=%" PRI__u64
+              ", fspath=NULL}) = -1 EBADF (%m)\n",
+              args.inum, args.size);
+
+       args.fspath = (uintptr_t) buf;
        ioctl(-1, BTRFS_IOC_INO_PATHS, &args);
        printf("ioctl(-1, BTRFS_IOC_INO_PATHS, "
               "{inum=%" PRI__u64", size=%" PRI__u64
               ", fspath=0x%" PRI__x64 "}) = -1 EBADF (%m)\n",
               args.inum, args.size, args.fspath);
 
+       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",
+              args.inum, args.size);
+
+       args.fspath = (uintptr_t) buf;
        ioctl(-1, BTRFS_IOC_LOGICAL_INO, &args);
        printf("ioctl(-1, BTRFS_IOC_LOGICAL_INO, {logical=%" PRI__u64
               ", size=%" PRI__u64", inodes=0x%" PRI__x64