forked from kubernetes/minikube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clnt_stat.go
45 lines (37 loc) · 985 Bytes
/
clnt_stat.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
34
35
36
37
38
39
40
41
42
43
44
45
// 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
// Returns the metadata for the file associated with the Fid, or an Error.
func (clnt *Clnt) Stat(fid *Fid) (*Dir, error) {
tc := clnt.NewFcall()
err := PackTstat(tc, fid.Fid)
if err != nil {
return nil, err
}
rc, err := clnt.Rpc(tc)
if err != nil {
return nil, err
}
return &rc.Dir, nil
}
// Returns the metadata for a named file, or an Error.
func (clnt *Clnt) FStat(path string) (*Dir, error) {
fid, err := clnt.FWalk(path)
if err != nil {
return nil, err
}
d, err := clnt.Stat(fid)
clnt.Clunk(fid)
return d, err
}
// Modifies the data of the file associated with the Fid, or an Error.
func (clnt *Clnt) Wstat(fid *Fid, dir *Dir) error {
tc := clnt.NewFcall()
err := PackTwstat(tc, fid.Fid, dir, clnt.Dotu)
if err != nil {
return err
}
_, err = clnt.Rpc(tc)
return err
}