// automatically generated by stateify.

package buffer

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

func (b *buffer) StateTypeName() string {
	return "pkg/buffer.buffer"
}

func (b *buffer) StateFields() []string {
	return []string{
		"data",
		"read",
		"write",
		"bufferEntry",
	}
}

func (b *buffer) beforeSave() {}

// +checklocksignore
func (b *buffer) StateSave(stateSinkObject state.Sink) {
	b.beforeSave()
	stateSinkObject.Save(0, &b.data)
	stateSinkObject.Save(1, &b.read)
	stateSinkObject.Save(2, &b.write)
	stateSinkObject.Save(3, &b.bufferEntry)
}

func (b *buffer) afterLoad() {}

// +checklocksignore
func (b *buffer) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &b.data)
	stateSourceObject.Load(1, &b.read)
	stateSourceObject.Load(2, &b.write)
	stateSourceObject.Load(3, &b.bufferEntry)
}

func (l *bufferList) StateTypeName() string {
	return "pkg/buffer.bufferList"
}

func (l *bufferList) StateFields() []string {
	return []string{
		"head",
		"tail",
	}
}

func (l *bufferList) beforeSave() {}

// +checklocksignore
func (l *bufferList) StateSave(stateSinkObject state.Sink) {
	l.beforeSave()
	stateSinkObject.Save(0, &l.head)
	stateSinkObject.Save(1, &l.tail)
}

func (l *bufferList) afterLoad() {}

// +checklocksignore
func (l *bufferList) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &l.head)
	stateSourceObject.Load(1, &l.tail)
}

func (e *bufferEntry) StateTypeName() string {
	return "pkg/buffer.bufferEntry"
}

func (e *bufferEntry) StateFields() []string {
	return []string{
		"next",
		"prev",
	}
}

func (e *bufferEntry) beforeSave() {}

// +checklocksignore
func (e *bufferEntry) StateSave(stateSinkObject state.Sink) {
	e.beforeSave()
	stateSinkObject.Save(0, &e.next)
	stateSinkObject.Save(1, &e.prev)
}

func (e *bufferEntry) afterLoad() {}

// +checklocksignore
func (e *bufferEntry) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &e.next)
	stateSourceObject.Load(1, &e.prev)
}

func (p *pool) StateTypeName() string {
	return "pkg/buffer.pool"
}

func (p *pool) StateFields() []string {
	return []string{
		"bufferSize",
		"embeddedStorage",
	}
}

func (p *pool) beforeSave() {}

// +checklocksignore
func (p *pool) StateSave(stateSinkObject state.Sink) {
	p.beforeSave()
	stateSinkObject.Save(0, &p.bufferSize)
	stateSinkObject.Save(1, &p.embeddedStorage)
}

// +checklocksignore
func (p *pool) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &p.bufferSize)
	stateSourceObject.LoadWait(1, &p.embeddedStorage)
	stateSourceObject.AfterLoad(p.afterLoad)
}

func (v *View) StateTypeName() string {
	return "pkg/buffer.View"
}

func (v *View) StateFields() []string {
	return []string{
		"data",
		"size",
		"pool",
	}
}

func (v *View) beforeSave() {}

// +checklocksignore
func (v *View) StateSave(stateSinkObject state.Sink) {
	v.beforeSave()
	stateSinkObject.Save(0, &v.data)
	stateSinkObject.Save(1, &v.size)
	stateSinkObject.Save(2, &v.pool)
}

func (v *View) afterLoad() {}

// +checklocksignore
func (v *View) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &v.data)
	stateSourceObject.Load(1, &v.size)
	stateSourceObject.Load(2, &v.pool)
}

func init() {
	state.Register((*buffer)(nil))
	state.Register((*bufferList)(nil))
	state.Register((*bufferEntry)(nil))
	state.Register((*pool)(nil))
	state.Register((*View)(nil))
}
