github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/platform/kvm/kvm_unsafe_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  //go:build go1.18 && go1.18
     4  // +build go1.18,go1.18
     5  
     6  package kvm
     7  
     8  import (
     9  	"context"
    10  
    11  	"github.com/metacubex/gvisor/pkg/state"
    12  )
    13  
    14  func (p *machineAtomicPtr) StateTypeName() string {
    15  	return "pkg/sentry/platform/kvm.machineAtomicPtr"
    16  }
    17  
    18  func (p *machineAtomicPtr) StateFields() []string {
    19  	return []string{
    20  		"ptr",
    21  	}
    22  }
    23  
    24  func (p *machineAtomicPtr) beforeSave() {}
    25  
    26  // +checklocksignore
    27  func (p *machineAtomicPtr) StateSave(stateSinkObject state.Sink) {
    28  	p.beforeSave()
    29  	var ptrValue *machine
    30  	ptrValue = p.savePtr()
    31  	stateSinkObject.SaveValue(0, ptrValue)
    32  }
    33  
    34  func (p *machineAtomicPtr) afterLoad(context.Context) {}
    35  
    36  // +checklocksignore
    37  func (p *machineAtomicPtr) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    38  	stateSourceObject.LoadValue(0, new(*machine), func(y any) { p.loadPtr(ctx, y.(*machine)) })
    39  }
    40  
    41  func init() {
    42  	state.Register((*machineAtomicPtr)(nil))
    43  }