blob: 268ca077d96a2482bb45a18f89476a20f6d05ee3 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Marek Behún29387542017-09-03 17:00:28 +02002/*
3 * BTRFS filesystem implementation for U-Boot
4 *
5 * 2017 Marek Behun, CZ.NIC, marek.behun@nic.cz
Marek Behún29387542017-09-03 17:00:28 +02006 */
7
8#ifndef __BTRFS_BTRFS_H__
9#define __BTRFS_BTRFS_H__
10
11#include <linux/rbtree.h>
12#include "conv-funcs.h"
13
14struct btrfs_info {
15 struct btrfs_super_block sb;
Marek Behún29387542017-09-03 17:00:28 +020016
Qu Wenruof6d5af72020-06-24 18:02:57 +020017 struct __btrfs_root tree_root;
18 struct __btrfs_root fs_root;
19 struct __btrfs_root chunk_root;
Marek Behún29387542017-09-03 17:00:28 +020020
21 struct rb_root chunks_root;
22};
23
24extern struct btrfs_info btrfs_info;
Qu Wenruo1d5a7b72020-06-24 18:03:01 +020025extern struct btrfs_fs_info *current_fs_info;
Marek Behún29387542017-09-03 17:00:28 +020026
Marek Behún29387542017-09-03 17:00:28 +020027/* dev.c */
28extern struct blk_desc *btrfs_blk_desc;
Simon Glassc1c4a8f2020-05-10 11:39:57 -060029extern struct disk_partition *btrfs_part_info;
Marek Behún29387542017-09-03 17:00:28 +020030
31int btrfs_devread(u64, int, void *);
32
33/* chunk-map.c */
34u64 btrfs_map_logical_to_physical(u64);
35int btrfs_chunk_map_init(void);
36void btrfs_chunk_map_exit(void);
Qu Wenruo8f267cf2020-06-24 18:03:00 +020037int __btrfs_read_chunk_tree(void);
Marek Behún29387542017-09-03 17:00:28 +020038
39/* compression.c */
40u32 btrfs_decompress(u8 type, const char *, u32, char *, u32);
41
42/* super.c */
43int btrfs_read_superblock(void);
44
45/* dir-item.c */
Qu Wenruodca22af2020-06-24 18:03:02 +020046int __btrfs_lookup_dir_item(const struct __btrfs_root *, u64, const char *, int,
Marek Behún29387542017-09-03 17:00:28 +020047 struct btrfs_dir_item *);
Marek Behún29387542017-09-03 17:00:28 +020048/* root.c */
Qu Wenruof6d5af72020-06-24 18:02:57 +020049int btrfs_find_root(u64, struct __btrfs_root *, struct btrfs_root_item *);
Marek Behún29387542017-09-03 17:00:28 +020050u64 btrfs_lookup_root_ref(u64, struct btrfs_root_ref *, char *);
51
52/* inode.c */
Qu Wenruodca22af2020-06-24 18:03:02 +020053u64 __btrfs_lookup_inode_ref(struct __btrfs_root *, u64, struct btrfs_inode_ref *,
Marek Behún29387542017-09-03 17:00:28 +020054 char *);
Qu Wenruodca22af2020-06-24 18:03:02 +020055int __btrfs_lookup_inode(const struct __btrfs_root *, struct btrfs_key *,
Qu Wenruof6d5af72020-06-24 18:02:57 +020056 struct btrfs_inode_item *, struct __btrfs_root *);
Qu Wenruodca22af2020-06-24 18:03:02 +020057int __btrfs_readlink(const struct __btrfs_root *, u64, char *);
Qu Wenruo49fe0f02020-06-24 18:03:03 +020058int btrfs_readlink(struct btrfs_root *root, u64 ino, char *target);
Qu Wenruodca22af2020-06-24 18:03:02 +020059u64 __btrfs_lookup_path(struct __btrfs_root *, u64, const char *, u8 *,
Marek Behún29387542017-09-03 17:00:28 +020060 struct btrfs_inode_item *, int);
Qu Wenruo6aa2cc42020-06-24 18:03:08 +020061u64 __btrfs_file_read(const struct __btrfs_root *, u64, u64, u64, char *);
Qu Wenruocf5a3a02020-06-24 18:03:11 +020062int btrfs_file_read(struct btrfs_root *root, u64 ino, u64 file_offset, u64 len,
63 char *dest);
Marek Behún29387542017-09-03 17:00:28 +020064
65/* subvolume.c */
66u64 btrfs_get_default_subvol_objectid(void);
67
68/* extent-io.c */
Qu Wenruo6aa2cc42020-06-24 18:03:08 +020069u64 __btrfs_read_extent_inline(struct __btrfs_path *,
Marek Behún29387542017-09-03 17:00:28 +020070 struct btrfs_file_extent_item *, u64, u64,
71 char *);
Qu Wenruo6aa2cc42020-06-24 18:03:08 +020072u64 __btrfs_read_extent_reg(struct __btrfs_path *, struct btrfs_file_extent_item *,
Marek Behún29387542017-09-03 17:00:28 +020073 u64, u64, char *);
74
75#endif /* !__BTRFS_BTRFS_H__ */