summary refs log tree commit diff stats
path: root/linux-user/syscall_types.h
diff options
context:
space:
mode:
authorFilip Bozuta <Filip.Bozuta@syrmia.com>2020-08-23 21:50:12 +0200
committerLaurent Vivier <laurent@vivier.eu>2020-09-03 01:09:35 +0200
commit784c08c8c4c069c8d7136ef39ef37b5ab33da97c (patch)
tree9489962e815d12ed039582289e3ca9d4bcfaddbb /linux-user/syscall_types.h
parent0ff496a05f296fcb413a3b42dc5b238a3380dfb7 (diff)
downloadfocaccia-qemu-784c08c8c4c069c8d7136ef39ef37b5ab33da97c.tar.gz
focaccia-qemu-784c08c8c4c069c8d7136ef39ef37b5ab33da97c.zip
linux-user: Add support for two btrfs ioctls used for subvolume
This patch implements functionality for following ioctl:

BTRFS_IOC_DEFAULT_SUBVOL - Setting a default subvolume

    Set a default subvolume for a btrfs filesystem. The third
    ioctl's argument is a '__u64' (unsigned long long) which
    represents the id of a subvolume that is to be set as
    the default.

BTRFS_IOC_GET_SUBVOL_ROOTREF - Getting tree and directory id of subvolumes

    Read tree and directory id of subvolumes from a btrfs
    filesystem. The tree and directory id's are returned in the
    ioctl's third argument which represents a pointer to a
    following type:

    struct btrfs_ioctl_get_subvol_rootref_args {
		/* in/out, minimum id of rootref's treeid to be searched */
		__u64 min_treeid;

		/* out */
		struct {
			__u64 treeid;
			__u64 dirid;
		} rootref[BTRFS_MAX_ROOTREF_BUFFER_NUM];

		/* out, number of found items */
		__u8 num_items;
		__u8 align[7];
     };

     Before calling this ioctl, 'min_treeid' field should be filled
     with value that represent the minimum value for the tree id.

Implementation notes:

    Ioctl BTRFS_IOC_GET_SUBVOL_ROOTREF uses the above mentioned structure
    type as third argument. That is the reason why a aproppriate thunk
    structure definition is added in file 'syscall_types.h'.

Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200823195014.116226-7-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/syscall_types.h')
-rw-r--r--linux-user/syscall_types.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index dab2c16bca..73e36620ce 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -435,6 +435,19 @@ STRUCT(btrfs_ioctl_dev_info_args,
        MK_ARRAY(TYPE_CHAR, BTRFS_DEVICE_PATH_NAME_MAX)) /* path */
 #endif
 
+#ifdef BTRFS_IOC_GET_SUBVOL_ROOTREF
+STRUCT(rootref,
+       TYPE_ULONGLONG, /* treeid */
+       TYPE_ULONGLONG) /* dirid */
+
+STRUCT(btrfs_ioctl_get_subvol_rootref_args,
+       TYPE_ULONGLONG, /* min_treeid */
+       MK_ARRAY(MK_STRUCT(STRUCT_rootref),
+                BTRFS_MAX_ROOTREF_BUFFER_NUM), /* rootref */
+       TYPE_CHAR, /* num_items */
+       MK_ARRAY(TYPE_CHAR, 7)) /* align */
+#endif
+
 #ifdef BTRFS_IOC_GET_DEV_STATS
 STRUCT(btrfs_ioctl_get_dev_stats,
        TYPE_ULONGLONG, /* devid */