btrfs.c: print __u64 fields with pointer semantics using printaddr64

* 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.
This commit is contained in:
Eugene Syromyatnikov 2018-02-21 23:20:46 +01:00 committed by Dmitry V. Levin
parent 84c03b20b4
commit 1ed1866ebd
3 changed files with 23 additions and 3 deletions

2
NEWS
View File

@ -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_*,

View File

@ -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;
}

View 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