github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/fsimpl/lock/lock_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  package lock
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/metacubex/gvisor/pkg/state"
     9  )
    10  
    11  func (o *OwnerInfo) StateTypeName() string {
    12  	return "pkg/sentry/fsimpl/lock.OwnerInfo"
    13  }
    14  
    15  func (o *OwnerInfo) StateFields() []string {
    16  	return []string{
    17  		"PID",
    18  		"OFD",
    19  	}
    20  }
    21  
    22  func (o *OwnerInfo) beforeSave() {}
    23  
    24  // +checklocksignore
    25  func (o *OwnerInfo) StateSave(stateSinkObject state.Sink) {
    26  	o.beforeSave()
    27  	stateSinkObject.Save(0, &o.PID)
    28  	stateSinkObject.Save(1, &o.OFD)
    29  }
    30  
    31  func (o *OwnerInfo) afterLoad(context.Context) {}
    32  
    33  // +checklocksignore
    34  func (o *OwnerInfo) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    35  	stateSourceObject.Load(0, &o.PID)
    36  	stateSourceObject.Load(1, &o.OFD)
    37  }
    38  
    39  func (l *Lock) StateTypeName() string {
    40  	return "pkg/sentry/fsimpl/lock.Lock"
    41  }
    42  
    43  func (l *Lock) StateFields() []string {
    44  	return []string{
    45  		"Readers",
    46  		"Writer",
    47  		"WriterInfo",
    48  	}
    49  }
    50  
    51  func (l *Lock) beforeSave() {}
    52  
    53  // +checklocksignore
    54  func (l *Lock) StateSave(stateSinkObject state.Sink) {
    55  	l.beforeSave()
    56  	stateSinkObject.Save(0, &l.Readers)
    57  	stateSinkObject.Save(1, &l.Writer)
    58  	stateSinkObject.Save(2, &l.WriterInfo)
    59  }
    60  
    61  func (l *Lock) afterLoad(context.Context) {}
    62  
    63  // +checklocksignore
    64  func (l *Lock) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    65  	stateSourceObject.Load(0, &l.Readers)
    66  	stateSourceObject.Load(1, &l.Writer)
    67  	stateSourceObject.Load(2, &l.WriterInfo)
    68  }
    69  
    70  func (l *Locks) StateTypeName() string {
    71  	return "pkg/sentry/fsimpl/lock.Locks"
    72  }
    73  
    74  func (l *Locks) StateFields() []string {
    75  	return []string{
    76  		"locks",
    77  		"blockedQueue",
    78  	}
    79  }
    80  
    81  func (l *Locks) beforeSave() {}
    82  
    83  // +checklocksignore
    84  func (l *Locks) StateSave(stateSinkObject state.Sink) {
    85  	l.beforeSave()
    86  	stateSinkObject.Save(0, &l.locks)
    87  	stateSinkObject.Save(1, &l.blockedQueue)
    88  }
    89  
    90  func (l *Locks) afterLoad(context.Context) {}
    91  
    92  // +checklocksignore
    93  func (l *Locks) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    94  	stateSourceObject.Load(0, &l.locks)
    95  	stateSourceObject.Load(1, &l.blockedQueue)
    96  }
    97  
    98  func (r *LockRange) StateTypeName() string {
    99  	return "pkg/sentry/fsimpl/lock.LockRange"
   100  }
   101  
   102  func (r *LockRange) StateFields() []string {
   103  	return []string{
   104  		"Start",
   105  		"End",
   106  	}
   107  }
   108  
   109  func (r *LockRange) beforeSave() {}
   110  
   111  // +checklocksignore
   112  func (r *LockRange) StateSave(stateSinkObject state.Sink) {
   113  	r.beforeSave()
   114  	stateSinkObject.Save(0, &r.Start)
   115  	stateSinkObject.Save(1, &r.End)
   116  }
   117  
   118  func (r *LockRange) afterLoad(context.Context) {}
   119  
   120  // +checklocksignore
   121  func (r *LockRange) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   122  	stateSourceObject.Load(0, &r.Start)
   123  	stateSourceObject.Load(1, &r.End)
   124  }
   125  
   126  func (s *LockSet) StateTypeName() string {
   127  	return "pkg/sentry/fsimpl/lock.LockSet"
   128  }
   129  
   130  func (s *LockSet) StateFields() []string {
   131  	return []string{
   132  		"root",
   133  	}
   134  }
   135  
   136  func (s *LockSet) beforeSave() {}
   137  
   138  // +checklocksignore
   139  func (s *LockSet) StateSave(stateSinkObject state.Sink) {
   140  	s.beforeSave()
   141  	var rootValue []LockFlatSegment
   142  	rootValue = s.saveRoot()
   143  	stateSinkObject.SaveValue(0, rootValue)
   144  }
   145  
   146  func (s *LockSet) afterLoad(context.Context) {}
   147  
   148  // +checklocksignore
   149  func (s *LockSet) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   150  	stateSourceObject.LoadValue(0, new([]LockFlatSegment), func(y any) { s.loadRoot(ctx, y.([]LockFlatSegment)) })
   151  }
   152  
   153  func (n *Locknode) StateTypeName() string {
   154  	return "pkg/sentry/fsimpl/lock.Locknode"
   155  }
   156  
   157  func (n *Locknode) StateFields() []string {
   158  	return []string{
   159  		"nrSegments",
   160  		"parent",
   161  		"parentIndex",
   162  		"hasChildren",
   163  		"maxGap",
   164  		"keys",
   165  		"values",
   166  		"children",
   167  	}
   168  }
   169  
   170  func (n *Locknode) beforeSave() {}
   171  
   172  // +checklocksignore
   173  func (n *Locknode) StateSave(stateSinkObject state.Sink) {
   174  	n.beforeSave()
   175  	stateSinkObject.Save(0, &n.nrSegments)
   176  	stateSinkObject.Save(1, &n.parent)
   177  	stateSinkObject.Save(2, &n.parentIndex)
   178  	stateSinkObject.Save(3, &n.hasChildren)
   179  	stateSinkObject.Save(4, &n.maxGap)
   180  	stateSinkObject.Save(5, &n.keys)
   181  	stateSinkObject.Save(6, &n.values)
   182  	stateSinkObject.Save(7, &n.children)
   183  }
   184  
   185  func (n *Locknode) afterLoad(context.Context) {}
   186  
   187  // +checklocksignore
   188  func (n *Locknode) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   189  	stateSourceObject.Load(0, &n.nrSegments)
   190  	stateSourceObject.Load(1, &n.parent)
   191  	stateSourceObject.Load(2, &n.parentIndex)
   192  	stateSourceObject.Load(3, &n.hasChildren)
   193  	stateSourceObject.Load(4, &n.maxGap)
   194  	stateSourceObject.Load(5, &n.keys)
   195  	stateSourceObject.Load(6, &n.values)
   196  	stateSourceObject.Load(7, &n.children)
   197  }
   198  
   199  func (l *LockFlatSegment) StateTypeName() string {
   200  	return "pkg/sentry/fsimpl/lock.LockFlatSegment"
   201  }
   202  
   203  func (l *LockFlatSegment) StateFields() []string {
   204  	return []string{
   205  		"Start",
   206  		"End",
   207  		"Value",
   208  	}
   209  }
   210  
   211  func (l *LockFlatSegment) beforeSave() {}
   212  
   213  // +checklocksignore
   214  func (l *LockFlatSegment) StateSave(stateSinkObject state.Sink) {
   215  	l.beforeSave()
   216  	stateSinkObject.Save(0, &l.Start)
   217  	stateSinkObject.Save(1, &l.End)
   218  	stateSinkObject.Save(2, &l.Value)
   219  }
   220  
   221  func (l *LockFlatSegment) afterLoad(context.Context) {}
   222  
   223  // +checklocksignore
   224  func (l *LockFlatSegment) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   225  	stateSourceObject.Load(0, &l.Start)
   226  	stateSourceObject.Load(1, &l.End)
   227  	stateSourceObject.Load(2, &l.Value)
   228  }
   229  
   230  func init() {
   231  	state.Register((*OwnerInfo)(nil))
   232  	state.Register((*Lock)(nil))
   233  	state.Register((*Locks)(nil))
   234  	state.Register((*LockRange)(nil))
   235  	state.Register((*LockSet)(nil))
   236  	state.Register((*Locknode)(nil))
   237  	state.Register((*LockFlatSegment)(nil))
   238  }