btrfs: provide fallback definitions for BTRFS_IOC_QUOTA_RESCAN*
<linux/btrfs.h> was introduced in linux v3.9-rc1 while some
of btrfs ioctls were added later, e.g. BTRFS_IOC_QUOTA_RESCAN
and BTRFS_IOC_QUOTA_RESCAN_STATUS in v3.10-rc2,
or BTRFS_IOC_QUOTA_RESCAN_WAIT in v3.11-rc1.
* btrfs.c [!BTRFS_IOC_QUOTA_RESCAN]
(struct btrfs_ioctl_quota_rescan_args): New structure.
(BTRFS_IOC_QUOTA_RESCAN, BTRFS_IOC_QUOTA_RESCAN_STATUS): New macros.
[!BTRFS_IOC_QUOTA_RESCAN_WAIT] (BTRFS_IOC_QUOTA_RESCAN_WAIT): New macro.
* tests/btrfs.c: Likewise.
Reported-by: Li Er <phoooyb@gmail.com>
diff --git a/btrfs.c b/btrfs.c
index 04c71fc..f94565b 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -83,6 +83,20 @@
# define BTRFS_FIRST_FREE_OBJECTID 256ULL
#endif
+#ifndef BTRFS_IOC_QUOTA_RESCAN
+struct btrfs_ioctl_quota_rescan_args {
+ uint64_t flags, progress, reserved[6];
+};
+# define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \
+ struct btrfs_ioctl_quota_rescan_args)
+# define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \
+ struct btrfs_ioctl_quota_rescan_args)
+#endif
+
+#ifndef BTRFS_IOC_QUOTA_RESCAN_WAIT
+# define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46)
+#endif
+
#ifndef BTRFS_IOC_GET_FEATURES
# define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
struct btrfs_ioctl_feature_flags)
@@ -1024,7 +1038,7 @@
if (umove_or_printaddr(tcp, arg, &args))
break;
- tprintf("{flags=%" PRI__u64 "}", args.flags);
+ tprintf("{flags=%" PRIu64 "}", (uint64_t) args.flags);
break;
}
@@ -1038,7 +1052,7 @@
if (umove_or_printaddr(tcp, arg, &args))
break;
- tprintf("{flags=%" PRI__u64 ", progress=", args.flags);
+ tprintf("{flags=%" PRIu64 ", progress=", (uint64_t) args.flags);
btrfs_print_objectid(args.progress);
tprints("}");
break;