portdat.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877
  1. /*
  2. * fundamental constants
  3. */
  4. #define SUPER_ADDR 2 /* address of superblock */
  5. #define ROOT_ADDR 3 /* address of root directory */
  6. #define NAMELEN 28 /* size of names */
  7. #define NDBLOCK 6 /* number of direct blocks in Dentry */
  8. #define MAXDAT 8192 /* max allowable data message */
  9. #define MAXMSG 128 /* max size protocol message sans data */
  10. #define OFFMSG 60 /* offset of msg in buffer */
  11. #define NDRIVE 16 /* size of drive structure */
  12. #define NTLOCK 200 /* number of active file Tlocks */
  13. #define LRES 3 /* profiling resolution */
  14. #define NATTID 10 /* the last 10 ID's in attaches */
  15. #define C0a 59 /* time constants for filters */
  16. #define C0b 60
  17. #define C1a 599
  18. #define C1b 600
  19. #define C2a 5999
  20. #define C2b 6000
  21. /*
  22. * derived constants
  23. */
  24. #define BUFSIZE (RBUFSIZE-sizeof(Tag))
  25. #define DIRPERBUF (BUFSIZE/sizeof(Dentry))
  26. #define INDPERBUF (BUFSIZE/sizeof(long))
  27. #define INDPERBUF2 (INDPERBUF*INDPERBUF)
  28. #define FEPERBUF ((BUFSIZE-sizeof(Super1)-sizeof(long))/sizeof(long))
  29. #define SMALLBUF (MAXMSG)
  30. #define LARGEBUF (MAXMSG+MAXDAT+256)
  31. #define RAGAP (300*1024)/BUFSIZE /* readahead parameter */
  32. #define CEPERBK ((BUFSIZE-BKPERBLK*sizeof(long))/\
  33. (sizeof(Centry)*BKPERBLK))
  34. #define BKPERBLK 10
  35. typedef struct Alarm Alarm;
  36. typedef struct Auth Auth;
  37. typedef struct Conf Conf;
  38. typedef struct Label Label;
  39. typedef struct Lock Lock;
  40. typedef struct Mach Mach;
  41. typedef struct QLock QLock;
  42. typedef struct Ureg Ureg;
  43. typedef struct User User;
  44. typedef struct Fbuf Fbuf;
  45. typedef struct Super1 Super1;
  46. typedef struct Superb Superb;
  47. typedef struct Filsys Filsys;
  48. typedef struct Startsb Startsb;
  49. typedef struct Dentry Dentry;
  50. typedef struct Tag Tag;
  51. typedef struct Talarm Talarm;
  52. typedef struct Uid Uid;
  53. typedef struct Device Device;
  54. typedef struct Qid9p1 Qid9p1;
  55. typedef struct Iobuf Iobuf;
  56. typedef struct Wpath Wpath;
  57. typedef struct File File;
  58. typedef struct Chan Chan;
  59. typedef struct Cons Cons;
  60. typedef struct Time Time;
  61. typedef struct Tm Tm;
  62. typedef struct Rtc Rtc;
  63. typedef struct Hiob Hiob;
  64. typedef struct RWlock RWlock;
  65. typedef struct Msgbuf Msgbuf;
  66. typedef struct Queue Queue;
  67. typedef struct Command Command;
  68. typedef struct Flag Flag;
  69. typedef struct Bp Bp;
  70. typedef struct Rabuf Rabuf;
  71. typedef struct Rendez Rendez;
  72. typedef struct Filter Filter;
  73. typedef ulong Float;
  74. typedef struct Tlock Tlock;
  75. typedef struct Cache Cache;
  76. typedef struct Centry Centry;
  77. typedef struct Bucket Bucket;
  78. #pragma incomplete Auth
  79. #pragma incomplete Ureg
  80. struct Lock
  81. {
  82. ulong* sbsem; /* addr of sync bus semaphore */
  83. ulong pc;
  84. ulong sr;
  85. };
  86. struct Rendez
  87. {
  88. Lock;
  89. User* p;
  90. };
  91. struct Filter
  92. {
  93. ulong count; /* count and old count kept separate */
  94. ulong oldcount; /* so interrput can read them */
  95. int c1; /* time const multiplier */
  96. int c2; /* time const divider */
  97. int c3; /* scale for printing */
  98. Float filter; /* filter */
  99. };
  100. struct QLock
  101. {
  102. Lock; /* to use object */
  103. User* head; /* next process waiting for object */
  104. User* tail; /* last process waiting for object */
  105. char* name; /* for diagnostics */
  106. int locked; /* flag, is locked */
  107. };
  108. struct RWlock
  109. {
  110. int nread;
  111. QLock wr;
  112. QLock rd;
  113. };
  114. /*
  115. * send/recv queue structure
  116. */
  117. struct Queue
  118. {
  119. Lock; /* to manipulate values */
  120. int size; /* size of queue */
  121. int loc; /* circular pointer */
  122. int count; /* how many in queue */
  123. User* rhead; /* process's waiting for send */
  124. User* rtail;
  125. User* whead; /* process's waiting for recv */
  126. User* wtail;
  127. void* args[1]; /* list of saved pointers, [->size] */
  128. };
  129. struct Tag
  130. {
  131. short pad;
  132. short tag;
  133. long path;
  134. };
  135. struct Device
  136. {
  137. uchar type;
  138. uchar init;
  139. Device* link; /* link for mcat/mlev/mirror */
  140. Device* dlink; /* link all devices */
  141. void* private;
  142. long size;
  143. union
  144. {
  145. struct /* wren, ide, (l)worm in targ */
  146. {
  147. int ctrl; /* disks only */
  148. int targ;
  149. int lun; /* wren only */
  150. } wren;
  151. struct /* mcat mlev mirror */
  152. {
  153. Device* first;
  154. Device* last;
  155. int ndev;
  156. } cat;
  157. struct /* cw */
  158. {
  159. Device* c; /* cache device */
  160. Device* w; /* worm device */
  161. Device* ro; /* dump - readonly */
  162. } cw;
  163. struct /* juke */
  164. {
  165. Device* j; /* (robotics, worm drives) - wrens */
  166. Device* m; /* (sides) - r or l devices */
  167. } j;
  168. struct /* ro */
  169. {
  170. Device* parent;
  171. } ro;
  172. struct /* fworm */
  173. {
  174. Device* fw;
  175. } fw;
  176. struct /* part */
  177. {
  178. Device* d;
  179. long base;
  180. long size;
  181. } part;
  182. struct /* byte-swapped */
  183. {
  184. Device* d;
  185. } swab;
  186. };
  187. };
  188. typedef struct Sidestarts {
  189. long sstart; /* blocks before start of side */
  190. long s1start; /* blocks before start of next side */
  191. } Sidestarts;
  192. struct Rabuf
  193. {
  194. union
  195. {
  196. struct
  197. {
  198. Device* dev;
  199. long addr;
  200. };
  201. Rabuf* link;
  202. };
  203. };
  204. typedef
  205. struct Qid
  206. {
  207. uvlong path;
  208. ulong vers;
  209. uchar type;
  210. } Qid;
  211. /* bits in Qid.type */
  212. #define QTDIR 0x80 /* type bit for directories */
  213. #define QTAPPEND 0x40 /* type bit for append only files */
  214. #define QTEXCL 0x20 /* type bit for exclusive use files */
  215. #define QTMOUNT 0x10 /* type bit for mounted channel */
  216. #define QTAUTH 0x08 /* type bit for authentication file */
  217. #define QTFILE 0x00 /* plain file */
  218. /* DONT TOUCH, this is the disk structure */
  219. struct Qid9p1
  220. {
  221. long path;
  222. long version;
  223. };
  224. struct Hiob
  225. {
  226. Iobuf* link;
  227. Lock;
  228. };
  229. struct Chan
  230. {
  231. char type; /* major driver type i.e. Dev* */
  232. int (*protocol)(Msgbuf*); /* version */
  233. int msize; /* version */
  234. char whochan[50];
  235. char whoname[NAMELEN];
  236. void (*whoprint)(Chan*);
  237. ulong flags;
  238. int chan; /* overall channel number, mostly for printing */
  239. int nmsgs; /* outstanding messages, set under flock -- for flush */
  240. ulong whotime;
  241. Filter work;
  242. Filter rate;
  243. int nfile; /* used by cmd_files */
  244. RWlock reflock;
  245. Chan* next; /* link list of chans */
  246. Queue* send;
  247. Queue* reply;
  248. uchar authinfo[64];
  249. void* ifc;
  250. void* pdata;
  251. };
  252. struct Filsys
  253. {
  254. char* name; /* name of filsys */
  255. char* conf; /* symbolic configuration */
  256. Device* dev; /* device that filsys is on */
  257. int flags;
  258. #define FREAM (1<<0) /* mkfs */
  259. #define FRECOVER (1<<1) /* install last dump */
  260. #define FEDIT (1<<2) /* modified */
  261. };
  262. struct Startsb
  263. {
  264. char* name;
  265. long startsb;
  266. };
  267. struct Time
  268. {
  269. ulong lasttoy;
  270. long bias;
  271. long offset;
  272. };
  273. /*
  274. * array of qids that are locked
  275. */
  276. struct Tlock
  277. {
  278. Device* dev;
  279. ulong time;
  280. long qpath;
  281. File* file;
  282. };
  283. struct Cons
  284. {
  285. ulong flags; /* overall flags for all channels */
  286. QLock; /* generic qlock for mutex */
  287. int uid; /* botch -- used to get uid on cons_create */
  288. int gid; /* botch -- used to get gid on cons_create */
  289. int nuid; /* number of uids */
  290. int ngid; /* number of gids */
  291. long offset; /* used to read files, c.f. fchar */
  292. int chano; /* generator for channel numbers */
  293. Chan* chan; /* console channel */
  294. Filsys* curfs; /* current filesystem */
  295. int profile; /* are we profiling? */
  296. long* profbuf;
  297. ulong minpc;
  298. ulong maxpc;
  299. ulong nprofbuf;
  300. long nlarge; /* number of large message buffers */
  301. long nsmall; /* ... small ... */
  302. long nwormre; /* worm read errors */
  303. long nwormwe; /* worm write errors */
  304. long nwormhit; /* worm read cache hits */
  305. long nwormmiss; /* worm read cache non-hits */
  306. int noage; /* dont update cache age, dump and check */
  307. long nwrenre; /* disk read errors */
  308. long nwrenwe; /* disk write errors */
  309. long nreseq; /* cache bucket resequence */
  310. Filter work[3]; /* thruput in messages */
  311. Filter rate[3]; /* thruput in bytes */
  312. Filter bhit[3]; /* getbufs that hit */
  313. Filter bread[3]; /* getbufs that miss and read */
  314. Filter brahead[3]; /* messages to readahead */
  315. Filter binit[3]; /* getbufs that miss and dont read */
  316. };
  317. struct File
  318. {
  319. QLock;
  320. Qid qid;
  321. Wpath* wpath;
  322. Chan* cp; /* null means a free slot */
  323. Tlock* tlock; /* if file is locked */
  324. File* next; /* in cp->flist */
  325. Filsys* fs;
  326. long addr;
  327. long slot;
  328. long lastra; /* read ahead address */
  329. ulong fid;
  330. short uid;
  331. Auth *auth;
  332. char open;
  333. #define FREAD 1
  334. #define FWRITE 2
  335. #define FREMOV 4
  336. long doffset; /* directory reading */
  337. ulong dvers;
  338. long dslot;
  339. };
  340. struct Wpath
  341. {
  342. Wpath* up; /* pointer upwards in path */
  343. long addr; /* directory entry addr */
  344. long slot; /* directory entry slot */
  345. short refs; /* number of files using this structure */
  346. };
  347. struct Iobuf
  348. {
  349. QLock;
  350. Device* dev;
  351. Iobuf* fore; /* for lru */
  352. Iobuf* back; /* for lru */
  353. char* iobuf; /* only active while locked */
  354. char* xiobuf; /* "real" buffer pointer */
  355. long addr;
  356. int flags;
  357. };
  358. struct Uid
  359. {
  360. short uid; /* user id */
  361. short lead; /* leader of group */
  362. short *gtab; /* group table */
  363. int ngrp; /* number of group entries */
  364. char name[NAMELEN]; /* user name */
  365. };
  366. /* DONT TOUCH, this is the disk structure */
  367. struct Dentry
  368. {
  369. char name[NAMELEN];
  370. short uid;
  371. short gid;
  372. ushort mode;
  373. #define DALLOC 0x8000
  374. #define DDIR 0x4000
  375. #define DAPND 0x2000
  376. #define DLOCK 0x1000
  377. #define DREAD 0x4
  378. #define DWRITE 0x2
  379. #define DEXEC 0x1
  380. short muid;
  381. Qid9p1 qid;
  382. long size;
  383. long dblock[NDBLOCK];
  384. long iblock;
  385. long diblock;
  386. long atime;
  387. long mtime;
  388. };
  389. /* DONT TOUCH, this is the disk structure */
  390. struct Super1
  391. {
  392. long fstart;
  393. long fsize;
  394. long tfree;
  395. long qidgen; /* generator for unique ids */
  396. /*
  397. * Stuff for WWC device
  398. */
  399. long cwraddr; /* cfs root addr */
  400. long roraddr; /* dump root addr */
  401. long last; /* last super block addr */
  402. long next; /* next super block addr */
  403. };
  404. /* DONT TOUCH, this is the disk structure */
  405. struct Fbuf
  406. {
  407. long nfree;
  408. long free[FEPERBUF];
  409. };
  410. /* DONT TOUCH, this is the disk structure */
  411. struct Superb
  412. {
  413. Fbuf fbuf;
  414. Super1;
  415. };
  416. struct Label
  417. {
  418. ulong pc;
  419. ulong sp;
  420. };
  421. struct Alarm
  422. {
  423. Lock;
  424. Alarm* next;
  425. int busy;
  426. int dt; /* in ticks */
  427. void (*f)(Alarm*, void*);
  428. void* arg;
  429. };
  430. struct Talarm
  431. {
  432. Lock;
  433. User *list;
  434. };
  435. struct Conf
  436. {
  437. ulong nmach; /* processors */
  438. ulong nproc; /* processes */
  439. ulong mem; /* total physical bytes of memory */
  440. ulong sparemem; /* memory left for check/dump and chans */
  441. ulong nalarm; /* alarms */
  442. ulong nuid; /* distinct uids */
  443. ulong nserve; /* server processes */
  444. ulong nfile; /* number of fid -- system wide */
  445. ulong nwpath; /* number of active paths, derrived from nfile */
  446. ulong gidspace; /* space for gid names -- derrived from nuid */
  447. ulong nlgmsg; /* number of large message buffers */
  448. ulong nsmmsg; /* number of small message buffers */
  449. ulong recovcw; /* recover addresses */
  450. ulong recovro;
  451. ulong firstsb;
  452. ulong recovsb;
  453. ulong nauth; /* number of Auth structs */
  454. uchar nodump; /* no periodic dumps */
  455. uchar ripoff;
  456. uchar dumpreread; /* read and compare in dump copy */
  457. short minuteswest; /* minutes west of Greenwich */
  458. short dsttime; /* dst correction */
  459. ulong npage0; /* total physical pages of memory */
  460. ulong npage1; /* total physical pages of memory */
  461. ulong base0; /* base of bank 0 */
  462. ulong base1; /* base of bank 1 */
  463. };
  464. /*
  465. * message buffers
  466. * 2 types, large and small
  467. */
  468. struct Msgbuf
  469. {
  470. short count;
  471. short flags;
  472. #define LARGE (1<<0)
  473. #define FREE (1<<1)
  474. #define BFREE (1<<2)
  475. #define BTRACE (1<<7)
  476. #define Mbrcvbuf (1<<15) /* to free, call (*free)(this) */
  477. Chan* chan;
  478. Msgbuf* next;
  479. ulong param;
  480. int category;
  481. uchar* data; /* rp or wp: current processing point */
  482. uchar* xdata; /* base of allocation */
  483. /* added for cpu kernel compatibility - geoff */
  484. void (*free)(Msgbuf *);
  485. };
  486. /*
  487. * message buffer categories
  488. */
  489. enum
  490. {
  491. Mxxx = 0,
  492. Mbreply1,
  493. Mbreply2,
  494. Mbreply3,
  495. Mbreply4,
  496. Mbarp1,
  497. Mbarp2,
  498. Mbip1,
  499. Mbip2,
  500. Mbip3,
  501. Mbil1,
  502. Mbil2,
  503. Mbil3,
  504. Mbil4,
  505. Mbilauth,
  506. Maeth1,
  507. Maeth2,
  508. Maeth3,
  509. Mbeth1,
  510. Mbeth2,
  511. Mbeth3,
  512. Mbeth4,
  513. Mbsntp,
  514. MAXCAT,
  515. };
  516. struct Mach
  517. {
  518. int machno; /* physical id of processor */
  519. int mmask; /* 1<<m->machno */
  520. ulong ticks; /* of the clock since boot time */
  521. int lights; /* light lights, this processor */
  522. User* proc; /* current process on this processor */
  523. Label sched; /* scheduler wakeup */
  524. Lock alarmlock; /* access to alarm list */
  525. void* alarm; /* alarms bound to this clock */
  526. void (*intr)(Ureg*, ulong); /* pending interrupt */
  527. User* intrp; /* process that was interrupted */
  528. ulong cause; /* arg to intr */
  529. Ureg* ureg; /* arg to intr */
  530. uchar stack[1];
  531. };
  532. #define MAXSTACK 16000
  533. #define NHAS 300
  534. struct User
  535. {
  536. Label sched;
  537. Mach* mach; /* machine running this proc */
  538. User* rnext; /* next process in run queue */
  539. User* qnext; /* next process on queue for a QLock */
  540. void (*start)(void); /* startup function */
  541. char* text; /* name of this process */
  542. void* arg;
  543. Filter time[3]; /* cpu time used */
  544. int exiting;
  545. int pid;
  546. int state;
  547. Rendez tsleep;
  548. ulong twhen;
  549. Rendez *trend;
  550. User *tlink;
  551. int (*tfn)(void*);
  552. struct
  553. {
  554. ulong pc[NHAS]; /* list of pcs for locks this process has */
  555. QLock* q[NHAS];/* list of locks this process has */
  556. QLock* want; /* lock waiting */
  557. } has;
  558. uchar stack[MAXSTACK];
  559. };
  560. #define PRINTSIZE 256
  561. struct
  562. {
  563. Lock;
  564. int machs;
  565. int exiting;
  566. } active;
  567. struct Command
  568. {
  569. char* arg0;
  570. char* help;
  571. void (*func)(int, char*[]);
  572. };
  573. struct Flag
  574. {
  575. char* arg0;
  576. char* help;
  577. ulong flag;
  578. };
  579. struct Tm
  580. {
  581. /* see ctime(3) */
  582. int sec;
  583. int min;
  584. int hour;
  585. int mday;
  586. int mon;
  587. int year;
  588. int wday;
  589. int yday;
  590. int isdst;
  591. };
  592. struct Rtc
  593. {
  594. int sec;
  595. int min;
  596. int hour;
  597. int mday;
  598. int mon;
  599. int year;
  600. };
  601. /*
  602. * cw device
  603. */
  604. /* DONT TOUCH, this is the disk structure */
  605. struct Cache
  606. {
  607. long maddr; /* cache map addr */
  608. long msize; /* cache map size in buckets */
  609. long caddr; /* cache addr */
  610. long csize; /* cache size */
  611. long fsize; /* current size of worm */
  612. long wsize; /* max size of the worm */
  613. long wmax; /* highwater write */
  614. long sbaddr; /* super block addr */
  615. long cwraddr; /* cw root addr */
  616. long roraddr; /* dump root addr */
  617. long toytime; /* somewhere convienent */
  618. long time;
  619. };
  620. /* DONT TOUCH, this is the disk structure */
  621. struct Centry
  622. {
  623. ushort age;
  624. short state;
  625. long waddr; /* worm addr */
  626. };
  627. /* DONT TOUCH, this is the disk structure */
  628. struct Bucket
  629. {
  630. long agegen; /* generator for ages in this bkt */
  631. Centry entry[CEPERBK];
  632. };
  633. /*
  634. * scsi i/o
  635. */
  636. enum
  637. {
  638. SCSIread = 0,
  639. SCSIwrite = 1,
  640. };
  641. /*
  642. * Process states
  643. */
  644. enum
  645. {
  646. Dead = 0,
  647. Moribund,
  648. Zombie,
  649. Ready,
  650. Scheding,
  651. Running,
  652. Queueing,
  653. Sending,
  654. Recving,
  655. MMUing,
  656. Exiting,
  657. Inwait,
  658. Wakeme,
  659. Broken,
  660. };
  661. /*
  662. * Lights
  663. */
  664. enum
  665. {
  666. Lreal = 0, /* blink in clock interrupt */
  667. Lintr, /* on while in interrupt */
  668. Lpanic, /* in panic */
  669. Lcwmap, /* in cw lookup */
  670. };
  671. /*
  672. * devnone block numbers
  673. */
  674. enum
  675. {
  676. Cwio1 = 1,
  677. Cwio2,
  678. Cwxx1,
  679. Cwxx2,
  680. Cwxx3,
  681. Cwxx4,
  682. Cwdump1,
  683. Cwdump2,
  684. Cuidbuf,
  685. Cckbuf,
  686. };
  687. /*
  688. * error codes generated from the file server
  689. */
  690. enum
  691. {
  692. Ebadspc = 1,
  693. Efid,
  694. Echar,
  695. Eopen,
  696. Ecount,
  697. Ealloc,
  698. Eqid,
  699. Eaccess,
  700. Eentry,
  701. Emode,
  702. Edir1,
  703. Edir2,
  704. Ephase,
  705. Eexist,
  706. Edot,
  707. Eempty,
  708. Ebadu,
  709. Enoattach,
  710. Ewstatb,
  711. Ewstatd,
  712. Ewstatg,
  713. Ewstatl,
  714. Ewstatm,
  715. Ewstato,
  716. Ewstatp,
  717. Ewstatq,
  718. Ewstatu,
  719. Ewstatv,
  720. Ename,
  721. Ewalk,
  722. Eronly,
  723. Efull,
  724. Eoffset,
  725. Elocked,
  726. Ebroken,
  727. Eauth,
  728. Eauth2,
  729. Efidinuse,
  730. Etoolong,
  731. Econvert,
  732. Eversion,
  733. Eauthdisabled,
  734. Eauthnone,
  735. Eauthfile,
  736. Eedge,
  737. MAXERR
  738. };
  739. /*
  740. * device types
  741. */
  742. enum
  743. {
  744. Devnone = 0,
  745. Devcon, /* console */
  746. Devwren, /* scsi disk drive */
  747. Devworm, /* scsi video drive */
  748. Devlworm, /* scsi video drive (labeled) */
  749. Devfworm, /* fake read-only device */
  750. Devjuke, /* jukebox */
  751. Devcw, /* cache with worm */
  752. Devro, /* readonly worm */
  753. Devmcat, /* multiple cat devices */
  754. Devmlev, /* multiple interleave devices */
  755. Devil, /* internet link */
  756. Devpart, /* partition */
  757. Devfloppy, /* floppy drive */
  758. Devide, /* IDE drive */
  759. Devswab, /* swab data between mem and device */
  760. Devmirr, /* mirror devices */
  761. MAXDEV
  762. };
  763. /*
  764. * tags on block
  765. */
  766. /* DONT TOUCH, this is in disk structures */
  767. enum
  768. {
  769. Tnone = 0,
  770. Tsuper, /* the super block */
  771. Tdir, /* directory contents */
  772. Tind1, /* points to blocks */
  773. Tind2, /* points to Tind1 */
  774. Tfile, /* file contents */
  775. Tfree, /* in free list */
  776. Tbuck, /* cache fs bucket */
  777. Tvirgo, /* fake worm virgin bits */
  778. Tcache, /* cw cache things */
  779. Tconfig, /* configuration block */
  780. MAXTAG
  781. };
  782. /*
  783. * flags to getbuf
  784. */
  785. enum
  786. {
  787. Bread = (1<<0), /* read the block if miss */
  788. Bprobe = (1<<1), /* return null if miss */
  789. Bmod = (1<<2), /* buffer is dirty, needs writing */
  790. Bimm = (1<<3), /* write immediately on putbuf */
  791. Bres = (1<<4), /* reserved, never renammed */
  792. };
  793. extern register Mach* m;
  794. extern register User* u;
  795. extern Talarm talarm;
  796. Conf conf;
  797. Cons cons;
  798. #define MACHP(n) ((Mach*)(MACHADDR+n*BY2PG))
  799. #pragma varargck type "Z" Device*
  800. #pragma varargck type "T" ulong
  801. #pragma varargck type "I" uchar*
  802. #pragma varargck type "E" uchar*
  803. #pragma varargck type "W" Filter*
  804. #pragma varargck type "G" int
  805. extern int (*fsprotocol[])(Msgbuf*);