btrfs-progs: check: introduce traversal function for fsck
[platform/upstream/btrfs-progs.git] / ioctl.h
diff --git a/ioctl.h b/ioctl.h
index 0ef0602..620dd3d 100644 (file)
--- a/ioctl.h
+++ b/ioctl.h
 #ifndef __BTRFS_IOCTL_H__
 #define __BTRFS_IOCTL_H__
 
-#include <asm/types.h>
-#include <linux/ioctl.h>
-#include <time.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#include <asm/types.h>
+#include <linux/ioctl.h>
+
 #ifndef __user
 #define __user
 #endif
@@ -46,6 +45,14 @@ struct btrfs_ioctl_vol_args {
 #define BTRFS_SUBVOL_CREATE_ASYNC      (1ULL << 0)
 #define BTRFS_SUBVOL_RDONLY            (1ULL << 1)
 #define BTRFS_SUBVOL_QGROUP_INHERIT    (1ULL << 2)
+#define BTRFS_DEVICE_SPEC_BY_ID                (1ULL << 3)
+
+#define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED               \
+                       (BTRFS_SUBVOL_CREATE_ASYNC |    \
+                       BTRFS_SUBVOL_RDONLY |           \
+                       BTRFS_SUBVOL_QGROUP_INHERIT |   \
+                       BTRFS_DEVICE_SPEC_BY_ID)
+
 #define BTRFS_FSID_SIZE 16
 #define BTRFS_UUID_SIZE 16
 
@@ -85,7 +92,10 @@ struct btrfs_ioctl_vol_args_v2 {
                };
                __u64 unused[4];
        };
-       char name[BTRFS_SUBVOL_NAME_MAX + 1];
+       union {
+               char name[BTRFS_SUBVOL_NAME_MAX + 1];
+               __u64 devid;
+       };
 };
 
 /*
@@ -99,7 +109,7 @@ struct btrfs_scrub_progress {
        __u64 tree_bytes_scrubbed;      /* # of tree bytes scrubbed */
        __u64 read_errors;              /* # of read errors encountered (EIO) */
        __u64 csum_errors;              /* # of failed csum checks */
-       __u64 verify_errors;            /* # of occurences, where the metadata
+       __u64 verify_errors;            /* # of occurrences, where the metadata
                                         * of a tree block did not match the
                                         * expected values, like generation or
                                         * logical */
@@ -119,7 +129,7 @@ struct btrfs_scrub_progress {
        __u64 last_physical;            /* last physical address scrubbed. In
                                         * case a scrub was aborted, this can
                                         * be used to restart the scrub */
-       __u64 unverified_errors;        /* # of occurences where a read for a
+       __u64 unverified_errors;        /* # of occurrences where a read for a
                                         * full (64k) bio failed, but the re-
                                         * check succeeded for each 4k piece.
                                         * Intermittent error. */
@@ -193,7 +203,17 @@ struct btrfs_ioctl_fs_info_args {
        __u64 max_id;                           /* out */
        __u64 num_devices;                      /* out */
        __u8 fsid[BTRFS_FSID_SIZE];             /* out */
-       __u64 reserved[124];                    /* pad to 1k */
+       __u32 nodesize;                         /* out */
+       __u32 sectorsize;                       /* out */
+       __u32 clone_alignment;                  /* out */
+       __u32 reserved32;
+       __u64 reserved[122];                    /* pad to 1k */
+};
+
+struct btrfs_ioctl_feature_flags {
+       __u64 compat_flags;
+       __u64 compat_ro_flags;
+       __u64 incompat_flags;
 };
 
 /* balance control ioctl modes */
@@ -207,7 +227,20 @@ struct btrfs_ioctl_fs_info_args {
  */
 struct btrfs_balance_args {
        __u64 profiles;
-       __u64 usage;
+
+       /*
+        * usage filter
+        * BTRFS_BALANCE_ARGS_USAGE with a single value means '0..N'
+        * BTRFS_BALANCE_ARGS_USAGE_RANGE - range syntax, min..max
+        */
+       union {
+               __u64 usage;
+               struct {
+                       __u32 usage_min;
+                       __u32 usage_max;
+               };
+       };
+
        __u64 devid;
        __u64 pstart;
        __u64 pend;
@@ -218,14 +251,27 @@ struct btrfs_balance_args {
 
        __u64 flags;
 
-       __u64 limit;            /* limit number of processed chunks */
-       __u64 unused[7];
+       /*
+        * BTRFS_BALANCE_ARGS_LIMIT with value 'limit'
+        * BTRFS_BALANCE_ARGS_LIMIT_RANGE - the extend version can use minimum
+        * and maximum
+        */
+       union {
+               __u64 limit;            /* limit number of processed chunks */
+               struct {
+                       __u32 limit_min;
+                       __u32 limit_max;
+               };
+       };
+       __u32 stripes_min;
+       __u32 stripes_max;
+       __u64 unused[6];
 } __attribute__ ((__packed__));
 
 /* report balance progress to userspace */
 struct btrfs_balance_progress {
        __u64 expected;         /* estimated # of chunks that will be
-                                * relocated to fulfill the request */
+                                * relocated to fulfil the request */
        __u64 considered;       /* # of chunks we have considered so far */
        __u64 completed;        /* # of chunks relocated so far */
 };
@@ -639,7 +685,7 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
 #define BTRFS_IOC_INO_PATHS _IOWR(BTRFS_IOCTL_MAGIC, 35, \
                                        struct btrfs_ioctl_ino_path_args)
 #define BTRFS_IOC_LOGICAL_INO _IOWR(BTRFS_IOCTL_MAGIC, 36, \
-                                       struct btrfs_ioctl_ino_path_args)
+                                       struct btrfs_ioctl_logical_ino_args)
 #define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, \
                                struct btrfs_ioctl_received_subvol_args)
 #define BTRFS_IOC_SEND _IOW(BTRFS_IOCTL_MAGIC, 38, struct btrfs_ioctl_send_args)
@@ -674,6 +720,8 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
                                   struct btrfs_ioctl_feature_flags[2])
 #define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
                                   struct btrfs_ioctl_feature_flags[3])
+#define BTRFS_IOC_RM_DEV_V2    _IOW(BTRFS_IOCTL_MAGIC, 58, \
+                                  struct btrfs_ioctl_vol_args_v2)
 #ifdef __cplusplus
 }
 #endif