Qu Wenruo | 0e7b854 | 2020-06-24 18:02:48 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | #ifndef __BTRFS_DISK_IO_H__ |
| 3 | #define __BTRFS_DISK_IO_H__ |
| 4 | |
Qu Wenruo | 1a61808 | 2020-06-24 18:02:49 +0200 | [diff] [blame] | 5 | #include <linux/sizes.h> |
| 6 | #include <fs_internal.h> |
Qu Wenruo | 0e7b854 | 2020-06-24 18:02:48 +0200 | [diff] [blame] | 7 | #include "ctree.h" |
| 8 | #include "disk-io.h" |
| 9 | |
Qu Wenruo | 1a61808 | 2020-06-24 18:02:49 +0200 | [diff] [blame] | 10 | #define BTRFS_SUPER_INFO_OFFSET SZ_64K |
| 11 | #define BTRFS_SUPER_INFO_SIZE SZ_4K |
Qu Wenruo | 0e7b854 | 2020-06-24 18:02:48 +0200 | [diff] [blame] | 12 | |
Qu Wenruo | d85f959 | 2020-06-24 18:02:55 +0200 | [diff] [blame] | 13 | /* U-boot specific */ |
| 14 | int btrfs_read_superblock(void); |
Qu Wenruo | 0e7b854 | 2020-06-24 18:02:48 +0200 | [diff] [blame] | 15 | |
Qu Wenruo | d85f959 | 2020-06-24 18:02:55 +0200 | [diff] [blame] | 16 | /* From btrfs-progs */ |
| 17 | int read_whole_eb(struct btrfs_fs_info *info, struct extent_buffer *eb, int mirror); |
| 18 | struct extent_buffer* read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr, |
| 19 | u64 parent_transid); |
| 20 | |
Qu Wenruo | 83b04df | 2020-06-24 18:03:09 +0200 | [diff] [blame^] | 21 | int read_extent_data(struct btrfs_fs_info *fs_info, char *data, u64 logical, |
| 22 | u64 *len, int mirror); |
Qu Wenruo | d85f959 | 2020-06-24 18:02:55 +0200 | [diff] [blame] | 23 | struct extent_buffer* btrfs_find_create_tree_block( |
| 24 | struct btrfs_fs_info *fs_info, u64 bytenr); |
| 25 | struct extent_buffer *btrfs_find_tree_block(struct btrfs_fs_info *fs_info, |
| 26 | u64 bytenr, u32 blocksize); |
Qu Wenruo | 1d5a7b7 | 2020-06-24 18:03:01 +0200 | [diff] [blame] | 27 | struct btrfs_root *btrfs_read_fs_root_no_cache(struct btrfs_fs_info *fs_info, |
| 28 | struct btrfs_key *location); |
| 29 | struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info, |
| 30 | struct btrfs_key *location); |
| 31 | |
| 32 | void btrfs_setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info, |
| 33 | u64 objectid); |
| 34 | |
| 35 | void btrfs_free_fs_info(struct btrfs_fs_info *fs_info); |
| 36 | struct btrfs_fs_info *btrfs_new_fs_info(void); |
| 37 | int btrfs_check_fs_compatibility(struct btrfs_super_block *sb); |
| 38 | int btrfs_setup_all_roots(struct btrfs_fs_info *fs_info); |
| 39 | void btrfs_release_all_roots(struct btrfs_fs_info *fs_info); |
| 40 | void btrfs_cleanup_all_caches(struct btrfs_fs_info *fs_info); |
| 41 | |
| 42 | struct btrfs_fs_info *open_ctree_fs_info(struct blk_desc *desc, |
| 43 | struct disk_partition *part); |
| 44 | int close_ctree_fs_info(struct btrfs_fs_info *fs_info); |
| 45 | |
Qu Wenruo | 1a61808 | 2020-06-24 18:02:49 +0200 | [diff] [blame] | 46 | int btrfs_read_dev_super(struct blk_desc *desc, struct disk_partition *part, |
| 47 | struct btrfs_super_block *sb); |
Qu Wenruo | d85f959 | 2020-06-24 18:02:55 +0200 | [diff] [blame] | 48 | int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid); |
| 49 | int btrfs_set_buffer_uptodate(struct extent_buffer *buf); |
| 50 | int btrfs_csum_data(u16 csum_type, const u8 *data, u8 *out, size_t len); |
| 51 | int csum_tree_block_size(struct extent_buffer *buf, u16 csum_sectorsize, |
| 52 | int verify, u16 csum_type); |
Qu Wenruo | 0e7b854 | 2020-06-24 18:02:48 +0200 | [diff] [blame] | 53 | #endif |