From 26adb3c4747288aba2475cb403d66d68481793dc Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Wed, 28 Apr 2021 17:00:47 -0700 Subject: Automated rollback of changelist 369686285 PiperOrigin-RevId: 371015541 --- pkg/p9/handlers.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'pkg/p9/handlers.go') 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} +} -- cgit v1.2.3