diff options
author | Michael Pratt <mpratt@google.com> | 2021-04-21 10:39:29 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-21 10:41:28 -0700 |
commit | c2955339d86437981ce53d2971ce83479ef94028 (patch) | |
tree | e68486bf1e193f23d6b3e9ba506c50c073a94a65 /pkg/p9/file.go | |
parent | 07a78ecb2918905af030a8cf81ee86ddd1c622c5 (diff) |
Automated rollback of changelist 369325957
PiperOrigin-RevId: 369686285
Diffstat (limited to 'pkg/p9/file.go')
-rw-r--r-- | pkg/p9/file.go | 60 |
1 files changed, 1 insertions, 59 deletions
diff --git a/pkg/p9/file.go b/pkg/p9/file.go index 97e0231d6..c59c6a65b 100644 --- a/pkg/p9/file.go +++ b/pkg/p9/file.go @@ -15,8 +15,6 @@ package p9 import ( - "errors" - "golang.org/x/sys/unix" "gvisor.dev/gvisor/pkg/fd" ) @@ -74,15 +72,6 @@ type File interface { // On the server, WalkGetAttr has a read concurrency guarantee. WalkGetAttr([]string) ([]QID, File, AttrMask, Attr, error) - // MultiGetAttr batches up multiple calls to GetAttr(). names is a list of - // path components similar to Walk(). If the first component name is empty, - // the current file is stat'd and included in the results. If the walk reaches - // a file that doesn't exist or not a directory, MultiGetAttr returns the - // partial result with no error. - // - // On the server, MultiGetAttr has a read concurrency guarantee. - MultiGetAttr(names []string) ([]FullStat, error) - // StatFS returns information about the file system associated with // this file. // @@ -317,53 +306,6 @@ func (DisallowClientCalls) SetAttrClose(SetAttrMask, SetAttr) error { type DisallowServerCalls struct{} // Renamed implements File.Renamed. -func (*DisallowServerCalls) Renamed(File, string) { +func (*clientFile) Renamed(File, string) { panic("Renamed should not be called on the client") } - -// DefaultMultiGetAttr implements File.MultiGetAttr() on top of File. -func DefaultMultiGetAttr(start File, names []string) ([]FullStat, error) { - stats := make([]FullStat, 0, len(names)) - parent := start - mask := AttrMaskAll() - for i, name := range names { - if len(name) == 0 && i == 0 { - qid, valid, attr, err := parent.GetAttr(mask) - if err != nil { - return nil, err - } - stats = append(stats, FullStat{ - QID: qid, - Valid: valid, - Attr: attr, - }) - continue - } - qids, child, valid, attr, err := parent.WalkGetAttr([]string{name}) - if parent != start { - _ = parent.Close() - } - if err != nil { - if errors.Is(err, unix.ENOENT) { - return stats, nil - } - return nil, err - } - stats = append(stats, FullStat{ - QID: qids[0], - Valid: valid, - Attr: attr, - }) - if attr.Mode.FileType() != ModeDirectory { - // Doesn't need to continue if entry is not a dir. Including symlinks - // that cannot be followed. - _ = child.Close() - break - } - parent = child - } - if parent != start { - _ = parent.Close() - } - return stats, nil -} |