github.com/sagernet/gvisor@v0.0.0-20240428053021-e691de28565f/pkg/ilist/ilist_state_autogen.go (about) 1 // automatically generated by stateify. 2 3 package ilist 4 5 import ( 6 "context" 7 8 "github.com/sagernet/gvisor/pkg/state" 9 ) 10 11 func (l *List) StateTypeName() string { 12 return "pkg/ilist.List" 13 } 14 15 func (l *List) StateFields() []string { 16 return []string{ 17 "head", 18 "tail", 19 } 20 } 21 22 func (l *List) beforeSave() {} 23 24 // +checklocksignore 25 func (l *List) StateSave(stateSinkObject state.Sink) { 26 l.beforeSave() 27 stateSinkObject.Save(0, &l.head) 28 stateSinkObject.Save(1, &l.tail) 29 } 30 31 func (l *List) afterLoad(context.Context) {} 32 33 // +checklocksignore 34 func (l *List) StateLoad(ctx context.Context, stateSourceObject state.Source) { 35 stateSourceObject.Load(0, &l.head) 36 stateSourceObject.Load(1, &l.tail) 37 } 38 39 func (e *Entry) StateTypeName() string { 40 return "pkg/ilist.Entry" 41 } 42 43 func (e *Entry) StateFields() []string { 44 return []string{ 45 "next", 46 "prev", 47 } 48 } 49 50 func (e *Entry) beforeSave() {} 51 52 // +checklocksignore 53 func (e *Entry) StateSave(stateSinkObject state.Sink) { 54 e.beforeSave() 55 stateSinkObject.Save(0, &e.next) 56 stateSinkObject.Save(1, &e.prev) 57 } 58 59 func (e *Entry) afterLoad(context.Context) {} 60 61 // +checklocksignore 62 func (e *Entry) StateLoad(ctx context.Context, stateSourceObject state.Source) { 63 stateSourceObject.Load(0, &e.next) 64 stateSourceObject.Load(1, &e.prev) 65 } 66 67 func init() { 68 state.Register((*List)(nil)) 69 state.Register((*Entry)(nil)) 70 }