// automatically generated by stateify.

package mq

import (
	"context"

	"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(context.Context) {}

// +checklocksignore
func (l *msgList) StateLoad(ctx context.Context, 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(context.Context) {}

// +checklocksignore
func (e *msgEntry) StateLoad(ctx context.Context, 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(context.Context) {}

// +checklocksignore
func (r *Registry) StateLoad(ctx context.Context, 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(context.Context) {}

// +checklocksignore
func (q *Queue) StateLoad(ctx context.Context, 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 (r *ReaderWriter) StateTypeName() string {
	return "pkg/sentry/kernel/mq.ReaderWriter"
}

func (r *ReaderWriter) StateFields() []string {
	return []string{
		"Queue",
		"block",
	}
}

func (r *ReaderWriter) beforeSave() {}

// +checklocksignore
func (r *ReaderWriter) StateSave(stateSinkObject state.Sink) {
	r.beforeSave()
	stateSinkObject.Save(0, &r.Queue)
	stateSinkObject.Save(1, &r.block)
}

func (r *ReaderWriter) afterLoad(context.Context) {}

// +checklocksignore
func (r *ReaderWriter) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &r.Queue)
	stateSourceObject.Load(1, &r.block)
}

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

func (r *Reader) StateFields() []string {
	return []string{
		"Queue",
		"block",
	}
}

func (r *Reader) beforeSave() {}

// +checklocksignore
func (r *Reader) StateSave(stateSinkObject state.Sink) {
	r.beforeSave()
	stateSinkObject.Save(0, &r.Queue)
	stateSinkObject.Save(1, &r.block)
}

func (r *Reader) afterLoad(context.Context) {}

// +checklocksignore
func (r *Reader) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &r.Queue)
	stateSourceObject.Load(1, &r.block)
}

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

func (w *Writer) StateFields() []string {
	return []string{
		"Queue",
		"block",
	}
}

func (w *Writer) beforeSave() {}

// +checklocksignore
func (w *Writer) StateSave(stateSinkObject state.Sink) {
	w.beforeSave()
	stateSinkObject.Save(0, &w.Queue)
	stateSinkObject.Save(1, &w.block)
}

func (w *Writer) afterLoad(context.Context) {}

// +checklocksignore
func (w *Writer) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &w.Queue)
	stateSourceObject.Load(1, &w.block)
}

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(context.Context) {}

// +checklocksignore
func (m *Message) StateLoad(ctx context.Context, 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(context.Context) {}

// +checklocksignore
func (s *Subscriber) StateLoad(ctx context.Context, 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((*ReaderWriter)(nil))
	state.Register((*Reader)(nil))
	state.Register((*Writer)(nil))
	state.Register((*Message)(nil))
	state.Register((*Subscriber)(nil))
}
