btrfs-progs: show-super: Add option to print superblock at given bytenr
[platform/upstream/btrfs-progs.git] / ioctl.h
diff --git a/ioctl.h b/ioctl.h
index df7933e..dff015a 100644 (file)
--- a/ioctl.h
+++ b/ioctl.h
 #ifndef __BTRFS_IOCTL_H__
 #define __BTRFS_IOCTL_H__
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <asm/types.h>
 #include <linux/ioctl.h>
-#include <time.h>
 
-#ifdef __cplusplus
-extern "C" {
+#ifndef __user
+#define __user
 #endif
 
 #define BTRFS_IOCTL_MAGIC 0x94
@@ -77,7 +80,7 @@ struct btrfs_ioctl_vol_args_v2 {
        union {
                struct {
                        __u64 size;
-                       struct btrfs_qgroup_inherit *qgroup_inherit;
+                       struct btrfs_qgroup_inherit __user *qgroup_inherit;
                };
                __u64 unused[4];
        };
@@ -189,7 +192,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 */
@@ -328,6 +341,31 @@ struct btrfs_ioctl_clone_range_args {
 #define BTRFS_DEFRAG_RANGE_COMPRESS 1
 #define BTRFS_DEFRAG_RANGE_START_IO 2
 
+#define BTRFS_SAME_DATA_DIFFERS        1
+/* For extent-same ioctl */
+struct btrfs_ioctl_same_extent_info {
+       __s64 fd;               /* in - destination file */
+       __u64 logical_offset;   /* in - start of extent in destination */
+       __u64 bytes_deduped;    /* out - total # of bytes we were able
+                                * to dedupe from this file */
+       /* status of this dedupe operation:
+        * 0 if dedup succeeds
+        * < 0 for error
+        * == BTRFS_SAME_DATA_DIFFERS if data differs
+        */
+       __s32 status;           /* out - see above description */
+       __u32 reserved;
+};
+
+struct btrfs_ioctl_same_args {
+       __u64 logical_offset;   /* in - start of extent in source */
+       __u64 length;           /* in - length of extent */
+       __u16 dest_count;       /* in - total elements in info array */
+       __u16 reserved1;
+       __u32 reserved2;
+       struct btrfs_ioctl_same_extent_info info[0];
+};
+
 struct btrfs_ioctl_defrag_range_args {
        /* start of the defrag operation */
        __u64 start;
@@ -488,16 +526,20 @@ struct btrfs_ioctl_received_subvol_args {
  */
 #define BTRFS_SEND_FLAG_OMIT_END_CMD           0x4
 
+#define BTRFS_SEND_FLAG_MASK \
+       (BTRFS_SEND_FLAG_NO_FILE_DATA | \
+        BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | \
+        BTRFS_SEND_FLAG_OMIT_END_CMD)
+
 struct btrfs_ioctl_send_args {
        __s64 send_fd;                  /* in */
        __u64 clone_sources_count;      /* in */
-       __u64 *clone_sources;           /* in */
+       __u64 __user *clone_sources;    /* in */
        __u64 parent_root;              /* in */
        __u64 flags;                    /* in */
        __u64 reserved[4];              /* in */
 };
 
-
 /* Error codes as returned by the kernel */
 enum btrfs_err_code {
        notused,
@@ -633,6 +675,8 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
                                      struct btrfs_ioctl_get_dev_stats)
 #define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \
                                    struct btrfs_ioctl_dev_replace_args)
+#define BTRFS_IOC_FILE_EXTENT_SAME _IOWR(BTRFS_IOCTL_MAGIC, 54, \
+                                        struct btrfs_ioctl_same_args)
 #define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
                                   struct btrfs_ioctl_feature_flags)
 #define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \