diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-01-16 21:04:22 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-01-16 21:04:22 +0000 |
commit | 47e62a0e3dff672ea69e70ec9ee057c77f72803e (patch) | |
tree | 8d2b88c28274499eb932c2d9131385890af15601 /pkg/p9/handlers.go | |
parent | 04d906d01293b63764895be93e50af1d65adb8ed (diff) | |
parent | 07f258497932e53f4651b80a086117ffda843fe3 (diff) |
Merge release-20200115.0-9-g07f2584 (automated)
Diffstat (limited to 'pkg/p9/handlers.go')
-rw-r--r-- | pkg/p9/handlers.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/pkg/p9/handlers.go b/pkg/p9/handlers.go index b9582c07f..7d6653a07 100644 --- a/pkg/p9/handlers.go +++ b/pkg/p9/handlers.go @@ -913,6 +913,35 @@ func (t *Txattrcreate) handle(cs *connState) message { } // handle implements handler.handle. +func (t *Tgetxattr) handle(cs *connState) message { + ref, ok := cs.LookupFID(t.FID) + if !ok { + return newErr(syscall.EBADF) + } + defer ref.DecRef() + + val, err := ref.file.GetXattr(t.Name, t.Size) + if err != nil { + return newErr(err) + } + return &Rgetxattr{Value: val} +} + +// handle implements handler.handle. +func (t *Tsetxattr) handle(cs *connState) message { + ref, ok := cs.LookupFID(t.FID) + if !ok { + return newErr(syscall.EBADF) + } + defer ref.DecRef() + + if err := ref.file.SetXattr(t.Name, t.Value, t.Flags); err != nil { + return newErr(err) + } + return &Rsetxattr{} +} + +// handle implements handler.handle. func (t *Treaddir) handle(cs *connState) message { ref, ok := cs.LookupFID(t.Directory) if !ok { |