all.h 1.2 KB

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