github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/kernel/futex/futex_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  package futex
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/metacubex/gvisor/pkg/state"
     9  )
    10  
    11  func (b *bucket) StateTypeName() string {
    12  	return "pkg/sentry/kernel/futex.bucket"
    13  }
    14  
    15  func (b *bucket) StateFields() []string {
    16  	return []string{}
    17  }
    18  
    19  func (b *bucket) beforeSave() {}
    20  
    21  // +checklocksignore
    22  func (b *bucket) StateSave(stateSinkObject state.Sink) {
    23  	b.beforeSave()
    24  	if !state.IsZeroValue(&b.waiters) {
    25  		state.Failf("waiters is %#v, expected zero", &b.waiters)
    26  	}
    27  }
    28  
    29  func (b *bucket) afterLoad(context.Context) {}
    30  
    31  // +checklocksignore
    32  func (b *bucket) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    33  }
    34  
    35  func (m *Manager) StateTypeName() string {
    36  	return "pkg/sentry/kernel/futex.Manager"
    37  }
    38  
    39  func (m *Manager) StateFields() []string {
    40  	return []string{
    41  		"sharedBucket",
    42  	}
    43  }
    44  
    45  func (m *Manager) beforeSave() {}
    46  
    47  // +checklocksignore
    48  func (m *Manager) StateSave(stateSinkObject state.Sink) {
    49  	m.beforeSave()
    50  	if !state.IsZeroValue(&m.privateBuckets) {
    51  		state.Failf("privateBuckets is %#v, expected zero", &m.privateBuckets)
    52  	}
    53  	stateSinkObject.Save(0, &m.sharedBucket)
    54  }
    55  
    56  func (m *Manager) afterLoad(context.Context) {}
    57  
    58  // +checklocksignore
    59  func (m *Manager) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    60  	stateSourceObject.Load(0, &m.sharedBucket)
    61  }
    62  
    63  func (l *waiterList) StateTypeName() string {
    64  	return "pkg/sentry/kernel/futex.waiterList"
    65  }
    66  
    67  func (l *waiterList) StateFields() []string {
    68  	return []string{
    69  		"head",
    70  		"tail",
    71  	}
    72  }
    73  
    74  func (l *waiterList) beforeSave() {}
    75  
    76  // +checklocksignore
    77  func (l *waiterList) StateSave(stateSinkObject state.Sink) {
    78  	l.beforeSave()
    79  	stateSinkObject.Save(0, &l.head)
    80  	stateSinkObject.Save(1, &l.tail)
    81  }
    82  
    83  func (l *waiterList) afterLoad(context.Context) {}
    84  
    85  // +checklocksignore
    86  func (l *waiterList) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    87  	stateSourceObject.Load(0, &l.head)
    88  	stateSourceObject.Load(1, &l.tail)
    89  }
    90  
    91  func (e *waiterEntry) StateTypeName() string {
    92  	return "pkg/sentry/kernel/futex.waiterEntry"
    93  }
    94  
    95  func (e *waiterEntry) StateFields() []string {
    96  	return []string{
    97  		"next",
    98  		"prev",
    99  	}
   100  }
   101  
   102  func (e *waiterEntry) beforeSave() {}
   103  
   104  // +checklocksignore
   105  func (e *waiterEntry) StateSave(stateSinkObject state.Sink) {
   106  	e.beforeSave()
   107  	stateSinkObject.Save(0, &e.next)
   108  	stateSinkObject.Save(1, &e.prev)
   109  }
   110  
   111  func (e *waiterEntry) afterLoad(context.Context) {}
   112  
   113  // +checklocksignore
   114  func (e *waiterEntry) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   115  	stateSourceObject.Load(0, &e.next)
   116  	stateSourceObject.Load(1, &e.prev)
   117  }
   118  
   119  func init() {
   120  	state.Register((*bucket)(nil))
   121  	state.Register((*Manager)(nil))
   122  	state.Register((*waiterList)(nil))
   123  	state.Register((*waiterEntry)(nil))
   124  }