Fix cacheput memmove bug.
[vcfs.git] / blocktree.h
1 #ifndef _BLOCKTREE_H
2 #define _BLOCKTREE_H
3
4 #include "store.h"
5 #include "inttypes.h"
6
7 #define BT_INDBITS 10
8 #define BT_INDSZ (1 << BT_INDBITS)
9 #define BT_INDBSZ (sizeof(struct btnode) * BT_INDSZ)
10
11 typedef loff_t block_t;
12
13 struct btnode {
14     u_int8_t d;
15     struct addr a;
16 };
17
18 struct btop {
19     block_t blk;
20     void *buf;
21     size_t len;
22     int (*fillfn)(void *buf, size_t len, void *pdata);
23     void *pdata;
24 };
25
26 ssize_t btget(struct store *st, struct btnode *tree, block_t bl, void *buf, size_t len);
27 int btputmany(struct store *st, struct btnode *tree, struct btop *ops, int numops);
28 int btput(struct store *st, struct btnode *tree, block_t bl, void *buf, size_t len);
29 block_t btcount(struct store *st, struct btnode *tree);
30 void btsortops(struct btop *ops, int numops);
31 void btmkop(struct btop *op, block_t bl, void *buf, size_t len);
32
33 #endif