123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- /*
- * This file is part of the UCB release of Plan 9. It is subject to the license
- * terms in the LICENSE file found in the top-level directory of this
- * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
- * part of the UCB release of Plan 9, including this file, may be copied,
- * modified, propagated, or distributed except according to the terms contained
- * in the LICENSE file.
- */
- #include <u.h>
- #include <libc.h>
- #include <ctype.h>
- #define Tfile Tfilescsi /* avoid name conflict */
- #include <disk.h>
- #undef Tfile
- #include <bio.h>
- #include <ip.h>
- #include "dat.h"
- #include "portfns.h"
- #define malloc(n) ialloc(n, 0)
- #define CHAT(cp) ((cons.flags&chatflag) || \
- ((cp) && (((Chan*)(cp))->flags&chatflag)))
- #define QID9P1(a,b) (Qid9p1){a,b}
- #define SECOND(n) (n)
- #define MINUTE(n) ((n)*SECOND(60))
- #define HOUR(n) ((n)*MINUTE(60))
- #define DAY(n) ((n)*HOUR(24))
- enum {
- QPDIR = 0x80000000L,
- QPNONE = 0,
- QPROOT = 1,
- QPSUPER = 2,
- /*
- * perm argument in 9P create
- */
- PDIR = 1L<<31, /* is a directory */
- PAPND = 1L<<30, /* is append only */
- PLOCK = 1L<<29, /* is locked on open */
- FID1 = 1,
- FID2 = 2,
- MAXBIAS = SECOND(20),
- TLOCK = MINUTE(5),
- };
- Uid* uid;
- short* gidspace;
- Lock printing;
- Time tim;
- File* files;
- Wpath* wpaths;
- Lock wpathlock;
- char* errstr9p[MAXERR];
- Chan* chans;
- RWLock mainlock;
- Timet fs_mktime;
- Timet boottime;
- Queue* serveq;
- Queue* raheadq;
- Rabuf* rabuffree;
- QLock reflock;
- Lock rabuflock;
- Tlock tlocks[NTLOCK];
- Lock tlocklock;
- Device* devnone;
- Startsb startsb[5];
- int mballocs[MAXCAT];
- /* from config block */
- char service[50]; /* my name */
- Filsys filsys[30]; /* named file systems */
- /*
- * these are only documentation, but putting them in the config block makes
- * them visible. the real values are compiled into cwfs.
- */
- typedef struct Fspar Fspar;
- struct Fspar {
- char* name;
- long actual; /* compiled-in value */
- long declared;
- } fspar[];
- uint32_t roflag;
- uint32_t errorflag;
- uint32_t chatflag;
- uint32_t attachflag;
- uint32_t authdebugflag;
- uint32_t authdisableflag;
- int noattach;
- int wstatallow; /* set to circumvent wstat permissions */
- int writeallow; /* set to circumvent write permissions */
- int duallow; /* single user to allow du */
- int readonly; /* disable writes if true */
- int noauth; /* Debug */
- int rawreadok; /* allow reading raw data */
- File* flist[5003]; /* base of file structures */
- Lock flock; /* manipulate flist */
- long growacct[1000];
- struct
- {
- RWLock uidlock;
- Iobuf* uidbuf;
- int flen;
- int find;
- } uidgc;
- extern char statecall[];
- extern char* wormscode[];
- extern char* tagnames[];
|