p9todir.c (1086B)
1 #include <os9/os9.h> 2 3 #include <errno.h> 4 5 #include <deserialize.h> 6 #include <libk.h> 7 8 int 9 p9todir(Dir *dp, unsigned char *buf, int size) 10 { 11 int n, len, type; 12 long l, vers; 13 unsigned long long path; 14 15 n = 0; 16 SHORT(len, buf, n, size); /* len */ 17 SHORT(dp->type, buf, n, size); /* type */ 18 LONG(dp->dev, buf, n, size); /* dev */ 19 CHAR(type, buf, n, size); /* qid.type */ 20 LONG(vers, buf, n, size); /* qid.vers */ 21 LLONG(path, buf, n, size); /* qid.path */ 22 LONG(l, buf, n, size); /* mode */ 23 LONG(l, buf, n, size); /* atime */ 24 LONG(l, buf, n, size); /* mtime */ 25 LLONG(dp->length, buf, n, size); /* length */ 26 STRING(NULL, USERLEN, buf, n, size); /* uid */ 27 STRING(NULL, USERLEN, buf, n, size); /* gid */ 28 STRING(NULL, USERLEN, buf, n, size); /* muid */ 29 STRING(dp->name, NAMELEN, buf, n, size); /* name */ 30 USED(l); 31 32 if (len != n) { 33 errno = EINVAL; 34 return -1; 35 } 36 dp->qid = QID(type, vers, path); 37 38 return n; 39 }