1 #pragma src "/sys/src/libc/9sys"
4 #define VERSION9P "9P2000"
16 u32int msize; /* Tversion, Rversion */
17 char *version; /* Tversion, Rversion */
20 ushort oldtag; /* Tflush */
23 char *ename; /* Rerror */
26 Qid qid; /* Rattach, Ropen, Rcreate */
27 u32int iounit; /* Ropen, Rcreate */
33 u32int afid; /* Tauth, Tattach */
34 char *uname; /* Tauth, Tattach */
35 char *aname; /* Tauth, Tattach */
38 u32int perm; /* Tcreate */
39 char *name; /* Tcreate */
40 uchar mode; /* Tcreate, Topen */
43 u32int newfid; /* Twalk */
44 ushort nwname; /* Twalk */
45 char *wname[MAXWELEM]; /* Twalk */
48 ushort nwqid; /* Rwalk */
49 Qid wqid[MAXWELEM]; /* Rwalk */
52 vlong offset; /* Tread, Twrite */
53 u32int count; /* Tread, Twrite, Rread */
54 char *data; /* Twrite, Rread */
57 ushort nstat; /* Twstat, Rstat */
58 uchar *stat; /* Twstat, Rstat */
64 #define GBIT8(p) (((uchar*)(p))[0])
65 #define GBIT16(p) (((uchar*)(p))[0]|(((uchar*)(p))[1]<<8))
66 #define GBIT32(p) (((uchar*)(p))[0]|(((uchar*)(p))[1]<<8)|\
67 (((uchar*)(p))[2]<<16)|(((uchar*)(p))[3]<<24))
68 #define GBIT64(p) ((u32int)(((uchar*)(p))[0]|(((uchar*)(p))[1]<<8)|\
69 (((uchar*)(p))[2]<<16)|(((uchar*)(p))[3]<<24)) |\
70 ((uvlong)(((uchar*)(p))[4]|(((uchar*)(p))[5]<<8)|\
71 (((uchar*)(p))[6]<<16)|(((uchar*)(p))[7]<<24)) << 32))
73 #define PBIT8(p,v) do{(p)[0]=(v);}while(0)
74 #define PBIT16(p,v) do{(p)[0]=(v);(p)[1]=(v)>>8;}while(0)
75 #define PBIT32(p,v) do{(p)[0]=(v);(p)[1]=(v)>>8;(p)[2]=(v)>>16;(p)[3]=(v)>>24;}while(0)
76 #define PBIT64(p,v) do{(p)[0]=(v);(p)[1]=(v)>>8;(p)[2]=(v)>>16;(p)[3]=(v)>>24;\
77 (p)[4]=(v)>>32;(p)[5]=(v)>>40;(p)[6]=(v)>>48;(p)[7]=(v)>>56;}while(0)
83 #define QIDSZ (BIT8SZ+BIT32SZ+BIT64SZ)
85 /* STATFIXLEN includes leading 16-bit count */
86 /* The count, however, excludes itself; total size is BIT16SZ+count */
87 #define STATFIXLEN (BIT16SZ+QIDSZ+5*BIT16SZ+4*BIT32SZ+1*BIT64SZ) /* amount of fixed length data in a stat buffer */
89 #define NOTAG (ushort)~0U /* Dummy tag */
90 #define NOFID (u32int)~0U /* Dummy fid */
91 #define IOHDRSZ 24 /* ample room for Twrite/Rread header (iounit) */
101 Terror = 106, /* illegal */
126 uint convM2S(uchar*, uint, Fcall*);
127 uint convS2M(Fcall*, uchar*, uint);
128 uint sizeS2M(Fcall*);
130 int statcheck(uchar *abuf, uint nbuf);
131 uint convM2D(uchar*, uint, Dir*, char*);
132 uint convD2M(Dir*, uchar*, uint);
137 int dirmodefmt(Fmt*);
139 int read9pmsg(int, void*, uint);
141 #pragma varargck type "F" Fcall*
142 #pragma varargck type "M" ulong
143 #pragma varargck type "D" Dir*