Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Marek Behún | 21a14fa | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 2 | /* |
| 3 | * BTRFS filesystem implementation for U-Boot |
| 4 | * |
| 5 | * 2017 Marek Behun, CZ.NIC, marek.behun@nic.cz |
Marek Behún | 21a14fa | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef __BTRFS_BTRFS_H__ |
| 9 | #define __BTRFS_BTRFS_H__ |
| 10 | |
| 11 | #include <linux/rbtree.h> |
| 12 | #include "conv-funcs.h" |
| 13 | |
| 14 | struct btrfs_info { |
| 15 | struct btrfs_super_block sb; |
Marek Behún | 21a14fa | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 16 | |
| 17 | struct btrfs_root tree_root; |
| 18 | struct btrfs_root fs_root; |
| 19 | struct btrfs_root chunk_root; |
| 20 | |
| 21 | struct rb_root chunks_root; |
| 22 | }; |
| 23 | |
| 24 | extern struct btrfs_info btrfs_info; |
| 25 | |
| 26 | /* hash.c */ |
| 27 | void btrfs_hash_init(void); |
| 28 | u32 btrfs_crc32c(u32, const void *, size_t); |
| 29 | u32 btrfs_csum_data(char *, u32, size_t); |
| 30 | void btrfs_csum_final(u32, void *); |
| 31 | |
| 32 | static inline u64 btrfs_name_hash(const char *name, int len) |
| 33 | { |
| 34 | return btrfs_crc32c((u32) ~1, name, len); |
| 35 | } |
| 36 | |
| 37 | /* dev.c */ |
| 38 | extern struct blk_desc *btrfs_blk_desc; |
Simon Glass | 0528979 | 2020-05-10 11:39:57 -0600 | [diff] [blame] | 39 | extern struct disk_partition *btrfs_part_info; |
Marek Behún | 21a14fa | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 40 | |
| 41 | int btrfs_devread(u64, int, void *); |
| 42 | |
| 43 | /* chunk-map.c */ |
| 44 | u64 btrfs_map_logical_to_physical(u64); |
| 45 | int btrfs_chunk_map_init(void); |
| 46 | void btrfs_chunk_map_exit(void); |
| 47 | int btrfs_read_chunk_tree(void); |
| 48 | |
| 49 | /* compression.c */ |
| 50 | u32 btrfs_decompress(u8 type, const char *, u32, char *, u32); |
| 51 | |
| 52 | /* super.c */ |
| 53 | int btrfs_read_superblock(void); |
| 54 | |
| 55 | /* dir-item.c */ |
| 56 | typedef int (*btrfs_readdir_callback_t)(const struct btrfs_root *, |
| 57 | struct btrfs_dir_item *); |
| 58 | |
| 59 | int btrfs_lookup_dir_item(const struct btrfs_root *, u64, const char *, int, |
| 60 | struct btrfs_dir_item *); |
| 61 | int btrfs_readdir(const struct btrfs_root *, u64, btrfs_readdir_callback_t); |
| 62 | |
| 63 | /* root.c */ |
| 64 | int btrfs_find_root(u64, struct btrfs_root *, struct btrfs_root_item *); |
| 65 | u64 btrfs_lookup_root_ref(u64, struct btrfs_root_ref *, char *); |
| 66 | |
| 67 | /* inode.c */ |
| 68 | u64 btrfs_lookup_inode_ref(struct btrfs_root *, u64, struct btrfs_inode_ref *, |
| 69 | char *); |
| 70 | int btrfs_lookup_inode(const struct btrfs_root *, struct btrfs_key *, |
| 71 | struct btrfs_inode_item *, struct btrfs_root *); |
| 72 | int btrfs_readlink(const struct btrfs_root *, u64, char *); |
| 73 | u64 btrfs_lookup_path(struct btrfs_root *, u64, const char *, u8 *, |
| 74 | struct btrfs_inode_item *, int); |
| 75 | u64 btrfs_file_read(const struct btrfs_root *, u64, u64, u64, char *); |
| 76 | |
| 77 | /* subvolume.c */ |
| 78 | u64 btrfs_get_default_subvol_objectid(void); |
| 79 | |
| 80 | /* extent-io.c */ |
| 81 | u64 btrfs_read_extent_inline(struct btrfs_path *, |
| 82 | struct btrfs_file_extent_item *, u64, u64, |
| 83 | char *); |
| 84 | u64 btrfs_read_extent_reg(struct btrfs_path *, struct btrfs_file_extent_item *, |
| 85 | u64, u64, char *); |
| 86 | |
| 87 | #endif /* !__BTRFS_BTRFS_H__ */ |