Commit Graph

1 Commits

Author SHA1 Message Date
David Sterba a223764093 btrfs-progs: add API for selecting tree search support and ioctl
Add wrappers around v1 and v2 of TREE_SEARCH ioctl so it can be
transparently used by code. The structures partially overlap but due to
the buffer size the v2 is offset and also needs a filler to expand the
flexible buffer.

Usage:

- define struct btrfs_tree_search_args, all zeros
- btrfs_tree_search_sk() reads offset of the search key within the
  structures
- btrfs_tree_search_ioctl() detect support and call the highest
  supported ioctl version, v2 has been supported since 3.14 but we want
  to keep backward compatibility
- btrfs_tree_search_data() read data from the buffer previously filled
  by ioctl, a sequence of (search header, data)

Signed-off-by: David Sterba <dsterba@suse.com>
2024-03-16 18:08:38 +01:00