mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-07-01 23:53:16 -04:00
btrfs: Add unprivileged ioctl which returns subvolume information
Add new unprivileged ioctl BTRFS_IOC_GET_SUBVOL_INFO which returns the information of subvolume containing this inode. (i.e. returns the information in ROOT_ITEM and ROOT_BACKREF.) Reviewed-by: Gu Jinxiang <gujx@cn.fujitsu.com> Tested-by: Gu Jinxiang <gujx@cn.fujitsu.com> Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> [ minor style fixes, update struct comments ] Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
ad7e1a740d
commit
b64ec075bd
2 changed files with 183 additions and 0 deletions
|
@ -725,6 +725,66 @@ struct btrfs_ioctl_send_args {
|
|||
__u64 reserved[4]; /* in */
|
||||
};
|
||||
|
||||
/*
|
||||
* Information about a fs tree root.
|
||||
*
|
||||
* All items are filled by the ioctl
|
||||
*/
|
||||
struct btrfs_ioctl_get_subvol_info_args {
|
||||
/* Id of this subvolume */
|
||||
__u64 treeid;
|
||||
|
||||
/* Name of this subvolume, used to get the real name at mount point */
|
||||
char name[BTRFS_VOL_NAME_MAX + 1];
|
||||
|
||||
/*
|
||||
* Id of the subvolume which contains this subvolume.
|
||||
* Zero for top-level subvolume or a deleted subvolume.
|
||||
*/
|
||||
__u64 parent_id;
|
||||
|
||||
/*
|
||||
* Inode number of the directory which contains this subvolume.
|
||||
* Zero for top-level subvolume or a deleted subvolume
|
||||
*/
|
||||
__u64 dirid;
|
||||
|
||||
/* Latest transaction id of this subvolume */
|
||||
__u64 generation;
|
||||
|
||||
/* Flags of this subvolume */
|
||||
__u64 flags;
|
||||
|
||||
/* UUID of this subvolume */
|
||||
__u8 uuid[BTRFS_UUID_SIZE];
|
||||
|
||||
/*
|
||||
* UUID of the subvolume of which this subvolume is a snapshot.
|
||||
* All zero for a non-snapshot subvolume.
|
||||
*/
|
||||
__u8 parent_uuid[BTRFS_UUID_SIZE];
|
||||
|
||||
/*
|
||||
* UUID of the subvolume from which this subvolume was received.
|
||||
* All zero for non-received subvolume.
|
||||
*/
|
||||
__u8 received_uuid[BTRFS_UUID_SIZE];
|
||||
|
||||
/* Transaction id indicating when change/create/send/receive happened */
|
||||
__u64 ctransid;
|
||||
__u64 otransid;
|
||||
__u64 stransid;
|
||||
__u64 rtransid;
|
||||
/* Time corresponding to c/o/s/rtransid */
|
||||
struct btrfs_ioctl_timespec ctime;
|
||||
struct btrfs_ioctl_timespec otime;
|
||||
struct btrfs_ioctl_timespec stime;
|
||||
struct btrfs_ioctl_timespec rtime;
|
||||
|
||||
/* Must be zero */
|
||||
__u64 reserved[8];
|
||||
};
|
||||
|
||||
/* Error codes as returned by the kernel */
|
||||
enum btrfs_err_code {
|
||||
BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET = 1,
|
||||
|
@ -843,5 +903,7 @@ enum btrfs_err_code {
|
|||
struct btrfs_ioctl_vol_args_v2)
|
||||
#define BTRFS_IOC_LOGICAL_INO_V2 _IOWR(BTRFS_IOCTL_MAGIC, 59, \
|
||||
struct btrfs_ioctl_logical_ino_args)
|
||||
#define BTRFS_IOC_GET_SUBVOL_INFO _IOR(BTRFS_IOCTL_MAGIC, 60, \
|
||||
struct btrfs_ioctl_get_subvol_info_args)
|
||||
|
||||
#endif /* _UAPI_LINUX_BTRFS_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue