2007-02-02 09:18:22 -05:00
|
|
|
#ifndef __DISKIO__
|
|
|
|
#define __DISKIO__
|
2007-03-01 18:59:40 -05:00
|
|
|
#include "list.h"
|
2007-02-02 09:18:22 -05:00
|
|
|
|
|
|
|
struct tree_buffer {
|
|
|
|
u64 blocknr;
|
|
|
|
int count;
|
|
|
|
union {
|
|
|
|
struct node node;
|
|
|
|
struct leaf leaf;
|
|
|
|
};
|
2007-03-01 18:59:40 -05:00
|
|
|
struct list_head dirty;
|
|
|
|
struct list_head cache;
|
2007-02-02 09:18:22 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct tree_buffer *read_tree_block(struct ctree_root *root, u64 blocknr);
|
2007-02-23 08:38:36 -05:00
|
|
|
struct tree_buffer *find_tree_block(struct ctree_root *root, u64 blocknr);
|
2007-02-02 09:18:22 -05:00
|
|
|
int write_tree_block(struct ctree_root *root, struct tree_buffer *buf);
|
2007-03-01 18:59:40 -05:00
|
|
|
int dirty_tree_block(struct ctree_root *root, struct tree_buffer *buf);
|
|
|
|
int clean_tree_block(struct ctree_root *root, struct tree_buffer *buf);
|
2007-03-06 20:08:01 -05:00
|
|
|
int commit_transaction(struct ctree_root *root, struct ctree_super_block *s);
|
2007-02-21 17:04:57 -05:00
|
|
|
struct ctree_root *open_ctree(char *filename, struct ctree_super_block *s);
|
2007-03-06 20:08:01 -05:00
|
|
|
int close_ctree(struct ctree_root *root, struct ctree_super_block *s);
|
2007-02-02 09:18:22 -05:00
|
|
|
void tree_block_release(struct ctree_root *root, struct tree_buffer *buf);
|
2007-02-21 17:04:57 -05:00
|
|
|
int write_ctree_super(struct ctree_root *root, struct ctree_super_block *s);
|
2007-02-20 16:40:44 -05:00
|
|
|
int mkfs(int fd);
|
|
|
|
|
|
|
|
#define CTREE_SUPER_INFO_OFFSET(bs) (16 * (bs))
|
2007-02-02 09:18:22 -05:00
|
|
|
|
|
|
|
#endif
|