// automatically generated by stateify.

//go:build systrap_profiling && !systrap_profiling
// +build systrap_profiling,!systrap_profiling

package systrap

import (
	"context"

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

func (l *contextList) StateTypeName() string {
	return "pkg/sentry/platform/systrap.contextList"
}

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

func (l *contextList) beforeSave() {}

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

func (l *contextList) afterLoad(context.Context) {}

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

func (e *contextEntry) StateTypeName() string {
	return "pkg/sentry/platform/systrap.contextEntry"
}

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

func (e *contextEntry) beforeSave() {}

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

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

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

func (r *subprocessRefs) StateTypeName() string {
	return "pkg/sentry/platform/systrap.subprocessRefs"
}

func (r *subprocessRefs) StateFields() []string {
	return []string{
		"refCount",
	}
}

func (r *subprocessRefs) beforeSave() {}

// +checklocksignore
func (r *subprocessRefs) StateSave(stateSinkObject state.Sink) {
	r.beforeSave()
	stateSinkObject.Save(0, &r.refCount)
}

// +checklocksignore
func (r *subprocessRefs) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &r.refCount)
	stateSourceObject.AfterLoad(func() { r.afterLoad(ctx) })
}

func init() {
	state.Register((*contextList)(nil))
	state.Register((*contextEntry)(nil))
	state.Register((*subprocessRefs)(nil))
}
