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) ((p)[0])
65 #define GBIT16(p) ((p)[0]|((p)[1]<<8))
66 #define GBIT32(p) ((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24))
67 #define GBIT64(p) ((u32int)((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24)) |\
68 ((vlong)((p)[4]|((p)[5]<<8)|((p)[6]<<16)|((p)[7]<<24)) << 32))
70 #define PBIT8(p,v) (p)[0]=(v)
71 #define PBIT16(p,v) (p)[0]=(v);(p)[1]=(v)>>8
72 #define PBIT32(p,v) (p)[0]=(v);(p)[1]=(v)>>8;(p)[2]=(v)>>16;(p)[3]=(v)>>24
73 #define PBIT64(p,v) (p)[0]=(v);(p)[1]=(v)>>8;(p)[2]=(v)>>16;(p)[3]=(v)>>24;\
74 (p)[4]=(v)>>32;(p)[5]=(v)>>40;(p)[6]=(v)>>48;(p)[7]=(v)>>56
80 #define QIDSZ (BIT8SZ+BIT32SZ+BIT64SZ)
82 /* STATFIXLEN includes leading 16-bit count */
83 /* The count, however, excludes itself; total size is BIT16SZ+count */
84 #define STATFIXLEN (BIT16SZ+QIDSZ+5*BIT16SZ+4*BIT32SZ+1*BIT64SZ) /* amount of fixed length data in a stat buffer */
86 #define NOTAG (ushort)~0U /* Dummy tag */
87 #define NOFID (u32int)~0U /* Dummy fid */
88 #define IOHDRSZ 24 /* ample room for Twrite/Rread header (iounit) */
98 Terror = 106, /* illegal */
123 uint convM2S(uchar*, uint, Fcall*);
124 uint convS2M(Fcall*, uchar*, uint);
125 uint sizeS2M(Fcall*);
127 int statcheck(uchar *abuf, uint nbuf);
128 uint convM2D(uchar*, uint, Dir*, char*);
129 uint convD2M(Dir*, uchar*, uint);
134 int dirmodefmt(Fmt*);
136 int read9pmsg(int, void*, uint);
138 #pragma varargck type "F" Fcall*
139 #pragma varargck type "M" ulong
140 #pragma varargck type "D" Dir*