2 #pragma src "/sys/src/libc/9sys"
6 #define VERSION9P "9P2000"
16 u32int msize; /* Tversion, Rversion */
17 char *version; /* Tversion, Rversion */
18 ushort oldtag; /* Tflush */
19 char *ename; /* Rerror */
20 Qid qid; /* Rattach, Ropen, Rcreate */
21 u32int iounit; /* Ropen, Rcreate */
23 u32int afid; /* Tauth, Tattach */
24 char *uname; /* Tauth, Tattach */
25 char *aname; /* Tauth, Tattach */
26 u32int perm; /* Tcreate */
27 char *name; /* Tcreate */
28 uchar mode; /* Tcreate, Topen */
29 u32int newfid; /* Twalk */
30 ushort nwname; /* Twalk */
31 char *wname[MAXWELEM]; /* Twalk */
32 ushort nwqid; /* Rwalk */
33 Qid wqid[MAXWELEM]; /* Rwalk */
34 vlong offset; /* Tread, Twrite */
35 u32int count; /* Tread, Twrite, Rread */
36 char *data; /* Twrite, Rread */
37 ushort nstat; /* Twstat, Rstat */
38 uchar *stat; /* Twstat, Rstat */
42 #define GBIT8(p) ((p)[0])
43 #define GBIT16(p) ((p)[0]|((p)[1]<<8))
44 #define GBIT32(p) ((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24))
45 #define GBIT64(p) ((vlong)((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24)) |\
46 ((vlong)((p)[4]|((p)[5]<<8)|((p)[6]<<16)|((p)[7]<<24)) << 32))
48 #define PBIT8(p,v) (p)[0]=(v)
49 #define PBIT16(p,v) (p)[0]=(v);(p)[1]=(v)>>8
50 #define PBIT32(p,v) (p)[0]=(v);(p)[1]=(v)>>8;(p)[2]=(v)>>16;(p)[3]=(v)>>24
51 #define PBIT64(p,v) (p)[0]=(v);(p)[1]=(v)>>8;(p)[2]=(v)>>16;(p)[3]=(v)>>24;\
52 (p)[4]=(v)>>32;(p)[5]=(v)>>40;(p)[6]=(v)>>48;(p)[7]=(v)>>56
58 #define QIDSZ (BIT8SZ+BIT32SZ+BIT64SZ)
60 /* STATFIXLEN includes leading 16-bit count */
61 /* The count, however, excludes itself; total size is BIT16SZ+count */
62 #define STATFIXLEN (BIT16SZ+QIDSZ+5*BIT16SZ+4*BIT32SZ+1*BIT64SZ) /* amount of fixed length data in a stat buffer */
64 #define NOTAG (ushort)~0U /* Dummy tag */
65 #define NOFID (u32int)~0U /* Dummy fid */
66 #define IOHDRSZ 24 /* ample room for Twrite/Rread header (iounit) */
76 Terror = 106, /* illegal */
101 uint convM2S(uchar*, uint, Fcall*);
102 uint convS2M(Fcall*, uchar*, uint);
103 uint sizeS2M(Fcall*);
105 int statcheck(uchar *abuf, uint nbuf);
106 uint convM2D(uchar*, uint, Dir*, char*);
107 uint convD2M(Dir*, uchar*, uint);
112 int dirmodefmt(Fmt*);
114 int read9pmsg(int, void*, uint);
117 #pragma varargck type "F" Fcall*
118 #pragma varargck type "M" ulong
119 #pragma varargck type "D" Dir*