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

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