render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame 0004-BTRFS_V2_IOCTLS.patch

05f42e
From: Roberto Campesato <render@metalabs.org>
05f42e
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
05f42e
--- a/linux-user/ioctls.h
05f42e
+++ b/linux-user/ioctls.h
05f42e
@@ -154,6 +154,10 @@
05f42e
      IOCTL(BTRFS_IOC_SNAP_CREATE, IOC_W,
05f42e
            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
05f42e
 #endif
05f42e
+#ifdef BTRFS_IOC_SNAP_CREATE_V2
05f42e
+     IOCTL(BTRFS_IOC_SNAP_CREATE_V2, IOC_W,
05f42e
+           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args_v2)))
05f42e
+#endif
05f42e
 #ifdef BTRFS_IOC_SCAN_DEV
05f42e
      IOCTL(BTRFS_IOC_SCAN_DEV, IOC_W,
05f42e
            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
05f42e
@@ -170,14 +174,26 @@
05f42e
      IOCTL(BTRFS_IOC_RM_DEV, IOC_W,
05f42e
            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
05f42e
 #endif
05f42e
+#ifdef BTRFS_IOC_RM_DEV_V2
05f42e
+     IOCTL(BTRFS_IOC_RM_DEV_V2, IOC_W,
05f42e
+           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args_v2)))
05f42e
+#endif
05f42e
 #ifdef BTRFS_IOC_SUBVOL_CREATE
05f42e
      IOCTL(BTRFS_IOC_SUBVOL_CREATE, IOC_W,
05f42e
            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
05f42e
 #endif
05f42e
+#ifdef BTRFS_IOC_SUBVOL_CREATE_V2
05f42e
+     IOCTL(BTRFS_IOC_SUBVOL_CREATE_V2, IOC_W,
05f42e
+           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args_v2)))
05f42e
+#endif
05f42e
 #ifdef BTRFS_IOC_SNAP_DESTROY
05f42e
      IOCTL(BTRFS_IOC_SNAP_DESTROY, IOC_W,
05f42e
            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
05f42e
 #endif
05f42e
+#ifdef BTRFS_IOC_SNAP_DESTROY_V2
05f42e
+     IOCTL(BTRFS_IOC_SNAP_DESTROY_V2, IOC_W,
05f42e
+           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args_v2)))
05f42e
+#endif
05f42e
 #ifdef BTRFS_IOC_INO_LOOKUP
05f42e
      IOCTL(BTRFS_IOC_INO_LOOKUP, IOC_RW,
05f42e
            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_lookup_args)))
05f42e
@@ -273,6 +289,10 @@
05f42e
      IOCTL(BTRFS_IOC_INO_LOOKUP_USER, IOC_RW,
05f42e
            MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_lookup_user_args)))
05f42e
 #endif
05f42e
+#ifdef BTRFS_IOC_TREE_SEARCH
05f42e
+     IOCTL(BTRFS_IOC_TREE_SEARCH, IOC_RW,
05f42e
+           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_search_args)))
05f42e
+#endif
05f42e
05f42e
 #ifdef CONFIG_USBFS
05f42e
   /* USB ioctls */
05f42e
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
05f42e
--- a/linux-user/syscall_defs.h
05f42e
+++ b/linux-user/syscall_defs.h
05f42e
@@ -966,9 +966,12 @@
05f42e
 #define TARGET_BTRFS_IOC_RM_DEV                 TARGET_IOWU(BTRFS_IOCTL_MAGIC, 11)
05f42e
 #define TARGET_BTRFS_IOC_SUBVOL_CREATE          TARGET_IOWU(BTRFS_IOCTL_MAGIC, 14)
05f42e
 #define TARGET_BTRFS_IOC_SNAP_DESTROY           TARGET_IOWU(BTRFS_IOCTL_MAGIC, 15)
05f42e
+#define TARGET_BTRFS_IOC_TREE_SEARCH            TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 17)
05f42e
 #define TARGET_BTRFS_IOC_INO_LOOKUP             TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 18)
05f42e
 #define TARGET_BTRFS_IOC_DEFAULT_SUBVOL         TARGET_IOW(BTRFS_IOCTL_MAGIC, 19, \
05f42e
                                                            abi_ullong)
05f42e
+#define TARGET_BTRFS_IOC_SNAP_CREATE_V2         TARGET_IOWU(BTRFS_IOCTL_MAGIC, 23)
05f42e
+#define TARGET_BTRFS_IOC_SUBVOL_CREATE_V2       TARGET_IOWU(BTRFS_IOCTL_MAGIC, 24)
05f42e
 #define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS        TARGET_IOR(BTRFS_IOCTL_MAGIC, 25, \
05f42e
                                                            abi_ullong)
05f42e
 #define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS        TARGET_IOW(BTRFS_IOCTL_MAGIC, 26, \
05f42e
@@ -990,10 +993,12 @@
05f42e
 #define TARGET_BTRFS_IOC_GET_FEATURES           TARGET_IORU(BTRFS_IOCTL_MAGIC, 57)
05f42e
 #define TARGET_BTRFS_IOC_SET_FEATURES           TARGET_IOWU(BTRFS_IOCTL_MAGIC, 57)
05f42e
 #define TARGET_BTRFS_IOC_GET_SUPPORTED_FEATURES TARGET_IORU(BTRFS_IOCTL_MAGIC, 57)
05f42e
+#define TARGET_BTRFS_IOC_RM_DEV_V2              TARGET_IOWU(BTRFS_IOCTL_MAGIC, 58)
05f42e
 #define TARGET_BTRFS_IOC_LOGICAL_INO_V2         TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 59)
05f42e
 #define TARGET_BTRFS_IOC_GET_SUBVOL_INFO        TARGET_IORU(BTRFS_IOCTL_MAGIC, 60)
05f42e
 #define TARGET_BTRFS_IOC_GET_SUBVOL_ROOTREF     TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 61)
05f42e
 #define TARGET_BTRFS_IOC_INO_LOOKUP_USER        TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 62)
05f42e
+#define TARGET_BTRFS_IOC_SNAP_DESTROY_V2        TARGET_IOWU(BTRFS_IOCTL_MAGIC, 63)
05f42e
 #endif
05f42e
05f42e
 /* usb ioctls */
05f42e
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
05f42e
--- a/linux-user/syscall_types.h
05f42e
+++ b/linux-user/syscall_types.h
05f42e
@@ -373,6 +373,37 @@
05f42e
        MK_ARRAY(TYPE_CHAR, BTRFS_PATH_NAME_MAX + 1)) /* name */
05f42e
 #endif
05f42e
05f42e
+#if defined(BTRFS_IOC_SNAP_CREATE_V2) || \
05f42e
+    defined(BTRFS_IOC_SUBVOL_CREATE_V2) || \
05f42e
+    defined(BTRFS_IOC_RM_DEV_V2) || defined(BTRFS_IOC_SNAP_DESTROY_V2)
05f42e
+STRUCT(btrfs_ioctl_vol_args_v2,
05f42e
+       TYPE_LONGLONG, /* fd */
05f42e
+       TYPE_ULONGLONG, /* transid */
05f42e
+       TYPE_ULONGLONG, /* flags */
05f42e
+       MK_ARRAY(TYPE_ULONGLONG, 4), /* unused */
05f42e
+       MK_ARRAY(TYPE_CHAR, BTRFS_SUBVOL_NAME_MAX + 1)) /* name */
05f42e
+#endif
05f42e
+
05f42e
+#ifdef BTRFS_IOC_TREE_SEARCH
05f42e
+STRUCT(btrfs_ioctl_search_args,
05f42e
+       TYPE_ULONGLONG, /* tree_id */
05f42e
+       TYPE_ULONGLONG, /* min_objectid */
05f42e
+       TYPE_ULONGLONG, /* max_objectid */
05f42e
+       TYPE_ULONGLONG, /* min_offset */
05f42e
+       TYPE_ULONGLONG, /* max_offset */
05f42e
+       TYPE_ULONGLONG, /* min_transid */
05f42e
+       TYPE_ULONGLONG, /* max_transid */
05f42e
+       TYPE_INT,       /* min_type */
05f42e
+       TYPE_INT,       /* max_type */
05f42e
+       TYPE_INT,       /* nr_items */
05f42e
+       TYPE_INT,       /* unused */
05f42e
+       TYPE_ULONGLONG, /* unused1 */
05f42e
+       TYPE_ULONGLONG, /* unused2 */
05f42e
+       TYPE_ULONGLONG, /* unused3 */
05f42e
+       TYPE_ULONGLONG, /* unused4 */
05f42e
+       MK_ARRAY(TYPE_CHAR, BTRFS_SEARCH_ARGS_BUFSIZE)) /* buf */
05f42e
+#endif
05f42e
+
05f42e
 #ifdef BTRFS_IOC_GET_SUBVOL_INFO
05f42e
 STRUCT(btrfs_ioctl_timespec,
05f42e
        TYPE_ULONGLONG, /* sec */