btrfs-progs: stop using btrfs_root_item_v0

This isn't defined in the kernel, we simply check if the root item size
is less than btrfs_root_item, so adjust the user of btrfs_root_item_v0
to make a similar check.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2022-11-23 17:37:21 -05:00 committed by David Sterba
parent 5fc1d0cd64
commit d729048be6

View file

@ -870,8 +870,8 @@ static int list_subvol_search(int fd, struct rb_root *root_lookup)
ri = (struct btrfs_root_item *)(args.buf + off); ri = (struct btrfs_root_item *)(args.buf + off);
gen = btrfs_root_generation(ri); gen = btrfs_root_generation(ri);
flags = btrfs_root_flags(ri); flags = btrfs_root_flags(ri);
if(sh.len > if(sh.len <
sizeof(struct btrfs_root_item_v0)) { sizeof(struct btrfs_root_item)) {
otime = btrfs_stack_timespec_sec(&ri->otime); otime = btrfs_stack_timespec_sec(&ri->otime);
ogen = btrfs_root_otransid(ri); ogen = btrfs_root_otransid(ri);
memcpy(uuid, ri->uuid, BTRFS_UUID_SIZE); memcpy(uuid, ri->uuid, BTRFS_UUID_SIZE);