github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/kernel/semaphore/semaphore_state_autogen.go (about) 1 // automatically generated by stateify. 2 3 package semaphore 4 5 import ( 6 "context" 7 8 "github.com/metacubex/gvisor/pkg/state" 9 ) 10 11 func (r *Registry) StateTypeName() string { 12 return "pkg/sentry/kernel/semaphore.Registry" 13 } 14 15 func (r *Registry) StateFields() []string { 16 return []string{ 17 "reg", 18 "indexes", 19 } 20 } 21 22 func (r *Registry) beforeSave() {} 23 24 // +checklocksignore 25 func (r *Registry) StateSave(stateSinkObject state.Sink) { 26 r.beforeSave() 27 stateSinkObject.Save(0, &r.reg) 28 stateSinkObject.Save(1, &r.indexes) 29 } 30 31 func (r *Registry) afterLoad(context.Context) {} 32 33 // +checklocksignore 34 func (r *Registry) StateLoad(ctx context.Context, stateSourceObject state.Source) { 35 stateSourceObject.Load(0, &r.reg) 36 stateSourceObject.Load(1, &r.indexes) 37 } 38 39 func (s *Set) StateTypeName() string { 40 return "pkg/sentry/kernel/semaphore.Set" 41 } 42 43 func (s *Set) StateFields() []string { 44 return []string{ 45 "registry", 46 "obj", 47 "opTime", 48 "changeTime", 49 "sems", 50 "dead", 51 } 52 } 53 54 func (s *Set) beforeSave() {} 55 56 // +checklocksignore 57 func (s *Set) StateSave(stateSinkObject state.Sink) { 58 s.beforeSave() 59 stateSinkObject.Save(0, &s.registry) 60 stateSinkObject.Save(1, &s.obj) 61 stateSinkObject.Save(2, &s.opTime) 62 stateSinkObject.Save(3, &s.changeTime) 63 stateSinkObject.Save(4, &s.sems) 64 stateSinkObject.Save(5, &s.dead) 65 } 66 67 func (s *Set) afterLoad(context.Context) {} 68 69 // +checklocksignore 70 func (s *Set) StateLoad(ctx context.Context, stateSourceObject state.Source) { 71 stateSourceObject.Load(0, &s.registry) 72 stateSourceObject.Load(1, &s.obj) 73 stateSourceObject.Load(2, &s.opTime) 74 stateSourceObject.Load(3, &s.changeTime) 75 stateSourceObject.Load(4, &s.sems) 76 stateSourceObject.Load(5, &s.dead) 77 } 78 79 func (s *sem) StateTypeName() string { 80 return "pkg/sentry/kernel/semaphore.sem" 81 } 82 83 func (s *sem) StateFields() []string { 84 return []string{ 85 "value", 86 "pid", 87 } 88 } 89 90 func (s *sem) beforeSave() {} 91 92 // +checklocksignore 93 func (s *sem) StateSave(stateSinkObject state.Sink) { 94 s.beforeSave() 95 if !state.IsZeroValue(&s.waiters) { 96 state.Failf("waiters is %#v, expected zero", &s.waiters) 97 } 98 stateSinkObject.Save(0, &s.value) 99 stateSinkObject.Save(1, &s.pid) 100 } 101 102 func (s *sem) afterLoad(context.Context) {} 103 104 // +checklocksignore 105 func (s *sem) StateLoad(ctx context.Context, stateSourceObject state.Source) { 106 stateSourceObject.Load(0, &s.value) 107 stateSourceObject.Load(1, &s.pid) 108 } 109 110 func (w *waiter) StateTypeName() string { 111 return "pkg/sentry/kernel/semaphore.waiter" 112 } 113 114 func (w *waiter) StateFields() []string { 115 return []string{ 116 "waiterEntry", 117 "value", 118 "ch", 119 } 120 } 121 122 func (w *waiter) beforeSave() {} 123 124 // +checklocksignore 125 func (w *waiter) StateSave(stateSinkObject state.Sink) { 126 w.beforeSave() 127 stateSinkObject.Save(0, &w.waiterEntry) 128 stateSinkObject.Save(1, &w.value) 129 stateSinkObject.Save(2, &w.ch) 130 } 131 132 func (w *waiter) afterLoad(context.Context) {} 133 134 // +checklocksignore 135 func (w *waiter) StateLoad(ctx context.Context, stateSourceObject state.Source) { 136 stateSourceObject.Load(0, &w.waiterEntry) 137 stateSourceObject.Load(1, &w.value) 138 stateSourceObject.Load(2, &w.ch) 139 } 140 141 func (l *waiterList) StateTypeName() string { 142 return "pkg/sentry/kernel/semaphore.waiterList" 143 } 144 145 func (l *waiterList) StateFields() []string { 146 return []string{ 147 "head", 148 "tail", 149 } 150 } 151 152 func (l *waiterList) beforeSave() {} 153 154 // +checklocksignore 155 func (l *waiterList) StateSave(stateSinkObject state.Sink) { 156 l.beforeSave() 157 stateSinkObject.Save(0, &l.head) 158 stateSinkObject.Save(1, &l.tail) 159 } 160 161 func (l *waiterList) afterLoad(context.Context) {} 162 163 // +checklocksignore 164 func (l *waiterList) StateLoad(ctx context.Context, stateSourceObject state.Source) { 165 stateSourceObject.Load(0, &l.head) 166 stateSourceObject.Load(1, &l.tail) 167 } 168 169 func (e *waiterEntry) StateTypeName() string { 170 return "pkg/sentry/kernel/semaphore.waiterEntry" 171 } 172 173 func (e *waiterEntry) StateFields() []string { 174 return []string{ 175 "next", 176 "prev", 177 } 178 } 179 180 func (e *waiterEntry) beforeSave() {} 181 182 // +checklocksignore 183 func (e *waiterEntry) StateSave(stateSinkObject state.Sink) { 184 e.beforeSave() 185 stateSinkObject.Save(0, &e.next) 186 stateSinkObject.Save(1, &e.prev) 187 } 188 189 func (e *waiterEntry) afterLoad(context.Context) {} 190 191 // +checklocksignore 192 func (e *waiterEntry) StateLoad(ctx context.Context, stateSourceObject state.Source) { 193 stateSourceObject.Load(0, &e.next) 194 stateSourceObject.Load(1, &e.prev) 195 } 196 197 func init() { 198 state.Register((*Registry)(nil)) 199 state.Register((*Set)(nil)) 200 state.Register((*sem)(nil)) 201 state.Register((*waiter)(nil)) 202 state.Register((*waiterList)(nil)) 203 state.Register((*waiterEntry)(nil)) 204 }