// automatically generated by stateify.

package ipc

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

func (o *Object) StateTypeName() string {
	return "pkg/sentry/kernel/ipc.Object"
}

func (o *Object) StateFields() []string {
	return []string{
		"UserNS",
		"ID",
		"Key",
		"CreatorUID",
		"CreatorGID",
		"OwnerUID",
		"OwnerGID",
		"Mode",
	}
}

func (o *Object) beforeSave() {}

// +checklocksignore
func (o *Object) StateSave(stateSinkObject state.Sink) {
	o.beforeSave()
	stateSinkObject.Save(0, &o.UserNS)
	stateSinkObject.Save(1, &o.ID)
	stateSinkObject.Save(2, &o.Key)
	stateSinkObject.Save(3, &o.CreatorUID)
	stateSinkObject.Save(4, &o.CreatorGID)
	stateSinkObject.Save(5, &o.OwnerUID)
	stateSinkObject.Save(6, &o.OwnerGID)
	stateSinkObject.Save(7, &o.Mode)
}

func (o *Object) afterLoad() {}

// +checklocksignore
func (o *Object) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &o.UserNS)
	stateSourceObject.Load(1, &o.ID)
	stateSourceObject.Load(2, &o.Key)
	stateSourceObject.Load(3, &o.CreatorUID)
	stateSourceObject.Load(4, &o.CreatorGID)
	stateSourceObject.Load(5, &o.OwnerUID)
	stateSourceObject.Load(6, &o.OwnerGID)
	stateSourceObject.Load(7, &o.Mode)
}

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

func (r *Registry) StateFields() []string {
	return []string{
		"UserNS",
		"objects",
		"keysToIDs",
		"lastIDUsed",
	}
}

func (r *Registry) beforeSave() {}

// +checklocksignore
func (r *Registry) StateSave(stateSinkObject state.Sink) {
	r.beforeSave()
	stateSinkObject.Save(0, &r.UserNS)
	stateSinkObject.Save(1, &r.objects)
	stateSinkObject.Save(2, &r.keysToIDs)
	stateSinkObject.Save(3, &r.lastIDUsed)
}

func (r *Registry) afterLoad() {}

// +checklocksignore
func (r *Registry) StateLoad(stateSourceObject state.Source) {
	stateSourceObject.Load(0, &r.UserNS)
	stateSourceObject.Load(1, &r.objects)
	stateSourceObject.Load(2, &r.keysToIDs)
	stateSourceObject.Load(3, &r.lastIDUsed)
}

func init() {
	state.Register((*Object)(nil))
	state.Register((*Registry)(nil))
}
