// automatically generated by stateify.

package erofs

import (
	"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() {}

// +checklocksignore
func (sb *SuperBlock) StateLoad(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() {}

// +checklocksignore
func (i *Image) StateLoad(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",
		"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.format)
	stateSinkObject.Save(4, &i.mode)
	stateSinkObject.Save(5, &i.nid)
	stateSinkObject.Save(6, &i.size)
	stateSinkObject.Save(7, &i.mtime)
	stateSinkObject.Save(8, &i.mtimeNsec)
	stateSinkObject.Save(9, &i.uid)
	stateSinkObject.Save(10, &i.gid)
	stateSinkObject.Save(11, &i.nlink)
}

func (i *Inode) afterLoad() {}

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

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