inet.af/netstack@v0.0.0-20220214151720-7585b01ddccf/refs/refs_state_autogen.go (about) 1 // automatically generated by stateify. 2 3 package refs 4 5 import ( 6 "inet.af/netstack/state" 7 ) 8 9 func (w *WeakRef) StateTypeName() string { 10 return "pkg/refs.WeakRef" 11 } 12 13 func (w *WeakRef) StateFields() []string { 14 return []string{ 15 "obj", 16 "user", 17 } 18 } 19 20 func (w *WeakRef) beforeSave() {} 21 22 // +checklocksignore 23 func (w *WeakRef) StateSave(stateSinkObject state.Sink) { 24 w.beforeSave() 25 var objValue savedReference 26 objValue = w.saveObj() 27 stateSinkObject.SaveValue(0, objValue) 28 stateSinkObject.Save(1, &w.user) 29 } 30 31 func (w *WeakRef) afterLoad() {} 32 33 // +checklocksignore 34 func (w *WeakRef) StateLoad(stateSourceObject state.Source) { 35 stateSourceObject.Load(1, &w.user) 36 stateSourceObject.LoadValue(0, new(savedReference), func(y interface{}) { w.loadObj(y.(savedReference)) }) 37 } 38 39 func (r *AtomicRefCount) StateTypeName() string { 40 return "pkg/refs.AtomicRefCount" 41 } 42 43 func (r *AtomicRefCount) StateFields() []string { 44 return []string{ 45 "refCount", 46 "name", 47 "stack", 48 } 49 } 50 51 func (r *AtomicRefCount) beforeSave() {} 52 53 // +checklocksignore 54 func (r *AtomicRefCount) StateSave(stateSinkObject state.Sink) { 55 r.beforeSave() 56 stateSinkObject.Save(0, &r.refCount) 57 stateSinkObject.Save(1, &r.name) 58 stateSinkObject.Save(2, &r.stack) 59 } 60 61 func (r *AtomicRefCount) afterLoad() {} 62 63 // +checklocksignore 64 func (r *AtomicRefCount) StateLoad(stateSourceObject state.Source) { 65 stateSourceObject.Load(0, &r.refCount) 66 stateSourceObject.Load(1, &r.name) 67 stateSourceObject.Load(2, &r.stack) 68 } 69 70 func (s *savedReference) StateTypeName() string { 71 return "pkg/refs.savedReference" 72 } 73 74 func (s *savedReference) StateFields() []string { 75 return []string{ 76 "obj", 77 } 78 } 79 80 func (s *savedReference) beforeSave() {} 81 82 // +checklocksignore 83 func (s *savedReference) StateSave(stateSinkObject state.Sink) { 84 s.beforeSave() 85 stateSinkObject.Save(0, &s.obj) 86 } 87 88 func (s *savedReference) afterLoad() {} 89 90 // +checklocksignore 91 func (s *savedReference) StateLoad(stateSourceObject state.Source) { 92 stateSourceObject.Load(0, &s.obj) 93 } 94 95 func (l *weakRefList) StateTypeName() string { 96 return "pkg/refs.weakRefList" 97 } 98 99 func (l *weakRefList) StateFields() []string { 100 return []string{ 101 "head", 102 "tail", 103 } 104 } 105 106 func (l *weakRefList) beforeSave() {} 107 108 // +checklocksignore 109 func (l *weakRefList) StateSave(stateSinkObject state.Sink) { 110 l.beforeSave() 111 stateSinkObject.Save(0, &l.head) 112 stateSinkObject.Save(1, &l.tail) 113 } 114 115 func (l *weakRefList) afterLoad() {} 116 117 // +checklocksignore 118 func (l *weakRefList) StateLoad(stateSourceObject state.Source) { 119 stateSourceObject.Load(0, &l.head) 120 stateSourceObject.Load(1, &l.tail) 121 } 122 123 func (e *weakRefEntry) StateTypeName() string { 124 return "pkg/refs.weakRefEntry" 125 } 126 127 func (e *weakRefEntry) StateFields() []string { 128 return []string{ 129 "next", 130 "prev", 131 } 132 } 133 134 func (e *weakRefEntry) beforeSave() {} 135 136 // +checklocksignore 137 func (e *weakRefEntry) StateSave(stateSinkObject state.Sink) { 138 e.beforeSave() 139 stateSinkObject.Save(0, &e.next) 140 stateSinkObject.Save(1, &e.prev) 141 } 142 143 func (e *weakRefEntry) afterLoad() {} 144 145 // +checklocksignore 146 func (e *weakRefEntry) StateLoad(stateSourceObject state.Source) { 147 stateSourceObject.Load(0, &e.next) 148 stateSourceObject.Load(1, &e.prev) 149 } 150 151 func init() { 152 state.Register((*WeakRef)(nil)) 153 state.Register((*AtomicRefCount)(nil)) 154 state.Register((*savedReference)(nil)) 155 state.Register((*weakRefList)(nil)) 156 state.Register((*weakRefEntry)(nil)) 157 }