github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/kernel/time/time_state_autogen.go (about) 1 // automatically generated by stateify. 2 3 package time 4 5 import ( 6 "context" 7 8 "github.com/metacubex/gvisor/pkg/state" 9 ) 10 11 func (t *Time) StateTypeName() string { 12 return "pkg/sentry/kernel/time.Time" 13 } 14 15 func (t *Time) StateFields() []string { 16 return []string{ 17 "ns", 18 } 19 } 20 21 func (t *Time) beforeSave() {} 22 23 // +checklocksignore 24 func (t *Time) StateSave(stateSinkObject state.Sink) { 25 t.beforeSave() 26 stateSinkObject.Save(0, &t.ns) 27 } 28 29 func (t *Time) afterLoad(context.Context) {} 30 31 // +checklocksignore 32 func (t *Time) StateLoad(ctx context.Context, stateSourceObject state.Source) { 33 stateSourceObject.Load(0, &t.ns) 34 } 35 36 func (s *Setting) StateTypeName() string { 37 return "pkg/sentry/kernel/time.Setting" 38 } 39 40 func (s *Setting) StateFields() []string { 41 return []string{ 42 "Enabled", 43 "Next", 44 "Period", 45 } 46 } 47 48 func (s *Setting) beforeSave() {} 49 50 // +checklocksignore 51 func (s *Setting) StateSave(stateSinkObject state.Sink) { 52 s.beforeSave() 53 stateSinkObject.Save(0, &s.Enabled) 54 stateSinkObject.Save(1, &s.Next) 55 stateSinkObject.Save(2, &s.Period) 56 } 57 58 func (s *Setting) afterLoad(context.Context) {} 59 60 // +checklocksignore 61 func (s *Setting) StateLoad(ctx context.Context, stateSourceObject state.Source) { 62 stateSourceObject.Load(0, &s.Enabled) 63 stateSourceObject.Load(1, &s.Next) 64 stateSourceObject.Load(2, &s.Period) 65 } 66 67 func (t *Timer) StateTypeName() string { 68 return "pkg/sentry/kernel/time.Timer" 69 } 70 71 func (t *Timer) StateFields() []string { 72 return []string{ 73 "clock", 74 "listener", 75 "setting", 76 "paused", 77 } 78 } 79 80 func (t *Timer) beforeSave() {} 81 82 // +checklocksignore 83 func (t *Timer) StateSave(stateSinkObject state.Sink) { 84 t.beforeSave() 85 stateSinkObject.Save(0, &t.clock) 86 stateSinkObject.Save(1, &t.listener) 87 stateSinkObject.Save(2, &t.setting) 88 stateSinkObject.Save(3, &t.paused) 89 } 90 91 func (t *Timer) afterLoad(context.Context) {} 92 93 // +checklocksignore 94 func (t *Timer) StateLoad(ctx context.Context, stateSourceObject state.Source) { 95 stateSourceObject.Load(0, &t.clock) 96 stateSourceObject.Load(1, &t.listener) 97 stateSourceObject.Load(2, &t.setting) 98 stateSourceObject.Load(3, &t.paused) 99 } 100 101 func init() { 102 state.Register((*Time)(nil)) 103 state.Register((*Setting)(nil)) 104 state.Register((*Timer)(nil)) 105 }