github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/fsutil/fsutil_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  package fsutil
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/metacubex/gvisor/pkg/state"
     9  )
    10  
    11  func (d *DirtyInfo) StateTypeName() string {
    12  	return "pkg/sentry/fsutil.DirtyInfo"
    13  }
    14  
    15  func (d *DirtyInfo) StateFields() []string {
    16  	return []string{
    17  		"Keep",
    18  	}
    19  }
    20  
    21  func (d *DirtyInfo) beforeSave() {}
    22  
    23  // +checklocksignore
    24  func (d *DirtyInfo) StateSave(stateSinkObject state.Sink) {
    25  	d.beforeSave()
    26  	stateSinkObject.Save(0, &d.Keep)
    27  }
    28  
    29  func (d *DirtyInfo) afterLoad(context.Context) {}
    30  
    31  // +checklocksignore
    32  func (d *DirtyInfo) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    33  	stateSourceObject.Load(0, &d.Keep)
    34  }
    35  
    36  func (f *HostFileMapper) StateTypeName() string {
    37  	return "pkg/sentry/fsutil.HostFileMapper"
    38  }
    39  
    40  func (f *HostFileMapper) StateFields() []string {
    41  	return []string{
    42  		"refs",
    43  	}
    44  }
    45  
    46  func (f *HostFileMapper) beforeSave() {}
    47  
    48  // +checklocksignore
    49  func (f *HostFileMapper) StateSave(stateSinkObject state.Sink) {
    50  	f.beforeSave()
    51  	stateSinkObject.Save(0, &f.refs)
    52  }
    53  
    54  // +checklocksignore
    55  func (f *HostFileMapper) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    56  	stateSourceObject.Load(0, &f.refs)
    57  	stateSourceObject.AfterLoad(func() { f.afterLoad(ctx) })
    58  }
    59  
    60  func init() {
    61  	state.Register((*DirtyInfo)(nil))
    62  	state.Register((*HostFileMapper)(nil))
    63  }