wstat.c (741B)
1 /* Copyright (C) 2003 Russ Cox, Massachusetts Institute of Technology */ 2 /* See COPYRIGHT */ 3 4 #include <u.h> 5 #include <libc.h> 6 #include <fcall.h> 7 #include <9pclient.h> 8 #include "fsimpl.h" 9 10 int 11 fsdirwstat(CFsys *fs, char *name, Dir *d) 12 { 13 int n; 14 CFid *fid; 15 16 if((fid = fswalk(fs->root, name)) == nil) 17 return -1; 18 19 n = fsdirfwstat(fid, d); 20 fsclose(fid); 21 return n; 22 } 23 24 int 25 fsdirfwstat(CFid *fid, Dir *d) 26 { 27 uchar *a; 28 int n, nn; 29 Fcall tx, rx; 30 31 n = sizeD2M(d); 32 a = malloc(n); 33 if(a == nil) 34 return -1; 35 nn = convD2M(d, a, n); 36 if(n != nn){ 37 werrstr("convD2M and sizeD2M disagree"); 38 free(a); 39 return -1; 40 } 41 42 tx.type = Twstat; 43 tx.fid = fid->fid; 44 tx.stat = a; 45 tx.nstat = n; 46 n = _fsrpc(fid->fs, &tx, &rx, 0); 47 free(a); 48 return n; 49 }