// automatically generated by stateify.

package mq

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

func (l *msgList) StateTypeName() string {
	return "pkg/sentry/kernel/mq.msgList"
}

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

func (l *msgList) beforeSave() {}

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

func (l *msgList) afterLoad() {}

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

func (e *msgEntry) StateTypeName() string {
	return "pkg/sentry/kernel/mq.msgEntry"
}

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

func (e *msgEntry) beforeSave() {}

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

func (e *msgEntry) afterLoad() {}

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

func (r *Registry) StateTypeName() string {
	return "pkg/sentry/kernel/mq.Registry"
}

func (r *Registry) StateFields() []string {
	return []string{
		"userNS",
		"impl",
	}
}

func (r *Registry) beforeSave() {}

// +checklocksignore
func (r *Registry) StateSave(stateSinkObject state.Sink) {
	r.beforeSave()
	stateSinkObject.Save(0, &r.userNS)
	stateSinkObject.Save(1, &r.impl)
}

func (r *Registry) afterLoad() {}

// +checklocksignore
func (r *Registry) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &r.userNS)
	stateSourceObject.Load(1, &r.impl)
}

func (q *Queue) StateTypeName() string {
	return "pkg/sentry/kernel/mq.Queue"
}

func (q *Queue) StateFields() []string {
	return []string{
		"ownerUID",
		"ownerGID",
		"mode",
		"queue",
		"messages",
		"subscriber",
		"messageCount",
		"maxMessageCount",
		"maxMessageSize",
		"byteCount",
	}
}

func (q *Queue) beforeSave() {}

// +checklocksignore
func (q *Queue) StateSave(stateSinkObject state.Sink) {
	q.beforeSave()
	stateSinkObject.Save(0, &q.ownerUID)
	stateSinkObject.Save(1, &q.ownerGID)
	stateSinkObject.Save(2, &q.mode)
	stateSinkObject.Save(3, &q.queue)
	stateSinkObject.Save(4, &q.messages)
	stateSinkObject.Save(5, &q.subscriber)
	stateSinkObject.Save(6, &q.messageCount)
	stateSinkObject.Save(7, &q.maxMessageCount)
	stateSinkObject.Save(8, &q.maxMessageSize)
	stateSinkObject.Save(9, &q.byteCount)
}

func (q *Queue) afterLoad() {}

// +checklocksignore
func (q *Queue) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &q.ownerUID)
	stateSourceObject.Load(1, &q.ownerGID)
	stateSourceObject.Load(2, &q.mode)
	stateSourceObject.Load(3, &q.queue)
	stateSourceObject.Load(4, &q.messages)
	stateSourceObject.Load(5, &q.subscriber)
	stateSourceObject.Load(6, &q.messageCount)
	stateSourceObject.Load(7, &q.maxMessageCount)
	stateSourceObject.Load(8, &q.maxMessageSize)
	stateSourceObject.Load(9, &q.byteCount)
}

func (m *Message) StateTypeName() string {
	return "pkg/sentry/kernel/mq.Message"
}

func (m *Message) StateFields() []string {
	return []string{
		"msgEntry",
		"Text",
		"Size",
		"Priority",
	}
}

func (m *Message) beforeSave() {}

// +checklocksignore
func (m *Message) StateSave(stateSinkObject state.Sink) {
	m.beforeSave()
	stateSinkObject.Save(0, &m.msgEntry)
	stateSinkObject.Save(1, &m.Text)
	stateSinkObject.Save(2, &m.Size)
	stateSinkObject.Save(3, &m.Priority)
}

func (m *Message) afterLoad() {}

// +checklocksignore
func (m *Message) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &m.msgEntry)
	stateSourceObject.Load(1, &m.Text)
	stateSourceObject.Load(2, &m.Size)
	stateSourceObject.Load(3, &m.Priority)
}

func (s *Subscriber) StateTypeName() string {
	return "pkg/sentry/kernel/mq.Subscriber"
}

func (s *Subscriber) StateFields() []string {
	return []string{
		"pid",
	}
}

func (s *Subscriber) beforeSave() {}

// +checklocksignore
func (s *Subscriber) StateSave(stateSinkObject state.Sink) {
	s.beforeSave()
	stateSinkObject.Save(0, &s.pid)
}

func (s *Subscriber) afterLoad() {}

// +checklocksignore
func (s *Subscriber) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &s.pid)
}

func init() {
	state.Register((*msgList)(nil))
	state.Register((*msgEntry)(nil))
	state.Register((*Registry)(nil))
	state.Register((*Queue)(nil))
	state.Register((*Message)(nil))
	state.Register((*Subscriber)(nil))
}
