all.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. void endwalk(Avlwalk *walk);
  22. /* db.c */
  23. typedef struct Db Db;
  24. typedef struct Entry Entry;
  25. struct Entry
  26. {
  27. Avl a;
  28. char *name;
  29. struct {
  30. char *name;
  31. char *uid;
  32. char *gid;
  33. ulong mtime;
  34. ulong mode;
  35. int mark;
  36. vlong length;
  37. } d;
  38. };
  39. typedef struct Db Db;
  40. struct Db
  41. {
  42. Avltree *avl;
  43. int fd;
  44. };
  45. Db *opendb(char*);
  46. int finddb(Db*, char*, Dir*);
  47. void removedb(Db*, char*);
  48. void insertdb(Db*, char*, Dir*);
  49. int markdb(Db*, char*, Dir*);
  50. /* util.c */
  51. void *erealloc(void*, int);
  52. void *emalloc(int);
  53. char *estrdup(char*);
  54. char *atom(char*);
  55. char *unroot(char*, char*);
  56. /* revproto.c */
  57. int revrdproto(char*, char*, char*, Protoenum*, Protowarn*, void*);