diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-04-29 00:07:09 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-29 00:07:09 +0000 |
commit | b503e7e13a336d40b2b47ad95c17f7cd743d233c (patch) | |
tree | 3f0120b1dd9121de1ae113e7e1044ae499298834 /pkg/p9/handlers.go | |
parent | 4fdaa68e9b9c24bf08c3a9032f066cd07ba6e9b9 (diff) | |
parent | 26adb3c4747288aba2475cb403d66d68481793dc (diff) |
Merge release-20210419.0-39-g26adb3c47 (automated)
Diffstat (limited to 'pkg/p9/handlers.go')
-rw-r--r-- | pkg/p9/handlers.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pkg/p9/handlers.go b/pkg/p9/handlers.go index 58312d0cc..758e11b13 100644 --- a/pkg/p9/handlers.go +++ b/pkg/p9/handlers.go @@ -1421,3 +1421,31 @@ func (t *Tchannel) handle(cs *connState) message { } return rchannel } + +// handle implements handler.handle. +func (t *Tmultigetattr) handle(cs *connState) message { + for i, name := range t.Names { + if len(name) == 0 && i == 0 { + // Empty name is allowed on the first entry to indicate that the current + // FID needs to be included in the result. + continue + } + if err := checkSafeName(name); err != nil { + return newErr(err) + } + } + ref, ok := cs.LookupFID(t.FID) + if !ok { + return newErr(unix.EBADF) + } + defer ref.DecRef() + + var stats []FullStat + if err := ref.safelyRead(func() (err error) { + stats, err = ref.file.MultiGetAttr(t.Names) + return err + }); err != nil { + return newErr(err) + } + return &Rmultigetattr{Stats: stats} +} |