// automatically generated by stateify.

package fsutil

import (
	"context"

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

func (s *DirtySet) StateTypeName() string {
	return "pkg/sentry/fsutil.DirtySet"
}

func (s *DirtySet) StateFields() []string {
	return []string{
		"root",
	}
}

func (s *DirtySet) beforeSave() {}

// +checklocksignore
func (s *DirtySet) StateSave(stateSinkObject state.Sink) {
	s.beforeSave()
	rootValue := s.saveRoot()
	_ = ([]DirtyFlatSegment)(rootValue)
	stateSinkObject.SaveValue(0, rootValue)
}

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

// +checklocksignore
func (s *DirtySet) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.LoadValue(0, new([]DirtyFlatSegment), func(y any) { s.loadRoot(ctx, y.([]DirtyFlatSegment)) })
}

func (n *Dirtynode) StateTypeName() string {
	return "pkg/sentry/fsutil.Dirtynode"
}

func (n *Dirtynode) StateFields() []string {
	return []string{
		"nrSegments",
		"parent",
		"parentIndex",
		"hasChildren",
		"maxGap",
		"keys",
		"values",
		"children",
	}
}

func (n *Dirtynode) beforeSave() {}

// +checklocksignore
func (n *Dirtynode) StateSave(stateSinkObject state.Sink) {
	n.beforeSave()
	stateSinkObject.Save(0, &n.nrSegments)
	stateSinkObject.Save(1, &n.parent)
	stateSinkObject.Save(2, &n.parentIndex)
	stateSinkObject.Save(3, &n.hasChildren)
	stateSinkObject.Save(4, &n.maxGap)
	stateSinkObject.Save(5, &n.keys)
	stateSinkObject.Save(6, &n.values)
	stateSinkObject.Save(7, &n.children)
}

func (n *Dirtynode) afterLoad(context.Context) {}

// +checklocksignore
func (n *Dirtynode) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &n.nrSegments)
	stateSourceObject.Load(1, &n.parent)
	stateSourceObject.Load(2, &n.parentIndex)
	stateSourceObject.Load(3, &n.hasChildren)
	stateSourceObject.Load(4, &n.maxGap)
	stateSourceObject.Load(5, &n.keys)
	stateSourceObject.Load(6, &n.values)
	stateSourceObject.Load(7, &n.children)
}

func (d *DirtyFlatSegment) StateTypeName() string {
	return "pkg/sentry/fsutil.DirtyFlatSegment"
}

func (d *DirtyFlatSegment) StateFields() []string {
	return []string{
		"Start",
		"End",
		"Value",
	}
}

func (d *DirtyFlatSegment) beforeSave() {}

// +checklocksignore
func (d *DirtyFlatSegment) StateSave(stateSinkObject state.Sink) {
	d.beforeSave()
	stateSinkObject.Save(0, &d.Start)
	stateSinkObject.Save(1, &d.End)
	stateSinkObject.Save(2, &d.Value)
}

func (d *DirtyFlatSegment) afterLoad(context.Context) {}

// +checklocksignore
func (d *DirtyFlatSegment) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &d.Start)
	stateSourceObject.Load(1, &d.End)
	stateSourceObject.Load(2, &d.Value)
}

func (s *FileRangeSet) StateTypeName() string {
	return "pkg/sentry/fsutil.FileRangeSet"
}

func (s *FileRangeSet) StateFields() []string {
	return []string{
		"root",
	}
}

func (s *FileRangeSet) beforeSave() {}

// +checklocksignore
func (s *FileRangeSet) StateSave(stateSinkObject state.Sink) {
	s.beforeSave()
	rootValue := s.saveRoot()
	_ = ([]FileRangeFlatSegment)(rootValue)
	stateSinkObject.SaveValue(0, rootValue)
}

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

// +checklocksignore
func (s *FileRangeSet) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.LoadValue(0, new([]FileRangeFlatSegment), func(y any) { s.loadRoot(ctx, y.([]FileRangeFlatSegment)) })
}

func (n *FileRangenode) StateTypeName() string {
	return "pkg/sentry/fsutil.FileRangenode"
}

func (n *FileRangenode) StateFields() []string {
	return []string{
		"nrSegments",
		"parent",
		"parentIndex",
		"hasChildren",
		"maxGap",
		"keys",
		"values",
		"children",
	}
}

func (n *FileRangenode) beforeSave() {}

// +checklocksignore
func (n *FileRangenode) StateSave(stateSinkObject state.Sink) {
	n.beforeSave()
	stateSinkObject.Save(0, &n.nrSegments)
	stateSinkObject.Save(1, &n.parent)
	stateSinkObject.Save(2, &n.parentIndex)
	stateSinkObject.Save(3, &n.hasChildren)
	stateSinkObject.Save(4, &n.maxGap)
	stateSinkObject.Save(5, &n.keys)
	stateSinkObject.Save(6, &n.values)
	stateSinkObject.Save(7, &n.children)
}

func (n *FileRangenode) afterLoad(context.Context) {}

// +checklocksignore
func (n *FileRangenode) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &n.nrSegments)
	stateSourceObject.Load(1, &n.parent)
	stateSourceObject.Load(2, &n.parentIndex)
	stateSourceObject.Load(3, &n.hasChildren)
	stateSourceObject.Load(4, &n.maxGap)
	stateSourceObject.Load(5, &n.keys)
	stateSourceObject.Load(6, &n.values)
	stateSourceObject.Load(7, &n.children)
}

func (f *FileRangeFlatSegment) StateTypeName() string {
	return "pkg/sentry/fsutil.FileRangeFlatSegment"
}

func (f *FileRangeFlatSegment) StateFields() []string {
	return []string{
		"Start",
		"End",
		"Value",
	}
}

func (f *FileRangeFlatSegment) beforeSave() {}

// +checklocksignore
func (f *FileRangeFlatSegment) StateSave(stateSinkObject state.Sink) {
	f.beforeSave()
	stateSinkObject.Save(0, &f.Start)
	stateSinkObject.Save(1, &f.End)
	stateSinkObject.Save(2, &f.Value)
}

func (f *FileRangeFlatSegment) afterLoad(context.Context) {}

// +checklocksignore
func (f *FileRangeFlatSegment) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &f.Start)
	stateSourceObject.Load(1, &f.End)
	stateSourceObject.Load(2, &f.Value)
}

func (s *FrameRefSet) StateTypeName() string {
	return "pkg/sentry/fsutil.FrameRefSet"
}

func (s *FrameRefSet) StateFields() []string {
	return []string{
		"root",
	}
}

func (s *FrameRefSet) beforeSave() {}

// +checklocksignore
func (s *FrameRefSet) StateSave(stateSinkObject state.Sink) {
	s.beforeSave()
	rootValue := s.saveRoot()
	_ = ([]FrameRefFlatSegment)(rootValue)
	stateSinkObject.SaveValue(0, rootValue)
}

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

// +checklocksignore
func (s *FrameRefSet) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.LoadValue(0, new([]FrameRefFlatSegment), func(y any) { s.loadRoot(ctx, y.([]FrameRefFlatSegment)) })
}

func (n *FrameRefnode) StateTypeName() string {
	return "pkg/sentry/fsutil.FrameRefnode"
}

func (n *FrameRefnode) StateFields() []string {
	return []string{
		"nrSegments",
		"parent",
		"parentIndex",
		"hasChildren",
		"maxGap",
		"keys",
		"values",
		"children",
	}
}

func (n *FrameRefnode) beforeSave() {}

// +checklocksignore
func (n *FrameRefnode) StateSave(stateSinkObject state.Sink) {
	n.beforeSave()
	stateSinkObject.Save(0, &n.nrSegments)
	stateSinkObject.Save(1, &n.parent)
	stateSinkObject.Save(2, &n.parentIndex)
	stateSinkObject.Save(3, &n.hasChildren)
	stateSinkObject.Save(4, &n.maxGap)
	stateSinkObject.Save(5, &n.keys)
	stateSinkObject.Save(6, &n.values)
	stateSinkObject.Save(7, &n.children)
}

func (n *FrameRefnode) afterLoad(context.Context) {}

// +checklocksignore
func (n *FrameRefnode) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &n.nrSegments)
	stateSourceObject.Load(1, &n.parent)
	stateSourceObject.Load(2, &n.parentIndex)
	stateSourceObject.Load(3, &n.hasChildren)
	stateSourceObject.Load(4, &n.maxGap)
	stateSourceObject.Load(5, &n.keys)
	stateSourceObject.Load(6, &n.values)
	stateSourceObject.Load(7, &n.children)
}

func (f *FrameRefFlatSegment) StateTypeName() string {
	return "pkg/sentry/fsutil.FrameRefFlatSegment"
}

func (f *FrameRefFlatSegment) StateFields() []string {
	return []string{
		"Start",
		"End",
		"Value",
	}
}

func (f *FrameRefFlatSegment) beforeSave() {}

// +checklocksignore
func (f *FrameRefFlatSegment) StateSave(stateSinkObject state.Sink) {
	f.beforeSave()
	stateSinkObject.Save(0, &f.Start)
	stateSinkObject.Save(1, &f.End)
	stateSinkObject.Save(2, &f.Value)
}

func (f *FrameRefFlatSegment) afterLoad(context.Context) {}

// +checklocksignore
func (f *FrameRefFlatSegment) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &f.Start)
	stateSourceObject.Load(1, &f.End)
	stateSourceObject.Load(2, &f.Value)
}

func init() {
	state.Register((*DirtySet)(nil))
	state.Register((*Dirtynode)(nil))
	state.Register((*DirtyFlatSegment)(nil))
	state.Register((*FileRangeSet)(nil))
	state.Register((*FileRangenode)(nil))
	state.Register((*FileRangeFlatSegment)(nil))
	state.Register((*FrameRefSet)(nil))
	state.Register((*FrameRefnode)(nil))
	state.Register((*FrameRefFlatSegment)(nil))
}
