Blob


1 typedef struct Ioclust Ioclust;
2 typedef struct Iobuf Iobuf;
3 typedef struct Isofile Isofile;
4 typedef struct Xdata Xdata;
5 typedef struct Xfile Xfile;
6 typedef struct Xfs Xfs;
7 typedef struct Xfsub Xfsub;
9 #pragma incomplete Isofile
11 enum
12 {
13 Sectorsize = 2048,
14 Maxname = 256,
15 };
17 struct Iobuf
18 {
19 Ioclust* clust;
20 long addr;
21 uchar* iobuf;
22 };
24 struct Ioclust
25 {
26 long addr; /* in sectors; good to 8TB */
27 Xdata* dev;
28 Ioclust* next;
29 Ioclust* prev;
30 int busy;
31 int nbuf;
32 Iobuf* buf;
33 uchar* iobuf;
34 };
36 struct Xdata
37 {
38 Xdata* next;
39 char* name; /* of underlying file */
40 Qid qid;
41 short type;
42 short fdev;
43 int ref; /* attach count */
44 int dev; /* for read/write */
45 };
47 struct Xfsub
48 {
49 void (*reset)(void);
50 int (*attach)(Xfile*);
51 void (*clone)(Xfile*, Xfile*);
52 void (*walkup)(Xfile*);
53 void (*walk)(Xfile*, char*);
54 void (*open)(Xfile*, int);
55 void (*create)(Xfile*, char*, long, int);
56 long (*readdir)(Xfile*, uchar*, long, long);
57 long (*read)(Xfile*, char*, vlong, long);
58 long (*write)(Xfile*, char*, vlong, long);
59 void (*clunk)(Xfile*);
60 void (*remove)(Xfile*);
61 void (*stat)(Xfile*, Dir*);
62 void (*wstat)(Xfile*, Dir*);
63 };
65 struct Xfs
66 {
67 Xdata* d; /* how to get the bits */
68 Xfsub* s; /* how to use them */
69 int ref;
70 int issusp; /* follows system use sharing protocol */
71 long suspoff; /* if so, offset at which SUSP area begins */
72 int isrock; /* Rock Ridge format */
73 int isplan9; /* has Plan 9-specific directory info */
74 Qid rootqid;
75 Isofile* ptr; /* private data */
76 };
78 struct Xfile
79 {
80 Xfile* next; /* in fid hash bucket */
81 Xfs* xf;
82 long fid;
83 ulong flags;
84 Qid qid;
85 int len; /* of private data */
86 Isofile* ptr;
87 };
89 enum
90 {
91 Asis,
92 Clean,
93 Clunk
94 };
96 enum
97 {
98 Oread = 1,
99 Owrite = 2,
100 Orclose = 4,
101 Omodes = 3,
102 };
104 extern char Enonexist[]; /* file does not exist */
105 extern char Eperm[]; /* permission denied */
106 extern char Enofile[]; /* no file system specified */
107 extern char Eauth[]; /* authentication failed */
109 extern char *srvname;
110 extern char *deffile;
111 extern int chatty;
112 extern jmp_buf err_lab[];
113 extern int nerr_lab;
114 extern char err_msg[];
116 extern int nojoliet;
117 extern int noplan9;
118 extern int norock;