-
Notifications
You must be signed in to change notification settings - Fork 22
/
clnt_remove.go
33 lines (27 loc) · 722 Bytes
/
clnt_remove.go
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
// Copyright 2009 The Go9p Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package go9p
// Removes the file associated with the Fid. Returns nil if the
// operation is successful.
func (clnt *Clnt) Remove(fid *Fid) error {
tc := clnt.NewFcall()
err := PackTremove(tc, fid.Fid)
if err != nil {
return err
}
_, err = clnt.Rpc(tc)
clnt.fidpool.putId(fid.Fid)
fid.Fid = NOFID
return err
}
// Removes the named file. Returns nil if the operation is successful.
func (clnt *Clnt) FRemove(path string) error {
var err error
fid, err := clnt.FWalk(path)
if err != nil {
return err
}
err = clnt.Remove(fid)
return err
}