func (t *trename) encode(b *buffer) {
	b.WriteFID(t.fid)
	b.WriteFID(t.Directory)
	b.WriteString(t.Name)
}
encode implements encoder.encode.
package p9
import (
	"fmt"
	"math"
)
type ErrInvalidMsgType struct {
	msgType
}
func (e *ErrInvalidMsgType) Error() string {
	return fmt.Sprintf("invalid message type: %d", e.msgType)
}
type message interface {
	encoder
	fmt.Stringer
	typ() msgType
}
type payloader interface {
	FixedSize() uint32
	Payload() []byte
	SetPayload([]byte)
}
type tversion struct {
	MSize uint32
	Version string
}
func (t *tversion) decode(b *buffer) {
	t.MSize = b.Read32()
	t.Version = b.ReadString()
}
func (t *tversion) encode(b *buffer) {
	b.Write32(t.MSize)
	b.WriteString(t.Version)
}
func (*tversion) typ() msgType {
	return msgTversion
}
func (t *tversion) String() string {
	return fmt.Sprintf("Tversion{MSize: %d, Version: %s}", t.MSize, t.Version)
}
type rversion struct {
	MSize uint32
	Version string
}
func (r *rversion) decode(b *buffer) {
	r.MSize = b.Read32()
	r.Version = b.ReadString()
}
func (r *rversion) encode(b *buffer) {
	b.Write32(r.MSize)
	b.WriteString(r.Version)
}
func (*rversion) typ() msgType {
	return msgRversion
}
func (r *rversion) String() string {
	return fmt.Sprintf("Rversion{MSize: %d, Version: %s}", r.MSize, r.Version)
}
type tflush struct {
	OldTag tag
}
func (t *tflush) decode(b *buffer) {
	t.OldTag = b.ReadTag()
}
func (t *tflush) encode(b *buffer) {
	b.WriteTag(t.OldTag)
}
func (*tflush) typ() msgType {
	return msgTflush
}
func (t *tflush) String() string {
	return fmt.Sprintf("Tflush{OldTag: %d}", t.OldTag)
}
type rflush struct {
}
func (*rflush) decode(b *buffer) {
}
func (*rflush) encode(b *buffer) {
}
func (*rflush) typ() msgType {
	return msgRflush
}
func (r *rflush) String() string {
	return fmt.Sprintf("Rflush{}")
}
type twalk struct {
	fid fid
	newFID fid
	Names []string
}
func (t *twalk) decode(b *buffer) {
	t.fid = b.ReadFID()
	t.newFID = b.ReadFID()
	n := b.Read16()
	t.Names = t.Names[:0]
	for i := 0; i < int(n); i++ {
		t.Names = append(t.Names, b.ReadString())
	}
}
func (t *twalk) encode(b *buffer) {
	b.WriteFID(t.fid)
	b.WriteFID(t.newFID)
	b.Write16(uint16(len(t.Names)))
	for _, name := range t.Names {
		b.WriteString(name)
	}
}
func (*twalk) typ() msgType {
	return msgTwalk
}
func (t *twalk) String() string {
	return fmt.Sprintf("Twalk{FID: %d, newFID: %d, Names: %v}", t.fid, t.newFID, t.Names)
}
type rwalk struct {
	QIDs []QID
}
func (r *rwalk) decode(b *buffer) {
	n := b.Read16()
	r.QIDs = r.QIDs[:0]
	for i := 0; i < int(n); i++ {
		var q QID
		q.decode(b)
		r.QIDs = append(r.QIDs, q)
	}
}
func (r *rwalk) encode(b *buffer) {
	b.Write16(uint16(len(r.QIDs)))
	for _, q := range r.QIDs {
		q.encode(b)
	}
}
func (*rwalk) typ() msgType {
	return msgRwalk
}
func (r *rwalk) String() string {
	return fmt.Sprintf("Rwalk{QIDs: %v}", r.QIDs)
}
type tclunk struct {
	fid fid
}
func (t *tclunk) decode(b *buffer) {
	t.fid = b.ReadFID()
}
func (t *tclunk) encode(b *buffer) {
	b.WriteFID(t.fid)
}
func (*tclunk) typ() msgType {
	return msgTclunk
}
func (t *tclunk) String() string {
	return fmt.Sprintf("Tclunk{FID: %d}", t.fid)
}
type rclunk struct{}
func (*rclunk) decode(b *buffer) {
}
func (*rclunk) encode(b *buffer) {
}
func (*rclunk) typ() msgType {
	return msgRclunk
}
func (r *rclunk) String() string {
	return fmt.Sprintf("Rclunk{}")
}
type tremove struct {
	fid fid
}
func (t *tremove) decode(b *buffer) {
	t.fid = b.ReadFID()
}
func (t *tremove) encode(b *buffer) {
	b.WriteFID(t.fid)
}
func (*tremove) typ() msgType {
	return msgTremove
}
func (t *tremove) String() string {
	return fmt.Sprintf("Tremove{FID: %d}", t.fid)
}
type rremove struct {
}
func (*rremove) decode(b *buffer) {
}
func (*rremove) encode(b *buffer) {
}
func (*rremove) typ() msgType {
	return msgRremove
}
func (r *rremove) String() string {
	return fmt.Sprintf("Rremove{}")
}
type rlerror struct {
	Error uint32
}
func (r *rlerror) decode(b *buffer) {
	r.Error = b.Read32()
}
func (r *rlerror) encode(b *buffer) {
	b.Write32(r.Error)
}
func (*rlerror) typ() msgType {
	return msgRlerror
}
func (r *rlerror) String() string {
	return fmt.Sprintf("Rlerror{Error: %d}", r.Error)
}
type tauth struct {
	Authenticationfid fid
	UserName string
	AttachName string
	UID UID
}
func (t *tauth) decode(b *buffer) {
	t.Authenticationfid = b.ReadFID()
	t.UserName = b.ReadString()
	t.AttachName = b.ReadString()
	t.UID = b.ReadUID()
}
func (t *tauth) encode(b *buffer) {
	b.WriteFID(t.Authenticationfid)
	b.WriteString(t.UserName)
	b.WriteString(t.AttachName)
	b.WriteUID(t.UID)
}
func (*tauth) typ() msgType {
	return msgTauth
}
func (t *tauth) String() string {
	return fmt.Sprintf("Tauth{AuthFID: %d, UserName: %s, AttachName: %s, UID: %d", t.Authenticationfid, t.UserName, t.AttachName, t.UID)
}
type rauth struct {
	QID
}
func (*rauth) typ() msgType {
	return msgRauth
}
func (r *rauth) String() string {
	return fmt.Sprintf("Rauth{QID: %s}", r.QID)
}
type tattach struct {
	fid fid
	Auth tauth
}
func (t *tattach) decode(b *buffer) {
	t.fid = b.ReadFID()
	t.Auth.decode(b)
}
func (t *tattach) encode(b *buffer) {
	b.WriteFID(t.fid)
	t.Auth.encode(b)
}
func (*tattach) typ() msgType {
	return msgTattach
}
func (t *tattach) String() string {
	return fmt.Sprintf("Tattach{FID: %d, AuthFID: %d, UserName: %s, AttachName: %s, UID: %d}", t.fid, t.Auth.Authenticationfid, t.Auth.UserName, t.Auth.AttachName, t.Auth.UID)
}
type rattach struct {
	QID
}
func (*rattach) typ() msgType {
	return msgRattach
}
func (r *rattach) String() string {
	return fmt.Sprintf("Rattach{QID: %s}", r.QID)
}
type tlopen struct {
	fid fid
	Flags OpenFlags
}
func (t *tlopen) decode(b *buffer) {
	t.fid = b.ReadFID()
	t.Flags = b.ReadOpenFlags()
}
func (t *tlopen) encode(b *buffer) {
	b.WriteFID(t.fid)
	b.WriteOpenFlags(t.Flags)
}
func (*tlopen) typ() msgType {
	return msgTlopen
}
func (t *tlopen) String() string {
	return fmt.Sprintf("Tlopen{FID: %d, Flags: %v}", t.fid, t.Flags)
}
type rlopen struct {
	QID QID
	IoUnit uint32
}
func (r *rlopen) decode(b *buffer) {
	r.QID.decode(b)
	r.IoUnit = b.Read32()
}
func (r *rlopen) encode(b *buffer) {
	r.QID.encode(b)
	b.Write32(r.IoUnit)
}
func (*rlopen) typ() msgType {
	return msgRlopen
}
func (r *rlopen) String() string {
	return fmt.Sprintf("Rlopen{QID: %s, IoUnit: %d}", r.QID, r.IoUnit)
}
type tlcreate struct {
	fid fid
	Name string
	OpenFlags OpenFlags
	Permissions FileMode
	GID GID
}
func (t *tlcreate) decode(b *buffer) {
	t.fid = b.ReadFID()
	t.Name = b.ReadString()
	t.OpenFlags = b.ReadOpenFlags()
	t.Permissions = b.ReadPermissions()
	t.GID = b.ReadGID()
}
func (t *tlcreate) encode(b *buffer) {
	b.WriteFID(t.fid)
	b.WriteString(t.Name)
	b.WriteOpenFlags(t.OpenFlags)
	b.WritePermissions(t.Permissions)
	b.WriteGID(t.GID)
}
func (*tlcreate) typ() msgType {
	return msgTlcreate
}
func (t *tlcreate) String() string {
	return fmt.Sprintf("Tlcreate{FID: %d, Name: %s, OpenFlags: %s, Permissions: 0o%o, GID: %d}", t.fid, t.Name, t.OpenFlags, t.Permissions, t.GID)
}
type rlcreate struct {
	rlopen
}
func (*rlcreate) typ() msgType {
	return msgRlcreate
}
func (r *rlcreate) String() string {
	return fmt.Sprintf("Rlcreate{QID: %s, IoUnit: %d}", r.QID, r.IoUnit)
}
type tsymlink struct {
	Directory fid
	Name string
	Target string
	GID GID
}
func (t *tsymlink) decode(b *buffer) {
	t.Directory = b.ReadFID()
	t.Name = b.ReadString()
	t.Target = b.ReadString()
	t.GID = b.ReadGID()
}
func (t *tsymlink) encode(b *buffer) {
	b.WriteFID(t.Directory)
	b.WriteString(t.Name)
	b.WriteString(t.Target)
	b.WriteGID(t.GID)
}
func (*tsymlink) typ() msgType {
	return msgTsymlink
}
func (t *tsymlink) String() string {
	return fmt.Sprintf("Tsymlink{DirectoryFID: %d, Name: %s, Target: %s, GID: %d}", t.Directory, t.Name, t.Target, t.GID)
}
type rsymlink struct {
	QID QID
}
func (r *rsymlink) decode(b *buffer) {
	r.QID.decode(b)
}
func (r *rsymlink) encode(b *buffer) {
	r.QID.encode(b)
}
func (*rsymlink) typ() msgType {
	return msgRsymlink
}
func (r *rsymlink) String() string {
	return fmt.Sprintf("Rsymlink{QID: %s}", r.QID)
}
type tlink struct {
	Directory fid
	Target fid
	Name string
}
func (t *tlink) decode(b *buffer) {
	t.Directory = b.ReadFID()
	t.Target = b.ReadFID()
	t.Name = b.ReadString()
}
func (t *tlink) encode(b *buffer) {
	b.WriteFID(t.Directory)
	b.WriteFID(t.Target)
	b.WriteString(t.Name)
}
func (*tlink) typ() msgType {
	return msgTlink
}
func (t *tlink) String() string {
	return fmt.Sprintf("Tlink{DirectoryFID: %d, TargetFID: %d, Name: %s}", t.Directory, t.Target, t.Name)
}
type rlink struct {
}
func (*rlink) typ() msgType {
	return msgRlink
}
func (*rlink) decode(b *buffer) {
}
func (*rlink) encode(b *buffer) {
}
func (r *rlink) String() string {
	return fmt.Sprintf("Rlink{}")
}
type trenameat struct {
	OldDirectory fid
	OldName string
	NewDirectory fid
	NewName string
}
func (t *trenameat) decode(b *buffer) {
	t.OldDirectory = b.ReadFID()
	t.OldName = b.ReadString()
	t.NewDirectory = b.ReadFID()
	t.NewName = b.ReadString()
}
func (t *trenameat) encode(b *buffer) {
	b.WriteFID(t.OldDirectory)
	b.WriteString(t.OldName)
	b.WriteFID(t.NewDirectory)
	b.WriteString(t.NewName)
}
func (*trenameat) typ() msgType {
	return msgTrenameat
}
func (t *trenameat) String() string {
	return fmt.Sprintf("TrenameAt{OldDirectoryFID: %d, OldName: %s, NewDirectoryFID: %d, NewName: %s}", t.OldDirectory, t.OldName, t.NewDirectory, t.NewName)
}
type rrenameat struct {
}
func (*rrenameat) decode(b *buffer) {
}
func (*rrenameat) encode(b *buffer) {
}
func (*rrenameat) typ() msgType {
	return msgRrenameat
}
func (r *rrenameat) String() string {
	return fmt.Sprintf("Rrenameat{}")
}
type tunlinkat struct {
	Directory fid
	Name string
	Flags uint32
}
func (t *tunlinkat) decode(b *buffer) {
	t.Directory = b.ReadFID()
	t.Name = b.ReadString()
	t.Flags = b.Read32()
}
func (t *tunlinkat) encode(b *buffer) {
	b.WriteFID(t.Directory)
	b.WriteString(t.Name)
	b.Write32(t.Flags)
}
func (*tunlinkat) typ() msgType {
	return msgTunlinkat
}
func (t *tunlinkat) String() string {
	return fmt.Sprintf("Tunlinkat{DirectoryFID: %d, Name: %s, Flags: 0x%X}", t.Directory, t.Name, t.Flags)
}
type runlinkat struct {
}
func (*runlinkat) decode(b *buffer) {
}
func (*runlinkat) encode(b *buffer) {
}
func (*runlinkat) typ() msgType {
	return msgRunlinkat
}
func (r *runlinkat) String() string {
	return fmt.Sprintf("Runlinkat{}")
}
type trename struct {
	fid fid
	Directory fid
	Name string
}
func (t *trename) decode(b *buffer) {
	t.fid = b.ReadFID()
	t.Directory = b.ReadFID()
	t.Name = b.ReadString()
}