7 * routines to package the old protocol in the new structures.
10 #define SHORT(x) p[0]=f->x; p[1]=f->x>>8; p += 2
11 #define LONG(x) p[0]=f->x; p[1]=f->x>>8; p[2]=f->x>>16; p[3]=f->x>>24; p += 4
12 #define VLONG(x) p[0]=f->x; p[1]=f->x>>8;\
13 p[2]=f->x>>16; p[3]=f->x>>24;\
14 p[4]=f->x>>32; p[5]=f->x>>40;\
15 p[6]=f->x>>48; p[7]=f->x>>56;\
17 #define STRING(x,n) strecpy((char*)p, (char*)p+n, f->x); p += n;
18 #define FIXQID(q) q.path ^= (q.path>>33); q.path &= 0x7FFFFFFF; q.path |= (q.type&0x80)<<24
21 oldhdrsize(uchar type)
53 return 3+2+28+28+72+13;
62 return p[3+2+8] | (p[3+2+8+1]<<8);
94 return 1+2+8+28+48; /* session */
97 /* assumes we don't ever see Tclwalk requests ... */
111 return 1+2+2+2+1+f->count;
131 convS2Mold(Fcall *f, uchar *ap, uint nap)
161 memmove(p, f->chal, f->nchal);
164 memset(p, 0, 8 - f->nchal);
195 memset(p, 0, 8+28+48);
203 /* assumes we don't ever see Tclwalk requests ... */
205 if(f->nwqid == 0){ /* successful clone */
209 }else{ /* successful 1-element walk */
243 memmove(p, f->data, f->count);
270 memmove(p, f->stat, 116);
290 convD2Mold(Dir *f, uchar *ap, uint nap)
318 #define CHAR(x) f->x = *p++
319 #define SHORT(x) f->x = (p[0] | (p[1]<<8)); p += 2
320 #define LONG(x) f->x = (p[0] | (p[1]<<8) |\
321 (p[2]<<16) | (p[3]<<24)); p += 4
322 #define VLONG(x) f->x = (ulong)(p[0] | (p[1]<<8) |\
323 (p[2]<<16) | (p[3]<<24)) |\
324 ((vlong)(p[4] | (p[5]<<8) |\
325 (p[6]<<16) | (p[7]<<24)) << 32); p += 8
326 #define STRING(x,n) f->x = (char*)p; p += n
329 convM2Sold(uchar *ap, uint nap, Fcall *f)
373 f->wname[0] = (char*)p;
456 memset(q, 0xFF, 8); /* clear length to ``don't care'' */
482 if(p+2+28+28+72+13 > ep)
499 convM2Dold(uchar *ap, uint nap, Dir *f, char *strs)
520 f->qid.type = (f->mode>>24)&0xF0;
521 return p - (uchar*)ap;