From dad89b7acac630e892b27678d1572a7a21d1a3a3 Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Sat, 18 Mar 2023 08:07:50 +0800 Subject: [PATCH] btrfs-progs: sync DEV_INFO ioctl from kernel Add fsid to DEV_INFO structure introduced in kernel 6.3 by 2943868a909f ("btrfs: ioctl: return device fsid from DEV_INFO ioctl"). Reviewed-by: Anand Jain Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- include/ioctl.h | 12 +++++++++++- libbtrfsutil/btrfs.h | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/include/ioctl.h b/include/ioctl.h index 1af16db1..cbcc0672 100644 --- a/include/ioctl.h +++ b/include/ioctl.h @@ -214,7 +214,17 @@ struct btrfs_ioctl_dev_info_args { __u8 uuid[BTRFS_UUID_SIZE]; /* in/out */ __u64 bytes_used; /* out */ __u64 total_bytes; /* out */ - __u64 unused[379]; /* pad to 4k */ + /* + * Optional, out. + * + * Showing the fsid of the device, allowing user space to check if this + * device is a seed one. + * + * Introduced in v6.3, thus user space still needs to check if kernel + * changed this value. Older kernel will not touch the values here. + */ + __u8 fsid[BTRFS_UUID_SIZE]; + __u64 unused[377]; /* pad to 4k */ __u8 path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */ }; BUILD_ASSERT(sizeof(struct btrfs_ioctl_dev_info_args) == 4096); diff --git a/libbtrfsutil/btrfs.h b/libbtrfsutil/btrfs.h index 0d863d58..d997cb2c 100644 --- a/libbtrfsutil/btrfs.h +++ b/libbtrfsutil/btrfs.h @@ -224,7 +224,17 @@ struct btrfs_ioctl_dev_info_args { __u8 uuid[BTRFS_UUID_SIZE]; /* in/out */ __u64 bytes_used; /* out */ __u64 total_bytes; /* out */ - __u64 unused[379]; /* pad to 4k */ + /* + * Optional, out. + * + * Showing the fsid of the device, allowing user space to check if this + * device is a seed one. + * + * Introduced in v6.3, thus user space still needs to check if kernel + * changed this value. Older kernel will not touch the values here. + */ + __u8 fsid[BTRFS_UUID_SIZE]; + __u64 unused[377]; /* pad to 4k */ __u8 path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */ };