Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Marek Behún | 2938754 | 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 | 2938754 | 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 | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 16 | |
Qu Wenruo | f6d5af7 | 2020-06-24 18:02:57 +0200 | [diff] [blame] | 17 | struct __btrfs_root tree_root; |
| 18 | struct __btrfs_root fs_root; |
| 19 | struct __btrfs_root chunk_root; |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 20 | |
| 21 | struct rb_root chunks_root; |
| 22 | }; |
| 23 | |
| 24 | extern struct btrfs_info btrfs_info; |
Qu Wenruo | 1d5a7b7 | 2020-06-24 18:03:01 +0200 | [diff] [blame] | 25 | extern struct btrfs_fs_info *current_fs_info; |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 26 | |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 27 | /* dev.c */ |
| 28 | extern struct blk_desc *btrfs_blk_desc; |
Simon Glass | c1c4a8f | 2020-05-10 11:39:57 -0600 | [diff] [blame] | 29 | extern struct disk_partition *btrfs_part_info; |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 30 | |
| 31 | int btrfs_devread(u64, int, void *); |
| 32 | |
| 33 | /* chunk-map.c */ |
| 34 | u64 btrfs_map_logical_to_physical(u64); |
| 35 | int btrfs_chunk_map_init(void); |
| 36 | void btrfs_chunk_map_exit(void); |
Qu Wenruo | 8f267cf | 2020-06-24 18:03:00 +0200 | [diff] [blame] | 37 | int __btrfs_read_chunk_tree(void); |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 38 | |
| 39 | /* compression.c */ |
| 40 | u32 btrfs_decompress(u8 type, const char *, u32, char *, u32); |
| 41 | |
| 42 | /* super.c */ |
| 43 | int btrfs_read_superblock(void); |
| 44 | |
| 45 | /* dir-item.c */ |
Qu Wenruo | dca22af | 2020-06-24 18:03:02 +0200 | [diff] [blame] | 46 | int __btrfs_lookup_dir_item(const struct __btrfs_root *, u64, const char *, int, |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 47 | struct btrfs_dir_item *); |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 48 | /* root.c */ |
Qu Wenruo | f6d5af7 | 2020-06-24 18:02:57 +0200 | [diff] [blame] | 49 | int btrfs_find_root(u64, struct __btrfs_root *, struct btrfs_root_item *); |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 50 | u64 btrfs_lookup_root_ref(u64, struct btrfs_root_ref *, char *); |
| 51 | |
| 52 | /* inode.c */ |
Qu Wenruo | dca22af | 2020-06-24 18:03:02 +0200 | [diff] [blame] | 53 | u64 __btrfs_lookup_inode_ref(struct __btrfs_root *, u64, struct btrfs_inode_ref *, |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 54 | char *); |
Qu Wenruo | dca22af | 2020-06-24 18:03:02 +0200 | [diff] [blame] | 55 | int __btrfs_lookup_inode(const struct __btrfs_root *, struct btrfs_key *, |
Qu Wenruo | f6d5af7 | 2020-06-24 18:02:57 +0200 | [diff] [blame] | 56 | struct btrfs_inode_item *, struct __btrfs_root *); |
Qu Wenruo | dca22af | 2020-06-24 18:03:02 +0200 | [diff] [blame] | 57 | int __btrfs_readlink(const struct __btrfs_root *, u64, char *); |
Qu Wenruo | 49fe0f0 | 2020-06-24 18:03:03 +0200 | [diff] [blame] | 58 | int btrfs_readlink(struct btrfs_root *root, u64 ino, char *target); |
Qu Wenruo | dca22af | 2020-06-24 18:03:02 +0200 | [diff] [blame] | 59 | u64 __btrfs_lookup_path(struct __btrfs_root *, u64, const char *, u8 *, |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 60 | struct btrfs_inode_item *, int); |
Qu Wenruo | 6aa2cc4 | 2020-06-24 18:03:08 +0200 | [diff] [blame] | 61 | u64 __btrfs_file_read(const struct __btrfs_root *, u64, u64, u64, char *); |
Qu Wenruo | cf5a3a0 | 2020-06-24 18:03:11 +0200 | [diff] [blame^] | 62 | int btrfs_file_read(struct btrfs_root *root, u64 ino, u64 file_offset, u64 len, |
| 63 | char *dest); |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 64 | |
| 65 | /* subvolume.c */ |
| 66 | u64 btrfs_get_default_subvol_objectid(void); |
| 67 | |
| 68 | /* extent-io.c */ |
Qu Wenruo | 6aa2cc4 | 2020-06-24 18:03:08 +0200 | [diff] [blame] | 69 | u64 __btrfs_read_extent_inline(struct __btrfs_path *, |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 70 | struct btrfs_file_extent_item *, u64, u64, |
| 71 | char *); |
Qu Wenruo | 6aa2cc4 | 2020-06-24 18:03:08 +0200 | [diff] [blame] | 72 | u64 __btrfs_read_extent_reg(struct __btrfs_path *, struct btrfs_file_extent_item *, |
Marek Behún | 2938754 | 2017-09-03 17:00:28 +0200 | [diff] [blame] | 73 | u64, u64, char *); |
| 74 | |
| 75 | #endif /* !__BTRFS_BTRFS_H__ */ |