qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/4] linux-user: Add support for two btrfs ioctls used for


From: Laurent Vivier
Subject: Re: [PATCH v2 2/4] linux-user: Add support for two btrfs ioctls used for subvolume
Date: Wed, 29 Jul 2020 18:22:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Le 17/07/2020 à 16:44, Filip Bozuta a écrit :
> 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>
> ---
>  linux-user/ioctls.h        |  7 +++++++
>  linux-user/syscall_defs.h  |  4 ++++
>  linux-user/syscall_types.h | 11 +++++++++++
>  3 files changed, 22 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index a7f5664487..2c553103e6 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -206,6 +206,9 @@
>       IOCTL(BTRFS_IOC_INO_LOOKUP, IOC_RW,
>             MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_lookup_args)))
>  #endif
> +#ifdef BTRFS_IOC_DEFAULT_SUBVOL
> +     IOCTL(BTRFS_IOC_DEFAULT_SUBVOL, IOC_W, MK_PTR(TYPE_ULONGLONG))
> +#endif
>  #ifdef BTRFS_IOC_SUBVOL_GETFLAGS
>       IOCTL(BTRFS_IOC_SUBVOL_GETFLAGS, IOC_R, MK_PTR(TYPE_ULONGLONG))
>  #endif
> @@ -248,6 +251,10 @@
>       IOCTL(BTRFS_IOC_GET_SUBVOL_INFO, IOC_R,
>             MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_get_subvol_info_args)))
>  #endif
> +#ifdef BTRFS_IOC_GET_SUBVOL_ROOTREF
> +     IOCTL(BTRFS_IOC_GET_SUBVOL_ROOTREF, IOC_RW,
> +           MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_get_subvol_rootref_args)))
> +#endif
>  #ifdef BTRFS_IOC_INO_LOOKUP_USER
>       IOCTL(BTRFS_IOC_INO_LOOKUP_USER, IOC_RW,
>             MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_ino_lookup_user_args)))
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 7bb105428b..f4b4fc4a20 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -984,6 +984,8 @@ struct target_rtc_pll_info {
>                                                 15, struct 
> btrfs_ioctl_vol_args)
>  #define TARGET_BTRFS_IOC_INO_LOOKUP             
> TARGET_IOWR(BTRFS_IOCTL_MAGIC,\
>                                          18, struct 
> btrfs_ioctl_ino_lookup_args)
> +#define TARGET_BTRFS_IOC_DEFAULT_SUBVOL         
> TARGET_IOW(BTRFS_IOCTL_MAGIC, \
> +                                                           19, abi_ullong)
>  #define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS        
> TARGET_IOR(BTRFS_IOCTL_MAGIC, \
>                                                             25, abi_ullong)
>  #define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS        
> TARGET_IOW(BTRFS_IOCTL_MAGIC, \
> @@ -1006,6 +1008,8 @@ struct target_rtc_pll_info {
>                                         59, struct 
> btrfs_ioctl_logical_ino_args)
>  #define TARGET_BTRFS_IOC_GET_SUBVOL_INFO        
> TARGET_IOR(BTRFS_IOCTL_MAGIC, \
>                                     60, struct 
> btrfs_ioctl_get_subvol_info_args)
> +#define TARGET_BTRFS_IOC_GET_SUBVOL_ROOTREF     
> TARGET_IOWR(BTRFS_IOCTL_MAGIC,\
> +                                61, struct 
> btrfs_ioctl_get_subvol_rootref_args)

This one needs TARGET_IOWRU(), the first one can be kept as it uses
abi_ullong.

with that changed:

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

Thanks,
Laurent




reply via email to

[Prev in Thread] Current Thread [Next in Thread]