summaryrefslogtreecommitdiffstats
path: root/src/lib9pclient/open.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-07-23 02:55:34 +0000
committerrsc <devnull@localhost>2006-07-23 02:55:34 +0000
commit73a5509ae929e41ca0047254a880c8efd4aa72a1 (patch)
treef3e313e86f79c9f5bae32f529548d6e805210eea /src/lib9pclient/open.c
parent9b3357a896417eb166cf94dd2a04aa391fef21c8 (diff)
downloadplan9port-73a5509ae929e41ca0047254a880c8efd4aa72a1.tar.gz
plan9port-73a5509ae929e41ca0047254a880c8efd4aa72a1.zip
more functions
Diffstat (limited to 'src/lib9pclient/open.c')
-rw-r--r--src/lib9pclient/open.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/lib9pclient/open.c b/src/lib9pclient/open.c
index 2317bbb7..2e8e343c 100644
--- a/src/lib9pclient/open.c
+++ b/src/lib9pclient/open.c
@@ -4,19 +4,29 @@
#include <9pclient.h>
#include "fsimpl.h"
+int
+fsfopen(CFid *fid, int mode)
+{
+ Fcall tx, rx;
+
+ tx.type = Topen;
+ tx.fid = fid->fid;
+ tx.mode = mode;
+ if(_fsrpc(fid->fs, &tx, &rx, 0) < 0)
+ return -1;
+ fid->mode = mode;
+ return 0;
+}
+
CFid*
fsopen(CFsys *fs, char *name, int mode)
{
char e[ERRMAX];
CFid *fid;
- Fcall tx, rx;
- if((fid = _fswalk(fs->root, name)) == nil)
+ if((fid = fswalk(fs->root, name)) == nil)
return nil;
- tx.type = Topen;
- tx.fid = fid->fid;
- tx.mode = mode;
- if(_fsrpc(fs, &tx, &rx, 0) < 0){
+ if(fsfopen(fid, mode) < 0){
rerrstr(e, sizeof e);
fsclose(fid);
errstr(e, sizeof e);