Blob
1 #include <u.h>2 #include <libc.h>3 #include <fcall.h>4 #include <9pclient.h>5 #include "fsimpl.h"7 CFid*8 fsopen(CFsys *fs, char *name, int mode)9 {10 char e[ERRMAX];11 CFid *fid;12 Fcall tx, rx;14 if((fid = _fswalk(fs->root, name)) == nil)15 return nil;16 tx.type = Topen;17 tx.fid = fid->fid;18 tx.mode = mode;19 if(_fsrpc(fs, &tx, &rx, 0) < 0){20 rerrstr(e, sizeof e);21 fsclose(fid);22 errstr(e, sizeof e);23 return nil;24 }25 fid->mode = mode;26 return fid;27 }