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/messages.go | |
parent | 07a78ecb2918905af030a8cf81ee86ddd1c622c5 (diff) |
Automated rollback of changelist 369325957
PiperOrigin-RevId: 369686285
Diffstat (limited to 'pkg/p9/messages.go')
-rw-r--r-- | pkg/p9/messages.go | 84 |
1 files changed, 4 insertions, 80 deletions
diff --git a/pkg/p9/messages.go b/pkg/p9/messages.go index 2ff4694c0..cf13cbb69 100644 --- a/pkg/p9/messages.go +++ b/pkg/p9/messages.go @@ -254,8 +254,8 @@ func (r *Rwalk) decode(b *buffer) { // encode implements encoder.encode. func (r *Rwalk) encode(b *buffer) { b.Write16(uint16(len(r.QIDs))) - for i := range r.QIDs { - r.QIDs[i].encode(b) + for _, q := range r.QIDs { + q.encode(b) } } @@ -2243,8 +2243,8 @@ func (r *Rwalkgetattr) encode(b *buffer) { r.Valid.encode(b) r.Attr.encode(b) b.Write16(uint16(len(r.QIDs))) - for i := range r.QIDs { - r.QIDs[i].encode(b) + for _, q := range r.QIDs { + q.encode(b) } } @@ -2552,80 +2552,6 @@ func (r *Rchannel) String() string { return fmt.Sprintf("Rchannel{Offset: %d, Length: %d}", r.Offset, r.Length) } -// Tmultigetattr is a multi-getattr request. -type Tmultigetattr struct { - // FID is the FID to be walked. - FID FID - - // Names are the set of names to be walked. - Names []string -} - -// decode implements encoder.decode. -func (t *Tmultigetattr) decode(b *buffer) { - t.FID = b.ReadFID() - n := b.Read16() - t.Names = t.Names[:0] - for i := 0; i < int(n); i++ { - t.Names = append(t.Names, b.ReadString()) - } -} - -// encode implements encoder.encode. -func (t *Tmultigetattr) encode(b *buffer) { - b.WriteFID(t.FID) - b.Write16(uint16(len(t.Names))) - for _, name := range t.Names { - b.WriteString(name) - } -} - -// Type implements message.Type. -func (*Tmultigetattr) Type() MsgType { - return MsgTmultigetattr -} - -// String implements fmt.Stringer. -func (t *Tmultigetattr) String() string { - return fmt.Sprintf("Tmultigetattr{FID: %d, Names: %v}", t.FID, t.Names) -} - -// Rmultigetattr is a multi-getattr response. -type Rmultigetattr struct { - // Stats are the set of FullStat returned for each of the names in the - // request. - Stats []FullStat -} - -// decode implements encoder.decode. -func (r *Rmultigetattr) decode(b *buffer) { - n := b.Read16() - r.Stats = r.Stats[:0] - for i := 0; i < int(n); i++ { - var fs FullStat - fs.decode(b) - r.Stats = append(r.Stats, fs) - } -} - -// encode implements encoder.encode. -func (r *Rmultigetattr) encode(b *buffer) { - b.Write16(uint16(len(r.Stats))) - for i := range r.Stats { - r.Stats[i].encode(b) - } -} - -// Type implements message.Type. -func (*Rmultigetattr) Type() MsgType { - return MsgRmultigetattr -} - -// String implements fmt.Stringer. -func (r *Rmultigetattr) String() string { - return fmt.Sprintf("Rmultigetattr{Stats: %v}", r.Stats) -} - const maxCacheSize = 3 // msgFactory is used to reduce allocations by caching messages for reuse. @@ -2791,8 +2717,6 @@ func init() { msgRegistry.register(MsgRallocate, func() message { return &Rallocate{} }) msgRegistry.register(MsgTsetattrclunk, func() message { return &Tsetattrclunk{} }) msgRegistry.register(MsgRsetattrclunk, func() message { return &Rsetattrclunk{} }) - msgRegistry.register(MsgTmultigetattr, func() message { return &Tmultigetattr{} }) - msgRegistry.register(MsgRmultigetattr, func() message { return &Rmultigetattr{} }) msgRegistry.register(MsgTchannel, func() message { return &Tchannel{} }) msgRegistry.register(MsgRchannel, func() message { return &Rchannel{} }) } |