1 typedef struct Iobuf Iobuf; 2 typedef struct Xdata Xdata; 3 typedef struct Xfile Xfile; 4 typedef struct Xfs Xfs; 5 typedef struct Xfsub Xfsub; 6 7 enum 8 { 9 Sectorsize = 2048 10 }; 11 12 struct Iobuf 13 { 14 Xdata* dev; 15 long addr; 16 Iobuf* next; 17 Iobuf* prev; 18 Iobuf* hash; 19 int busy; 20 uchar* iobuf; 21 }; 22 23 struct Xdata 24 { 25 Xdata* next; 26 char* name; /* of underlying file */ 27 Qid qid; 28 short type; 29 short fdev; 30 int ref; /* attach count */ 31 int dev; /* for read/write */ 32 }; 33 34 struct Xfsub 35 { 36 void (*reset)(void); 37 int (*attach)(Xfile*); 38 void (*clone)(Xfile*, Xfile*); 39 void (*walkup)(Xfile*); 40 void (*walk)(Xfile*, char*); 41 void (*open)(Xfile*, int); 42 void (*create)(Xfile*, char*, long, int); 43 long (*readdir)(Xfile*, void*, long, long); 44 long (*read)(Xfile*, void*, long, long); 45 long (*write)(Xfile*, void*, long, long); 46 void (*clunk)(Xfile*); 47 void (*remove)(Xfile*); 48 void (*stat)(Xfile*, Dir*); 49 void (*wstat)(Xfile*, Dir*); 50 }; 51 52 struct Xfs 53 { 54 Xdata* d; /* how to get the bits */ 55 Xfsub* s; /* how to use them */ 56 int ref; 57 int isplan9; /* has Plan 9-specific directory info */ 58 Qid rootqid; 59 void* ptr; /* private data */ 60 }; 61 62 struct Xfile 63 { 64 Xfile* next; /* in fid hash bucket */ 65 Xfs* xf; 66 long fid; 67 ulong flags; 68 Qid qid; 69 int len; /* of private data */ 70 void* ptr; 71 }; 72 73 enum 74 { 75 Asis, 76 Clean, 77 Clunk 78 }; 79 80 enum 81 { 82 Oread = 1, 83 Owrite = 2, 84 Orclose = 4, 85 Omodes = 3, 86 }; 87 88 extern char Enonexist[]; /* file does not exist */ 89 extern char Eperm[]; /* permission denied */ 90 extern char Enofile[]; /* no file system specified */ 91 extern char Eauth[]; /* authentication failed */ 92 93 extern char *srvname; 94 extern char *deffile; 95 extern int chatty; 96 extern jmp_buf err_lab[]; 97 extern int nerr_lab; 98 extern char err_msg[]; 99