// automatically generated by stateify.

//go:build linux && linux && linux && linux && linux && linux
// +build linux,linux,linux,linux,linux,linux

package sharedmem

import (
	"context"

	"github.com/sagernet/gvisor/pkg/state"
)

func (s *serverRx) StateTypeName() string {
	return "pkg/tcpip/link/sharedmem.serverRx"
}

func (s *serverRx) StateFields() []string {
	return []string{
		"packetPipe",
		"completionPipe",
		"data",
		"eventFD",
		"sharedData",
		"sharedEventFDState",
	}
}

func (s *serverRx) beforeSave() {}

// +checklocksignore
func (s *serverRx) StateSave(stateSinkObject state.Sink) {
	s.beforeSave()
	stateSinkObject.Save(0, &s.packetPipe)
	stateSinkObject.Save(1, &s.completionPipe)
	stateSinkObject.Save(2, &s.data)
	stateSinkObject.Save(3, &s.eventFD)
	stateSinkObject.Save(4, &s.sharedData)
	stateSinkObject.Save(5, &s.sharedEventFDState)
}

func (s *serverRx) afterLoad(context.Context) {}

// +checklocksignore
func (s *serverRx) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &s.packetPipe)
	stateSourceObject.Load(1, &s.completionPipe)
	stateSourceObject.Load(2, &s.data)
	stateSourceObject.Load(3, &s.eventFD)
	stateSourceObject.Load(4, &s.sharedData)
	stateSourceObject.Load(5, &s.sharedEventFDState)
}

func (s *serverTx) StateTypeName() string {
	return "pkg/tcpip/link/sharedmem.serverTx"
}

func (s *serverTx) StateFields() []string {
	return []string{
		"fillPipe",
		"completionPipe",
		"data",
		"eventFD",
		"sharedData",
		"sharedEventFDState",
	}
}

func (s *serverTx) beforeSave() {}

// +checklocksignore
func (s *serverTx) StateSave(stateSinkObject state.Sink) {
	s.beforeSave()
	stateSinkObject.Save(0, &s.fillPipe)
	stateSinkObject.Save(1, &s.completionPipe)
	stateSinkObject.Save(2, &s.data)
	stateSinkObject.Save(3, &s.eventFD)
	stateSinkObject.Save(4, &s.sharedData)
	stateSinkObject.Save(5, &s.sharedEventFDState)
}

func (s *serverTx) afterLoad(context.Context) {}

// +checklocksignore
func (s *serverTx) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &s.fillPipe)
	stateSourceObject.Load(1, &s.completionPipe)
	stateSourceObject.Load(2, &s.data)
	stateSourceObject.Load(3, &s.eventFD)
	stateSourceObject.Load(4, &s.sharedData)
	stateSourceObject.Load(5, &s.sharedEventFDState)
}

func (q *QueueConfig) StateTypeName() string {
	return "pkg/tcpip/link/sharedmem.QueueConfig"
}

func (q *QueueConfig) StateFields() []string {
	return []string{
		"DataFD",
		"EventFD",
		"TxPipeFD",
		"RxPipeFD",
		"SharedDataFD",
	}
}

func (q *QueueConfig) beforeSave() {}

// +checklocksignore
func (q *QueueConfig) StateSave(stateSinkObject state.Sink) {
	q.beforeSave()
	stateSinkObject.Save(0, &q.DataFD)
	stateSinkObject.Save(1, &q.EventFD)
	stateSinkObject.Save(2, &q.TxPipeFD)
	stateSinkObject.Save(3, &q.RxPipeFD)
	stateSinkObject.Save(4, &q.SharedDataFD)
}

func (q *QueueConfig) afterLoad(context.Context) {}

// +checklocksignore
func (q *QueueConfig) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &q.DataFD)
	stateSourceObject.Load(1, &q.EventFD)
	stateSourceObject.Load(2, &q.TxPipeFD)
	stateSourceObject.Load(3, &q.RxPipeFD)
	stateSourceObject.Load(4, &q.SharedDataFD)
}

func (o *Options) StateTypeName() string {
	return "pkg/tcpip/link/sharedmem.Options"
}

func (o *Options) StateFields() []string {
	return []string{
		"MTU",
		"BufferSize",
		"LinkAddress",
		"TX",
		"RX",
		"PeerFD",
		"OnClosed",
		"TXChecksumOffload",
		"RXChecksumOffload",
		"VirtioNetHeaderRequired",
		"GSOMaxSize",
	}
}

func (o *Options) beforeSave() {}

// +checklocksignore
func (o *Options) StateSave(stateSinkObject state.Sink) {
	o.beforeSave()
	stateSinkObject.Save(0, &o.MTU)
	stateSinkObject.Save(1, &o.BufferSize)
	stateSinkObject.Save(2, &o.LinkAddress)
	stateSinkObject.Save(3, &o.TX)
	stateSinkObject.Save(4, &o.RX)
	stateSinkObject.Save(5, &o.PeerFD)
	stateSinkObject.Save(6, &o.OnClosed)
	stateSinkObject.Save(7, &o.TXChecksumOffload)
	stateSinkObject.Save(8, &o.RXChecksumOffload)
	stateSinkObject.Save(9, &o.VirtioNetHeaderRequired)
	stateSinkObject.Save(10, &o.GSOMaxSize)
}

func (o *Options) afterLoad(context.Context) {}

// +checklocksignore
func (o *Options) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &o.MTU)
	stateSourceObject.Load(1, &o.BufferSize)
	stateSourceObject.Load(2, &o.LinkAddress)
	stateSourceObject.Load(3, &o.TX)
	stateSourceObject.Load(4, &o.RX)
	stateSourceObject.Load(5, &o.PeerFD)
	stateSourceObject.Load(6, &o.OnClosed)
	stateSourceObject.Load(7, &o.TXChecksumOffload)
	stateSourceObject.Load(8, &o.RXChecksumOffload)
	stateSourceObject.Load(9, &o.VirtioNetHeaderRequired)
	stateSourceObject.Load(10, &o.GSOMaxSize)
}

func (e *endpoint) StateTypeName() string {
	return "pkg/tcpip/link/sharedmem.endpoint"
}

func (e *endpoint) StateFields() []string {
	return []string{
		"bufferSize",
		"peerFD",
		"caps",
		"hdrSize",
		"gsoMaxSize",
		"virtioNetHeaderRequired",
		"rx",
		"stopRequested",
		"completed",
		"tx",
		"workerStarted",
		"addr",
		"mtu",
	}
}

func (e *endpoint) beforeSave() {}

// +checklocksignore
func (e *endpoint) StateSave(stateSinkObject state.Sink) {
	e.beforeSave()
	stateSinkObject.Save(0, &e.bufferSize)
	stateSinkObject.Save(1, &e.peerFD)
	stateSinkObject.Save(2, &e.caps)
	stateSinkObject.Save(3, &e.hdrSize)
	stateSinkObject.Save(4, &e.gsoMaxSize)
	stateSinkObject.Save(5, &e.virtioNetHeaderRequired)
	stateSinkObject.Save(6, &e.rx)
	stateSinkObject.Save(7, &e.stopRequested)
	stateSinkObject.Save(8, &e.completed)
	stateSinkObject.Save(9, &e.tx)
	stateSinkObject.Save(10, &e.workerStarted)
	stateSinkObject.Save(11, &e.addr)
	stateSinkObject.Save(12, &e.mtu)
}

func (e *endpoint) afterLoad(context.Context) {}

// +checklocksignore
func (e *endpoint) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &e.bufferSize)
	stateSourceObject.Load(1, &e.peerFD)
	stateSourceObject.Load(2, &e.caps)
	stateSourceObject.Load(3, &e.hdrSize)
	stateSourceObject.Load(4, &e.gsoMaxSize)
	stateSourceObject.Load(5, &e.virtioNetHeaderRequired)
	stateSourceObject.Load(6, &e.rx)
	stateSourceObject.Load(7, &e.stopRequested)
	stateSourceObject.Load(8, &e.completed)
	stateSourceObject.Load(9, &e.tx)
	stateSourceObject.Load(10, &e.workerStarted)
	stateSourceObject.Load(11, &e.addr)
	stateSourceObject.Load(12, &e.mtu)
}

func (e *serverEndpoint) StateTypeName() string {
	return "pkg/tcpip/link/sharedmem.serverEndpoint"
}

func (e *serverEndpoint) StateFields() []string {
	return []string{
		"bufferSize",
		"rx",
		"stopRequested",
		"peerFD",
		"caps",
		"hdrSize",
		"virtioNetHeaderRequired",
		"tx",
		"workerStarted",
		"addr",
		"mtu",
	}
}

func (e *serverEndpoint) beforeSave() {}

// +checklocksignore
func (e *serverEndpoint) StateSave(stateSinkObject state.Sink) {
	e.beforeSave()
	stateSinkObject.Save(0, &e.bufferSize)
	stateSinkObject.Save(1, &e.rx)
	stateSinkObject.Save(2, &e.stopRequested)
	stateSinkObject.Save(3, &e.peerFD)
	stateSinkObject.Save(4, &e.caps)
	stateSinkObject.Save(5, &e.hdrSize)
	stateSinkObject.Save(6, &e.virtioNetHeaderRequired)
	stateSinkObject.Save(7, &e.tx)
	stateSinkObject.Save(8, &e.workerStarted)
	stateSinkObject.Save(9, &e.addr)
	stateSinkObject.Save(10, &e.mtu)
}

func (e *serverEndpoint) afterLoad(context.Context) {}

// +checklocksignore
func (e *serverEndpoint) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &e.bufferSize)
	stateSourceObject.Load(1, &e.rx)
	stateSourceObject.Load(2, &e.stopRequested)
	stateSourceObject.Load(3, &e.peerFD)
	stateSourceObject.Load(4, &e.caps)
	stateSourceObject.Load(5, &e.hdrSize)
	stateSourceObject.Load(6, &e.virtioNetHeaderRequired)
	stateSourceObject.Load(7, &e.tx)
	stateSourceObject.Load(8, &e.workerStarted)
	stateSourceObject.Load(9, &e.addr)
	stateSourceObject.Load(10, &e.mtu)
}

func init() {
	state.Register((*serverRx)(nil))
	state.Register((*serverTx)(nil))
	state.Register((*QueueConfig)(nil))
	state.Register((*Options)(nil))
	state.Register((*endpoint)(nil))
	state.Register((*serverEndpoint)(nil))
}
