1 #pragma lib "libc.a" 2 3 typedef 4 struct Fcall 5 { 6 char type; 7 short fid; 8 ushort tag; 9 union { 10 struct { 11 ushort oldtag; /* Tflush */ 12 Qid qid; /* Rattach, Rwalk, Ropen, Rcreate */ 13 char rauth[AUTHENTLEN]; /* Rattach */ 14 }; 15 struct { 16 char uname[NAMELEN]; /* Tattach */ 17 char aname[NAMELEN]; /* Tattach */ 18 char ticket[TICKETLEN]; /* Tattach */ 19 char auth[AUTHENTLEN]; /* Tattach */ 20 }; 21 struct { 22 char ename[ERRLEN]; /* Rerror */ 23 char authid[NAMELEN]; /* Rsession */ 24 char authdom[DOMLEN]; /* Rsession */ 25 char chal[CHALLEN]; /* Tsession/Rsession */ 26 }; 27 struct { 28 long perm; /* Tcreate */ 29 short newfid; /* Tclone, Tclwalk */ 30 char name[NAMELEN]; /* Twalk, Tclwalk, Tcreate */ 31 char mode; /* Tcreate, Topen */ 32 }; 33 struct { 34 long offset; /* Tread, Twrite */ 35 long count; /* Tread, Twrite, Rread */ 36 char *data; /* Twrite, Rread */ 37 }; 38 struct { 39 char stat[DIRLEN]; /* Twstat, Rstat */ 40 }; 41 }; 42 } Fcall; 43 44 #define MAXFDATA 8192 45 #define MAXMSG 160 /* max header sans data */ 46 #define NOTAG 0xFFFF /* Dummy tag */ 47 48 enum 49 { 50 Tnop = 50, 51 Rnop, 52 Tosession = 52, /* illegal */ 53 Rosession, /* illegal */ 54 Terror = 54, /* illegal */ 55 Rerror, 56 Tflush = 56, 57 Rflush, 58 Toattach = 58, /* illegal */ 59 Roattach, /* illegal */ 60 Tclone = 60, 61 Rclone, 62 Twalk = 62, 63 Rwalk, 64 Topen = 64, 65 Ropen, 66 Tcreate = 66, 67 Rcreate, 68 Tread = 68, 69 Rread, 70 Twrite = 70, 71 Rwrite, 72 Tclunk = 72, 73 Rclunk, 74 Tremove = 74, 75 Rremove, 76 Tstat = 76, 77 Rstat, 78 Twstat = 78, 79 Rwstat, 80 Tclwalk = 80, 81 Rclwalk, 82 Tauth = 82, /* illegal */ 83 Rauth, /* illegal */ 84 Tsession = 84, 85 Rsession, 86 Tattach = 86, 87 Rattach, 88 }; 89 90 int convM2S(char*, Fcall*, int); 91 int convS2M(Fcall*, char*); 92 93 int convM2D(char*, Dir*); 94 int convD2M(Dir*, char*); 95 96 int fcallconv(void *, Fconv*); 97 int dirconv(void *, Fconv*); 98 int dirmodeconv(void *, Fconv*); 99 100 char* getS(int, char*, Fcall*, long*); 101 102