plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

close.c (604B)


      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 static void
     11 fidclunk(CFid *fid)
     12 {
     13 	Fcall tx, rx;
     14 
     15 	tx.type = Tclunk;
     16 	tx.fid = fid->fid;
     17 	_fsrpc(fid->fs, &tx, &rx, 0);
     18 	_fsputfid(fid);
     19 }
     20 
     21 void
     22 fsclose(CFid *fid)
     23 {
     24 	if(fid == nil)
     25 		return;
     26 
     27 	/* maybe someday there will be a ref count */
     28 	fidclunk(fid);
     29 }
     30 
     31 int
     32 fsfremove(CFid *fid)
     33 {
     34 	int n;
     35 	Fcall tx, rx;
     36 
     37 	tx.type = Tremove;
     38 	tx.fid = fid->fid;
     39 	n = _fsrpc(fid->fs, &tx, &rx, 0);
     40 	_fsputfid(fid);
     41 	return n;
     42 }