btrfs.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. extern struct btrfs_fs_info *current_fs_info;
  20. /* dev.c */
  21. extern struct blk_desc *btrfs_blk_desc;
  22. extern struct disk_partition *btrfs_part_info;
  23. int btrfs_devread(u64, int, void *);
  24. /* chunk-map.c */
  25. u64 btrfs_map_logical_to_physical(u64);
  26. int btrfs_chunk_map_init(void);
  27. void btrfs_chunk_map_exit(void);
  28. int __btrfs_read_chunk_tree(void);
  29. /* compression.c */
  30. u32 btrfs_decompress(u8 type, const char *, u32, char *, u32);
  31. /* super.c */
  32. int btrfs_read_superblock(void);
  33. /* dir-item.c */
  34. typedef int (*btrfs_readdir_callback_t)(const struct __btrfs_root *,
  35. struct btrfs_dir_item *);
  36. int btrfs_lookup_dir_item(const struct __btrfs_root *, u64, const char *, int,
  37. struct btrfs_dir_item *);
  38. int btrfs_readdir(const struct __btrfs_root *, u64, btrfs_readdir_callback_t);
  39. /* root.c */
  40. int btrfs_find_root(u64, struct __btrfs_root *, struct btrfs_root_item *);
  41. u64 btrfs_lookup_root_ref(u64, struct btrfs_root_ref *, char *);
  42. /* inode.c */
  43. u64 btrfs_lookup_inode_ref(struct __btrfs_root *, u64, struct btrfs_inode_ref *,
  44. char *);
  45. int btrfs_lookup_inode(const struct __btrfs_root *, struct btrfs_key *,
  46. struct btrfs_inode_item *, struct __btrfs_root *);
  47. int btrfs_readlink(const struct __btrfs_root *, u64, char *);
  48. u64 btrfs_lookup_path(struct __btrfs_root *, u64, const char *, u8 *,
  49. struct btrfs_inode_item *, int);
  50. u64 btrfs_file_read(const struct __btrfs_root *, u64, u64, u64, char *);
  51. /* subvolume.c */
  52. u64 btrfs_get_default_subvol_objectid(void);
  53. /* extent-io.c */
  54. u64 btrfs_read_extent_inline(struct __btrfs_path *,
  55. struct btrfs_file_extent_item *, u64, u64,
  56. char *);
  57. u64 btrfs_read_extent_reg(struct __btrfs_path *, struct btrfs_file_extent_item *,
  58. u64, u64, char *);
  59. #endif /* !__BTRFS_BTRFS_H__ */