1 #include <u.h> 2 #include <libc.h> 3 #include <auth.h> 4 #include <fcall.h> 5 6 #define CHAR(x) f->x = *p++ 7 #define SHORT(x) f->x = (p[0] | (p[1]<<8)); p += 2 8 #define LONG(x) f->x = (p[0] | (p[1]<<8) |\ 9 (p[2]<<16) | (p[3]<<24)); p += 4 10 #define VLONG(x) f->x = (p[0] | (p[1]<<8) |\ 11 (p[2]<<16) | (p[3]<<24)); p += 8 12 #define STRING(x,n) memmove(f->x, p, n); p += n 13 14 int 15 convM2D(char *ap, Dir *f) 16 { 17 uchar *p; 18 19 p = (uchar*)ap; 20 STRING(name, sizeof(f->name)); 21 STRING(uid, sizeof(f->uid)); 22 STRING(gid, sizeof(f->gid)); 23 LONG(qid.path); 24 LONG(qid.vers); 25 LONG(mode); 26 LONG(atime); 27 LONG(mtime); 28 VLONG(length); 29 SHORT(type); 30 SHORT(dev); 31 return p - (uchar*)ap; 32 } 33