btrfs.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * BTRFS filesystem implementation for U-Boot
  4. *
  5. * 2017 Marek Behun, CZ.NIC, marek.behun@nic.cz
  6. */
  7. #ifndef __BTRFS_BTRFS_H__
  8. #define __BTRFS_BTRFS_H__
  9. #include <linux/rbtree.h>
  10. #include "conv-funcs.h"
  11. struct btrfs_info {
  12. struct btrfs_super_block sb;
  13. struct btrfs_root tree_root;
  14. struct btrfs_root fs_root;
  15. struct btrfs_root chunk_root;
  16. struct rb_root chunks_root;
  17. };
  18. extern struct btrfs_info btrfs_info;
  19. /* dev.c */
  20. extern struct blk_desc *btrfs_blk_desc;
  21. extern struct disk_partition *btrfs_part_info;
  22. int btrfs_devread(u64, int, void *);
  23. /* chunk-map.c */
  24. u64 btrfs_map_logical_to_physical(u64);
  25. int btrfs_chunk_map_init(void);
  26. void btrfs_chunk_map_exit(void);
  27. int btrfs_read_chunk_tree(void);
  28. /* compression.c */
  29. u32 btrfs_decompress(u8 type, const char *, u32, char *, u32);
  30. /* super.c */
  31. int btrfs_read_superblock(void);
  32. /* dir-item.c */
  33. typedef int (*btrfs_readdir_callback_t)(const struct btrfs_root *,
  34. struct btrfs_dir_item *);
  35. int btrfs_lookup_dir_item(const struct btrfs_root *, u64, const char *, int,
  36. struct btrfs_dir_item *);
  37. int btrfs_readdir(const struct btrfs_root *, u64, btrfs_readdir_callback_t);
  38. /* root.c */
  39. int btrfs_find_root(u64, struct btrfs_root *, struct btrfs_root_item *);
  40. u64 btrfs_lookup_root_ref(u64, struct btrfs_root_ref *, char *);
  41. /* inode.c */
  42. u64 btrfs_lookup_inode_ref(struct btrfs_root *, u64, struct btrfs_inode_ref *,
  43. char *);
  44. int btrfs_lookup_inode(const struct btrfs_root *, struct btrfs_key *,
  45. struct btrfs_inode_item *, struct btrfs_root *);
  46. int btrfs_readlink(const struct btrfs_root *, u64, char *);
  47. u64 btrfs_lookup_path(struct btrfs_root *, u64, const char *, u8 *,
  48. struct btrfs_inode_item *, int);
  49. u64 btrfs_file_read(const struct btrfs_root *, u64, u64, u64, char *);
  50. /* subvolume.c */
  51. u64 btrfs_get_default_subvol_objectid(void);
  52. /* extent-io.c */
  53. u64 btrfs_read_extent_inline(struct btrfs_path *,
  54. struct btrfs_file_extent_item *, u64, u64,
  55. char *);
  56. u64 btrfs_read_extent_reg(struct btrfs_path *, struct btrfs_file_extent_item *,
  57. u64, u64, char *);
  58. #endif /* !__BTRFS_BTRFS_H__ */