From: Laurent Vivier <laurent@vivier.eu>
To: Filip Bozuta <Filip.Bozuta@syrmia.com>, qemu-devel@nongnu.org
Cc: riku.voipio@iki.fi
Subject: Re: [PATCH v2 1/4] linux-user: Add support for a group of btrfs inode ioctls
Date: Wed, 29 Jul 2020 18:18:19 +0200 [thread overview]
Message-ID: <86b2596c-2afa-a4a3-ad5e-2d030727b542@vivier.eu> (raw)
In-Reply-To: <20200717144435.268166-2-Filip.Bozuta@syrmia.com>
Le 17/07/2020 à 16:44, Filip Bozuta a écrit :
> This patch implements functionality of following ioctls:
>
> BTRFS_IOC_INO_LOOKUP - Reading tree root id and path
>
> Read tree root id and path for a given file or directory.
> The name and tree root id are returned in an ioctl's third
> argument that represents a pointer to a following type:
>
> struct btrfs_ioctl_ino_lookup_args {
> __u64 treeid;
> __u64 objectid;
> char name[BTRFS_INO_LOOKUP_PATH_MAX];
> };
>
> Before calling this ioctl, field 'objectid' should be filled
> with the object id value for which the tree id and path are
> to be read. Value 'BTRFS_FIRST_FREE_OBJECTID' represents the
> object id for the first available btrfs object (directory or
> file).
>
> BTRFS_IOC_INO_PATHS - Reading paths to all files
>
> Read path to all files with a certain inode number. The paths
> are returned in the ioctl's third argument which represents
> a pointer to a following type:
>
> struct btrfs_ioctl_ino_path_args {
> __u64 inum; /* in */
> __u64 size; /* in */
> __u64 reserved[4];
> /* struct btrfs_data_container *fspath; out */
> __u64 fspath; /* out */
> };
>
> Before calling this ioctl, the 'inum' and 'size' field should
> be filled with the aproppriate inode number and size of the
> directory where file paths should be looked for. For now, the
> paths are returned in an '__u64' (unsigned long long) value
> 'fspath'.
>
> BTRFS_IOC_LOGICAL_INO - Reading inode numbers
>
> Read inode numbers for files on a certain logical adress. The
> inode numbers are returned in the ioctl's third argument which
> represents a pointer to a following type:
>
> struct btrfs_ioctl_logical_ino_args {
> __u64 logical; /* in */
> __u64 size; /* in */
> __u64 reserved[3]; /* must be 0 for now */
> __u64 flags; /* in, v2 only */
> /* struct btrfs_data_container *inodes; out */
> __u64 inodes;
> };
>
> Before calling this ioctl, the 'logical' and 'size' field should
> be filled with the aproppriate logical adress and size of where
> the inode numbers of files should be looked for. For now, the
> inode numbers are returned in an '__u64' (unsigned long long)
> value 'inodes'.
>
> BTRFS_IOC_LOGICAL_INO_V2 - Reading inode numbers
>
> Same as the above mentioned ioctl except that it allows passing
> a flags 'BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET'.
>
> BTRFS_IOC_INO_LOOKUP_USER - Reading subvolume name and path
>
> Read name and path of a subvolume. The tree root id and
> path are read in an ioctl's third argument which represents a
> pointer to a following type:
>
> struct btrfs_ioctl_ino_lookup_user_args {
> /* in, inode number containing the subvolume of 'subvolid' */
> __u64 dirid;
> /* in */
> __u64 treeid;
> /* out, name of the subvolume of 'treeid' */
> char name[BTRFS_VOL_NAME_MAX + 1];
> /*
> * out, constructed path from the directory with which the ioctl is
> * called to dirid
> */
> char path[BTRFS_INO_LOOKUP_USER_PATH_MAX];
> };
>
> Before calling this ioctl, the 'dirid' and 'treeid' field should
> be filled with aproppriate values which represent the inode number
> of the directory that contains the subvolume and treeid of the
> subvolume.
>
> Implementation notes:
>
> All of the ioctls in this patch use structure types as third arguments.
> That is the reason why aproppriate thunk definitions were added in file
> 'syscall_types.h'.
>
> Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
> ---
> linux-user/ioctls.h | 20 ++++++++++++++++++++
> linux-user/syscall_defs.h | 10 ++++++++++
> linux-user/syscall_types.h | 24 ++++++++++++++++++++++++
> 3 files changed, 54 insertions(+)
>
...
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 9db6f46cba..7bb105428b 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -982,12 +982,18 @@ struct target_rtc_pll_info {
> 14, struct btrfs_ioctl_vol_args)
> #define TARGET_BTRFS_IOC_SNAP_DESTROY TARGET_IOW(BTRFS_IOCTL_MAGIC, \
> 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_SUBVOL_GETFLAGS TARGET_IOR(BTRFS_IOCTL_MAGIC, \
> 25, abi_ullong)
> #define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS TARGET_IOW(BTRFS_IOCTL_MAGIC, \
> 26, abi_ullong)
> #define TARGET_BTRFS_IOC_DEV_INFO TARGET_IOWR(BTRFS_IOCTL_MAGIC,\
> 30, struct btrfs_ioctl_dev_info_args)
> +#define TARGET_BTRFS_IOC_INO_PATHS TARGET_IOWR(BTRFS_IOCTL_MAGIC,\
> + 35, struct btrfs_ioctl_ino_path_args)
> +#define TARGET_BTRFS_IOC_LOGICAL_INO TARGET_IOWR(BTRFS_IOCTL_MAGIC,\
> + 36, struct btrfs_ioctl_logical_ino_args)
> #define TARGET_BTRFS_IOC_GET_DEV_STATS TARGET_IOWR(BTRFS_IOCTL_MAGIC,\
> 52, struct btrfs_ioctl_get_dev_stats)
> #define TARGET_BTRFS_IOC_GET_FEATURES TARGET_IOR(BTRFS_IOCTL_MAGIC, \
> @@ -996,8 +1002,12 @@ struct target_rtc_pll_info {
> 57, struct btrfs_ioctl_feature_flags[2])
> #define TARGET_BTRFS_IOC_GET_SUPPORTED_FEATURES TARGET_IOR(BTRFS_IOCTL_MAGIC, \
> 57, struct btrfs_ioctl_feature_flags[3])
> +#define TARGET_BTRFS_IOC_LOGICAL_INO_V2 TARGET_IOWR(BTRFS_IOCTL_MAGIC,\
> + 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_INO_LOOKUP_USER TARGET_IOWR(BTRFS_IOCTL_MAGIC,\
> + 62, struct btrfs_ioctl_ino_lookup_user_args)
Use the 'U' variant.
>
> /* usb ioctls */
> #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
> diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
> index e26ab01e8f..980c29000a 100644
> --- a/linux-user/syscall_types.h
> +++ b/linux-user/syscall_types.h
> @@ -349,6 +349,30 @@ STRUCT(btrfs_ioctl_get_subvol_info_args,
> MK_STRUCT(STRUCT_btrfs_ioctl_timespec), /* rtime */
> MK_ARRAY(TYPE_ULONGLONG, 8)) /* reserved */
>
> +STRUCT(btrfs_ioctl_ino_lookup_args,
> + TYPE_ULONGLONG, /* treeid */
> + TYPE_ULONGLONG, /* objectid */
> + MK_ARRAY(TYPE_CHAR, BTRFS_INO_LOOKUP_PATH_MAX)) /* name */
> +
> +STRUCT(btrfs_ioctl_ino_path_args,
> + TYPE_ULONGLONG, /* inum */
> + TYPE_ULONGLONG, /* size */
> + TYPE_ULONGLONG, /* reserved */
This is reserved[4], use MK_ARRAY() here
> + TYPE_ULONGLONG) /* fspath */
> +
> +STRUCT(btrfs_ioctl_logical_ino_args,
> + TYPE_ULONGLONG, /* logical */
> + TYPE_ULONGLONG, /* size */
> + TYPE_ULONGLONG, /* reserved */
reserved[3]
> + TYPE_ULONGLONG, /* flags */
> + TYPE_ULONGLONG) /* inodes */
> +
> +STRUCT(btrfs_ioctl_ino_lookup_user_args,
> + TYPE_ULONGLONG, /* dirid */
> + TYPE_ULONGLONG, /* treeid */
> + MK_ARRAY(TYPE_CHAR, BTRFS_VOL_NAME_MAX + 1), /* name */
> + MK_ARRAY(TYPE_CHAR, BTRFS_INO_LOOKUP_USER_PATH_MAX)) /* path */
> +
> STRUCT(btrfs_ioctl_dev_info_args,
> TYPE_ULONGLONG, /* devid */
> MK_ARRAY(TYPE_CHAR, BTRFS_UUID_SIZE), /* uuid */
>
Thanks,
Laurent
next prev parent reply other threads:[~2020-07-29 16:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-17 14:44 [PATCH v2 0/4] Add support for a group of btrfs ioctls - 2 Filip Bozuta
2020-07-17 14:44 ` [PATCH v2 1/4] linux-user: Add support for a group of btrfs inode ioctls Filip Bozuta
2020-07-29 16:18 ` Laurent Vivier [this message]
2020-07-17 14:44 ` [PATCH v2 2/4] linux-user: Add support for two btrfs ioctls used for subvolume Filip Bozuta
2020-07-29 16:22 ` Laurent Vivier
2020-07-17 14:44 ` [PATCH v2 3/4] linux-user: Add support for btrfs ioctls used to manage quota Filip Bozuta
2020-07-29 16:30 ` Laurent Vivier
2020-07-17 14:44 ` [PATCH v2 4/4] linux-user: Add support for btrfs ioctls used to scrub a filesystem Filip Bozuta
2020-07-29 16:37 ` Laurent Vivier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86b2596c-2afa-a4a3-ad5e-2d030727b542@vivier.eu \
--to=laurent@vivier.eu \
--cc=Filip.Bozuta@syrmia.com \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).