7 #pragma src "/sys/src/libc/9sys"
11 #define VERSION9P "9P2000"
20 u32int msize; /* Tversion, Rversion */
21 char *version; /* Tversion, Rversion */
22 ushort oldtag; /* Tflush */
23 char *ename; /* Rerror */
24 Qid qid; /* Rattach, Ropen, Rcreate */
25 u32int iounit; /* Ropen, Rcreate */
27 u32int afid; /* Tauth, Tattach */
28 char *uname; /* Tauth, Tattach */
29 char *aname; /* Tauth, Tattach */
30 u32int perm; /* Tcreate */
31 char *name; /* Tcreate */
32 uchar mode; /* Tcreate, Topen */
33 u32int newfid; /* Twalk */
34 ushort nwname; /* Twalk */
35 char *wname[MAXWELEM]; /* Twalk */
36 ushort nwqid; /* Rwalk */
37 Qid wqid[MAXWELEM]; /* Rwalk */
38 vlong offset; /* Tread, Twrite */
39 u32int count; /* Tread, Twrite, Rread */
40 char *data; /* Twrite, Rread */
41 ushort nstat; /* Twstat, Rstat */
42 uchar *stat; /* Twstat, Rstat */
43 int unixfd; /* Ropenfd */
47 #define GBIT8(p) ((p)[0])
48 #define GBIT16(p) ((p)[0]|((p)[1]<<8))
49 #define GBIT32(p) ((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24))
50 #define GBIT64(p) ((vlong)((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24)) |\
51 ((vlong)((p)[4]|((p)[5]<<8)|((p)[6]<<16)|((p)[7]<<24)) << 32))
53 #define PBIT8(p,v) (p)[0]=(v)
54 #define PBIT16(p,v) (p)[0]=(v);(p)[1]=(v)>>8
55 #define PBIT32(p,v) (p)[0]=(v);(p)[1]=(v)>>8;(p)[2]=(v)>>16;(p)[3]=(v)>>24
56 #define PBIT64(p,v) (p)[0]=(v);(p)[1]=(v)>>8;(p)[2]=(v)>>16;(p)[3]=(v)>>24;\
57 (p)[4]=(v)>>32;(p)[5]=(v)>>40;(p)[6]=(v)>>48;(p)[7]=(v)>>56
63 #define QIDSZ (BIT8SZ+BIT32SZ+BIT64SZ)
65 /* STATFIXLEN includes leading 16-bit count */
66 /* The count, however, excludes itself; total size is BIT16SZ+count */
67 #define STATFIXLEN (BIT16SZ+QIDSZ+5*BIT16SZ+4*BIT32SZ+1*BIT64SZ) /* amount of fixed length data in a stat buffer */
69 #define NOTAG (ushort)~0U /* Dummy tag */
70 #define NOFID (u32int)~0U /* Dummy fid */
71 #define IOHDRSZ 24 /* ample room for Twrite/Rread header (iounit) */
81 Terror = 106, /* illegal */
109 uint convM2S(uchar*, uint, Fcall*);
110 uint convS2M(Fcall*, uchar*, uint);
111 uint sizeS2M(Fcall*);
113 int statcheck(uchar *abuf, uint nbuf);
114 uint convM2D(uchar*, uint, Dir*, char*);
115 uint convD2M(Dir*, uchar*, uint);
120 int dirmodefmt(Fmt*);
122 int read9pmsg(int, void*, uint);
125 #pragma varargck type "F" Fcall*
126 #pragma varargck type "M" ulong
127 #pragma varargck type "D" Dir*