add some support for multiple devices to progs
[platform/upstream/btrfs-progs.git] / disk-io.h
1 #ifndef __DISKIO__
2 #define __DISKIO__
3 #include "list.h"
4
5 struct btrfs_buffer {
6         u64 blocknr;
7         u64 dev_blocknr;
8         int count;
9         int fd;
10         struct list_head dirty;
11         struct list_head cache;
12         union {
13                 struct btrfs_node node;
14                 struct btrfs_leaf leaf;
15         };
16 };
17
18 struct btrfs_buffer *read_tree_block(struct btrfs_root *root, u64 blocknr);
19 struct btrfs_buffer *find_tree_block(struct btrfs_root *root, u64 blocknr);
20 int write_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
21                      struct btrfs_buffer *buf);
22 int dirty_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
23                      struct btrfs_buffer *buf);
24 int clean_tree_block(struct btrfs_trans_handle *trans,
25                      struct btrfs_root *root, struct btrfs_buffer *buf);
26 int btrfs_commit_transaction(struct btrfs_trans_handle *trans, struct btrfs_root
27                              *root, struct btrfs_super_block *s);
28 struct btrfs_root *open_ctree(char *filename, struct btrfs_super_block *s);
29 struct btrfs_root *open_ctree_fd(int fp, struct btrfs_super_block *super);
30 int close_ctree(struct btrfs_root *root, struct btrfs_super_block *s);
31 void btrfs_block_release(struct btrfs_root *root, struct btrfs_buffer *buf);
32 int write_ctree_super(struct btrfs_trans_handle *trans, struct btrfs_root *root,
33                       struct btrfs_super_block *s);
34 #define BTRFS_SUPER_INFO_OFFSET (16 * 1024)
35
36 #endif