all.h 1.2 KB

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