URI:
       topen.c - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       topen.c (563B)
       ---
            1 #include <u.h>
            2 #include <libc.h>
            3 #include <fcall.h>
            4 #include <9pclient.h>
            5 #include "fsimpl.h"
            6 
            7 int
            8 fsfopen(CFid *fid, int mode)
            9 {
           10         Fcall tx, rx;
           11 
           12         tx.type = Topen;
           13         tx.fid = fid->fid;
           14         tx.mode = mode;
           15         if(_fsrpc(fid->fs, &tx, &rx, 0) < 0)
           16                 return -1;
           17         fid->mode = mode;
           18         return 0;
           19 }
           20 
           21 CFid*
           22 fsopen(CFsys *fs, char *name, int mode)
           23 {
           24         char e[ERRMAX];
           25         CFid *fid;
           26 
           27         if((fid = fswalk(fs->root, name)) == nil)
           28                 return nil;
           29         if(fsfopen(fid, mode) < 0){
           30                 rerrstr(e, sizeof e);
           31                 fsclose(fid);
           32                 errstr(e, sizeof e);
           33                 return nil;
           34         }
           35         fid->mode = mode;
           36         return fid;
           37 }