blob: 9daf959c57b6c8557d4c123f6a8ff840ff01de5e [file] [log] [blame]
Qu Wenruo0e7b8542020-06-24 18:02:48 +02001// SPDX-License-Identifier: GPL-2.0+
2#ifndef __BTRFS_DISK_IO_H__
3#define __BTRFS_DISK_IO_H__
4
Qu Wenruo1a618082020-06-24 18:02:49 +02005#include <linux/sizes.h>
6#include <fs_internal.h>
Qu Wenruo0e7b8542020-06-24 18:02:48 +02007#include "ctree.h"
8#include "disk-io.h"
9
Qu Wenruo1a618082020-06-24 18:02:49 +020010#define BTRFS_SUPER_INFO_OFFSET SZ_64K
11#define BTRFS_SUPER_INFO_SIZE SZ_4K
Qu Wenruo0e7b8542020-06-24 18:02:48 +020012
Qu Wenruod85f9592020-06-24 18:02:55 +020013/* U-boot specific */
14int btrfs_read_superblock(void);
Qu Wenruo0e7b8542020-06-24 18:02:48 +020015
Qu Wenruod85f9592020-06-24 18:02:55 +020016/* From btrfs-progs */
17int read_whole_eb(struct btrfs_fs_info *info, struct extent_buffer *eb, int mirror);
18struct extent_buffer* read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
19 u64 parent_transid);
20
21struct extent_buffer* btrfs_find_create_tree_block(
22 struct btrfs_fs_info *fs_info, u64 bytenr);
23struct extent_buffer *btrfs_find_tree_block(struct btrfs_fs_info *fs_info,
24 u64 bytenr, u32 blocksize);
Qu Wenruo1d5a7b72020-06-24 18:03:01 +020025struct btrfs_root *btrfs_read_fs_root_no_cache(struct btrfs_fs_info *fs_info,
26 struct btrfs_key *location);
27struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
28 struct btrfs_key *location);
29
30void btrfs_setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info,
31 u64 objectid);
32
33void btrfs_free_fs_info(struct btrfs_fs_info *fs_info);
34struct btrfs_fs_info *btrfs_new_fs_info(void);
35int btrfs_check_fs_compatibility(struct btrfs_super_block *sb);
36int btrfs_setup_all_roots(struct btrfs_fs_info *fs_info);
37void btrfs_release_all_roots(struct btrfs_fs_info *fs_info);
38void btrfs_cleanup_all_caches(struct btrfs_fs_info *fs_info);
39
40struct btrfs_fs_info *open_ctree_fs_info(struct blk_desc *desc,
41 struct disk_partition *part);
42int close_ctree_fs_info(struct btrfs_fs_info *fs_info);
43
Qu Wenruo1a618082020-06-24 18:02:49 +020044int btrfs_read_dev_super(struct blk_desc *desc, struct disk_partition *part,
45 struct btrfs_super_block *sb);
Qu Wenruod85f9592020-06-24 18:02:55 +020046int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid);
47int btrfs_set_buffer_uptodate(struct extent_buffer *buf);
48int btrfs_csum_data(u16 csum_type, const u8 *data, u8 *out, size_t len);
49int csum_tree_block_size(struct extent_buffer *buf, u16 csum_sectorsize,
50 int verify, u16 csum_type);
Qu Wenruo0e7b8542020-06-24 18:02:48 +020051#endif