// automatically generated by stateify.

package erofs

import (
	"context"

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

func (sb *SuperBlock) StateTypeName() string {
	return "pkg/erofs.SuperBlock"
}

func (sb *SuperBlock) StateFields() []string {
	return []string{
		"Magic",
		"Checksum",
		"FeatureCompat",
		"BlockSizeBits",
		"ExtSlots",
		"RootNid",
		"Inodes",
		"BuildTime",
		"BuildTimeNsec",
		"Blocks",
		"MetaBlockAddr",
		"XattrBlockAddr",
		"UUID",
		"VolumeName",
		"FeatureIncompat",
		"Union1",
		"ExtraDevices",
		"DevTableSlotOff",
		"Reserved",
	}
}

func (sb *SuperBlock) beforeSave() {}

// +checklocksignore
func (sb *SuperBlock) StateSave(stateSinkObject state.Sink) {
	sb.beforeSave()
	stateSinkObject.Save(0, &sb.Magic)
	stateSinkObject.Save(1, &sb.Checksum)
	stateSinkObject.Save(2, &sb.FeatureCompat)
	stateSinkObject.Save(3, &sb.BlockSizeBits)
	stateSinkObject.Save(4, &sb.ExtSlots)
	stateSinkObject.Save(5, &sb.RootNid)
	stateSinkObject.Save(6, &sb.Inodes)
	stateSinkObject.Save(7, &sb.BuildTime)
	stateSinkObject.Save(8, &sb.BuildTimeNsec)
	stateSinkObject.Save(9, &sb.Blocks)
	stateSinkObject.Save(10, &sb.MetaBlockAddr)
	stateSinkObject.Save(11, &sb.XattrBlockAddr)
	stateSinkObject.Save(12, &sb.UUID)
	stateSinkObject.Save(13, &sb.VolumeName)
	stateSinkObject.Save(14, &sb.FeatureIncompat)
	stateSinkObject.Save(15, &sb.Union1)
	stateSinkObject.Save(16, &sb.ExtraDevices)
	stateSinkObject.Save(17, &sb.DevTableSlotOff)
	stateSinkObject.Save(18, &sb.Reserved)
}

func (sb *SuperBlock) afterLoad(context.Context) {}

// +checklocksignore
func (sb *SuperBlock) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &sb.Magic)
	stateSourceObject.Load(1, &sb.Checksum)
	stateSourceObject.Load(2, &sb.FeatureCompat)
	stateSourceObject.Load(3, &sb.BlockSizeBits)
	stateSourceObject.Load(4, &sb.ExtSlots)
	stateSourceObject.Load(5, &sb.RootNid)
	stateSourceObject.Load(6, &sb.Inodes)
	stateSourceObject.Load(7, &sb.BuildTime)
	stateSourceObject.Load(8, &sb.BuildTimeNsec)
	stateSourceObject.Load(9, &sb.Blocks)
	stateSourceObject.Load(10, &sb.MetaBlockAddr)
	stateSourceObject.Load(11, &sb.XattrBlockAddr)
	stateSourceObject.Load(12, &sb.UUID)
	stateSourceObject.Load(13, &sb.VolumeName)
	stateSourceObject.Load(14, &sb.FeatureIncompat)
	stateSourceObject.Load(15, &sb.Union1)
	stateSourceObject.Load(16, &sb.ExtraDevices)
	stateSourceObject.Load(17, &sb.DevTableSlotOff)
	stateSourceObject.Load(18, &sb.Reserved)
}

func (i *Image) StateTypeName() string {
	return "pkg/erofs.Image"
}

func (i *Image) StateFields() []string {
	return []string{
		"sb",
	}
}

func (i *Image) beforeSave() {}

// +checklocksignore
func (i *Image) StateSave(stateSinkObject state.Sink) {
	i.beforeSave()
	stateSinkObject.Save(0, &i.sb)
}

func (i *Image) afterLoad(context.Context) {}

// +checklocksignore
func (i *Image) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &i.sb)
}

func (i *Inode) StateTypeName() string {
	return "pkg/erofs.Inode"
}

func (i *Inode) StateFields() []string {
	return []string{
		"image",
		"dataOff",
		"idataOff",
		"blocks",
		"format",
		"mode",
		"nid",
		"size",
		"mtime",
		"mtimeNsec",
		"uid",
		"gid",
		"nlink",
	}
}

func (i *Inode) beforeSave() {}

// +checklocksignore
func (i *Inode) StateSave(stateSinkObject state.Sink) {
	i.beforeSave()
	stateSinkObject.Save(0, &i.image)
	stateSinkObject.Save(1, &i.dataOff)
	stateSinkObject.Save(2, &i.idataOff)
	stateSinkObject.Save(3, &i.blocks)
	stateSinkObject.Save(4, &i.format)
	stateSinkObject.Save(5, &i.mode)
	stateSinkObject.Save(6, &i.nid)
	stateSinkObject.Save(7, &i.size)
	stateSinkObject.Save(8, &i.mtime)
	stateSinkObject.Save(9, &i.mtimeNsec)
	stateSinkObject.Save(10, &i.uid)
	stateSinkObject.Save(11, &i.gid)
	stateSinkObject.Save(12, &i.nlink)
}

func (i *Inode) afterLoad(context.Context) {}

// +checklocksignore
func (i *Inode) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &i.image)
	stateSourceObject.Load(1, &i.dataOff)
	stateSourceObject.Load(2, &i.idataOff)
	stateSourceObject.Load(3, &i.blocks)
	stateSourceObject.Load(4, &i.format)
	stateSourceObject.Load(5, &i.mode)
	stateSourceObject.Load(6, &i.nid)
	stateSourceObject.Load(7, &i.size)
	stateSourceObject.Load(8, &i.mtime)
	stateSourceObject.Load(9, &i.mtimeNsec)
	stateSourceObject.Load(10, &i.uid)
	stateSourceObject.Load(11, &i.gid)
	stateSourceObject.Load(12, &i.nlink)
}

func init() {
	state.Register((*SuperBlock)(nil))
	state.Register((*Image)(nil))
	state.Register((*Inode)(nil))
}
