all.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include <u.h>
  10. #include <libc.h>
  11. #include <bio.h>
  12. #include <disk.h>
  13. /* avl.c */
  14. typedef struct Avl Avl;
  15. typedef struct Avltree Avltree;
  16. typedef struct Avlwalk Avlwalk;
  17. #pragma incomplete Avltree
  18. #pragma incomplete Avlwalk
  19. struct Avl
  20. {
  21. Avl *p; /* parent */
  22. Avl *n[2]; /* children */
  23. int bal; /* balance bits */
  24. };
  25. Avltree *mkavltree(int(*cmp)(Avl*, Avl*));
  26. void insertavl(Avltree *tree, Avl *new, Avl **oldp);
  27. Avl *lookupavl(Avltree *tree, Avl *key);
  28. void deleteavl(Avltree *tree, Avl *key, Avl **oldp);
  29. Avlwalk *avlwalk(Avltree *tree);
  30. Avl *avlnext(Avlwalk *walk);
  31. Avl *avlprev(Avlwalk *walk);
  32. void endwalk(Avlwalk *walk);
  33. /* db.c */
  34. typedef struct Db Db;
  35. typedef struct Entry Entry;
  36. struct Entry
  37. {
  38. Avl a;
  39. char *name;
  40. struct {
  41. char *name;
  42. char *uid;
  43. char *gid;
  44. uint32_t mtime;
  45. uint32_t mode;
  46. int mark;
  47. vlong length;
  48. } d;
  49. };
  50. typedef struct Db Db;
  51. struct Db
  52. {
  53. Avltree *avl;
  54. int fd;
  55. };
  56. Db *opendb(char*);
  57. int finddb(Db*, char*, Dir*);
  58. void removedb(Db*, char*);
  59. void insertdb(Db*, char*, Dir*);
  60. int markdb(Db*, char*, Dir*);
  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. /* revproto.c */
  68. int revrdproto(char*, char*, char*, Protoenum*, Protowarn*, void*);