all.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 <ctype.h>
  12. #define Tfile Tfilescsi /* avoid name conflict */
  13. #include <disk.h>
  14. #undef Tfile
  15. #include <bio.h>
  16. #include <ip.h>
  17. #include "dat.h"
  18. #include "portfns.h"
  19. #define malloc(n) ialloc(n, 0)
  20. #define CHAT(cp) ((cons.flags&chatflag) || \
  21. ((cp) && (((Chan*)(cp))->flags&chatflag)))
  22. #define QID9P1(a,b) (Qid9p1){a,b}
  23. #define SECOND(n) (n)
  24. #define MINUTE(n) ((n)*SECOND(60))
  25. #define HOUR(n) ((n)*MINUTE(60))
  26. #define DAY(n) ((n)*HOUR(24))
  27. enum {
  28. QPDIR = 0x80000000L,
  29. QPNONE = 0,
  30. QPROOT = 1,
  31. QPSUPER = 2,
  32. /*
  33. * perm argument in 9P create
  34. */
  35. PDIR = 1L<<31, /* is a directory */
  36. PAPND = 1L<<30, /* is append only */
  37. PLOCK = 1L<<29, /* is locked on open */
  38. FID1 = 1,
  39. FID2 = 2,
  40. MAXBIAS = SECOND(20),
  41. TLOCK = MINUTE(5),
  42. };
  43. Uid* uid;
  44. short* gidspace;
  45. Lock printing;
  46. Time tim;
  47. File* files;
  48. Wpath* wpaths;
  49. Lock wpathlock;
  50. char* errstr9p[MAXERR];
  51. Chan* chans;
  52. RWLock mainlock;
  53. Timet fs_mktime;
  54. Timet boottime;
  55. Queue* serveq;
  56. Queue* raheadq;
  57. Rabuf* rabuffree;
  58. QLock reflock;
  59. Lock rabuflock;
  60. Tlock tlocks[NTLOCK];
  61. Lock tlocklock;
  62. Device* devnone;
  63. Startsb startsb[5];
  64. int mballocs[MAXCAT];
  65. /* from config block */
  66. char service[50]; /* my name */
  67. Filsys filsys[30]; /* named file systems */
  68. /*
  69. * these are only documentation, but putting them in the config block makes
  70. * them visible. the real values are compiled into cwfs.
  71. */
  72. typedef struct Fspar Fspar;
  73. struct Fspar {
  74. char* name;
  75. long actual; /* compiled-in value */
  76. long declared;
  77. } fspar[];
  78. uint32_t roflag;
  79. uint32_t errorflag;
  80. uint32_t chatflag;
  81. uint32_t attachflag;
  82. uint32_t authdebugflag;
  83. uint32_t authdisableflag;
  84. int noattach;
  85. int wstatallow; /* set to circumvent wstat permissions */
  86. int writeallow; /* set to circumvent write permissions */
  87. int duallow; /* single user to allow du */
  88. int readonly; /* disable writes if true */
  89. int noauth; /* Debug */
  90. int rawreadok; /* allow reading raw data */
  91. File* flist[5003]; /* base of file structures */
  92. Lock flock; /* manipulate flist */
  93. long growacct[1000];
  94. struct
  95. {
  96. RWLock uidlock;
  97. Iobuf* uidbuf;
  98. int flen;
  99. int find;
  100. } uidgc;
  101. extern char statecall[];
  102. extern char* wormscode[];
  103. extern char* tagnames[];