From: Eugene Syromyatnikov Date: Wed, 21 Feb 2018 22:20:46 +0000 (+0100) Subject: btrfs.c: print __u64 fields with pointer semantics using printaddr64 X-Git-Tag: v4.22~118 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ed1866ebdd16aa8c585237fef9212f77a5bfb4a;p=strace btrfs.c: print __u64 fields with pointer semantics using printaddr64 * btrfs.c (btrfs_ioctl) : Print fspath field with printaddr64. (btrfs_ioctl) : Print inodes field with printaddr64. * tests/btrfs.c: Add checks for NULL in fspath and inodes fields. * NEWS: Mention it. --- diff --git a/NEWS b/NEWS index ced14e09..002af107 100644 --- 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 3016ec84..39487f9b 100644 --- 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; } diff --git a/tests/btrfs.c b/tests/btrfs.c index 337795f6..d0558114 100644 --- a/tests/btrfs.c +++ b/tests/btrfs.c @@ -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