aboutsummaryrefslogtreecommitdiff
path: root/src/lib9pclient/close.c
blob: 9303b17dd209afd77ed044c3e2f088c9d46d40f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* Copyright (C) 2003 Russ Cox, Massachusetts Institute of Technology */
/* See COPYRIGHT */

#include <u.h>
#include <libc.h>
#include <fcall.h>
#include <9pclient.h>
#include "fsimpl.h"

static void
fidclunk(CFid *fid)
{
	Fcall tx, rx;

	tx.type = Tclunk;
	tx.fid = fid->fid;
	_fsrpc(fid->fs, &tx, &rx, 0);
	_fsputfid(fid);
}

void
fsclose(CFid *fid)
{
	if(fid == nil)
		return;

	/* maybe someday there will be a ref count */
	fidclunk(fid);
}

int
fsfremove(CFid *fid)
{
	int n;
	Fcall tx, rx;
	
	tx.type = Tremove;
	tx.fid = fid->fid;
	n = _fsrpc(fid->fs, &tx, &rx, 0);
	_fsputfid(fid);
	return n;
}