// automatically generated by stateify.

package pipe

import (
	"gvisor.dev/gvisor/pkg/state"
)

func (p *Pipe) StateTypeName() string {
	return "pkg/sentry/kernel/pipe.Pipe"
}

func (p *Pipe) StateFields() []string {
	return []string{
		"queue",
		"isNamed",
		"readers",
		"totalReaders",
		"writers",
		"totalWriters",
		"buf",
		"off",
		"size",
		"max",
		"hadWriter",
	}
}

func (p *Pipe) beforeSave() {}

// +checklocksignore
func (p *Pipe) StateSave(stateSinkObject state.Sink) {
	p.beforeSave()
	stateSinkObject.Save(0, &p.queue)
	stateSinkObject.Save(1, &p.isNamed)
	stateSinkObject.Save(2, &p.readers)
	stateSinkObject.Save(3, &p.totalReaders)
	stateSinkObject.Save(4, &p.writers)
	stateSinkObject.Save(5, &p.totalWriters)
	stateSinkObject.Save(6, &p.buf)
	stateSinkObject.Save(7, &p.off)
	stateSinkObject.Save(8, &p.size)
	stateSinkObject.Save(9, &p.max)
	stateSinkObject.Save(10, &p.hadWriter)
}

// +checklocksignore
func (p *Pipe) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &p.queue)
	stateSourceObject.Load(1, &p.isNamed)
	stateSourceObject.Load(2, &p.readers)
	stateSourceObject.Load(3, &p.totalReaders)
	stateSourceObject.Load(4, &p.writers)
	stateSourceObject.Load(5, &p.totalWriters)
	stateSourceObject.Load(6, &p.buf)
	stateSourceObject.Load(7, &p.off)
	stateSourceObject.Load(8, &p.size)
	stateSourceObject.Load(9, &p.max)
	stateSourceObject.Load(10, &p.hadWriter)
	stateSourceObject.AfterLoad(p.afterLoad)
}

func (vp *VFSPipe) StateTypeName() string {
	return "pkg/sentry/kernel/pipe.VFSPipe"
}

func (vp *VFSPipe) StateFields() []string {
	return []string{
		"pipe",
	}
}

func (vp *VFSPipe) beforeSave() {}

// +checklocksignore
func (vp *VFSPipe) StateSave(stateSinkObject state.Sink) {
	vp.beforeSave()
	stateSinkObject.Save(0, &vp.pipe)
}

func (vp *VFSPipe) afterLoad() {}

// +checklocksignore
func (vp *VFSPipe) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &vp.pipe)
}

func (fd *VFSPipeFD) StateTypeName() string {
	return "pkg/sentry/kernel/pipe.VFSPipeFD"
}

func (fd *VFSPipeFD) StateFields() []string {
	return []string{
		"vfsfd",
		"FileDescriptionDefaultImpl",
		"DentryMetadataFileDescriptionImpl",
		"LockFD",
		"pipe",
	}
}

func (fd *VFSPipeFD) beforeSave() {}

// +checklocksignore
func (fd *VFSPipeFD) StateSave(stateSinkObject state.Sink) {
	fd.beforeSave()
	stateSinkObject.Save(0, &fd.vfsfd)
	stateSinkObject.Save(1, &fd.FileDescriptionDefaultImpl)
	stateSinkObject.Save(2, &fd.DentryMetadataFileDescriptionImpl)
	stateSinkObject.Save(3, &fd.LockFD)
	stateSinkObject.Save(4, &fd.pipe)
}

func (fd *VFSPipeFD) afterLoad() {}

// +checklocksignore
func (fd *VFSPipeFD) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &fd.vfsfd)
	stateSourceObject.Load(1, &fd.FileDescriptionDefaultImpl)
	stateSourceObject.Load(2, &fd.DentryMetadataFileDescriptionImpl)
	stateSourceObject.Load(3, &fd.LockFD)
	stateSourceObject.Load(4, &fd.pipe)
}

func init() {
	state.Register((*Pipe)(nil))
	state.Register((*VFSPipe)(nil))
	state.Register((*VFSPipeFD)(nil))
}
