xref: /plan9/sys/src/cmd/replica/all.h (revision 12fd1c83b21b4d1deeab2b58fe2c202d2038c714)
1 #include <u.h>
2 #include <libc.h>
3 #include <bio.h>
4 #include <disk.h>
5 
6 /* avl.c */
7 typedef struct Avl Avl;
8 typedef struct Avltree Avltree;
9 typedef struct Avlwalk Avlwalk;
10 
11 #pragma incomplete Avltree
12 #pragma incomplete Avlwalk
13 
14 struct Avl
15 {
16 	Avl *p;	/* parent */
17 	Avl *n[2];	/* children */
18 	int bal;	/* balance bits */
19 };
20 
21 Avltree *mkavltree(int(*cmp)(Avl*, Avl*));
22 void insertavl(Avltree *tree, Avl *new, Avl **oldp);
23 Avl *lookupavl(Avltree *tree, Avl *key);
24 void deleteavl(Avltree *tree, Avl *key, Avl **oldp);
25 Avlwalk *avlwalk(Avltree *tree);
26 Avl *avlnext(Avlwalk *walk);
27 Avl	*avlprev(Avlwalk *walk);
28 void endwalk(Avlwalk *walk);
29 
30 /* db.c */
31 typedef struct Db Db;
32 typedef struct Entry Entry;
33 struct Entry
34 {
35 	Avl a;
36 	char *name;
37 	struct {
38 		char *name;
39 		char *uid;
40 		char *gid;
41 		ulong mtime;
42 		ulong mode;
43 		int mark;
44 		vlong length;
45 	} d;
46 };
47 
48 
49 typedef struct Db Db;
50 struct Db
51 {
52 	Avltree *avl;
53 	int fd;
54 };
55 Db *opendb(char*);
56 int finddb(Db*, char*, Dir*);
57 void removedb(Db*, char*);
58 void insertdb(Db*, char*, Dir*);
59 int markdb(Db*, char*, Dir*);
60 
61 /* util.c */
62 void *erealloc(void*, int);
63 void *emalloc(int);
64 char *estrdup(char*);
65 char *atom(char*);
66 char *unroot(char*, char*);
67 
68 /* revproto.c */
69 int revrdproto(char*, char*, char*, Protoenum*, Protowarn*, void*);
70 
71