github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/memmap/memmap_impl_state_autogen.go (about) 1 // automatically generated by stateify. 2 3 package memmap 4 5 import ( 6 "context" 7 8 "github.com/metacubex/gvisor/pkg/state" 9 ) 10 11 func (s *MappingSet) StateTypeName() string { 12 return "pkg/sentry/memmap.MappingSet" 13 } 14 15 func (s *MappingSet) StateFields() []string { 16 return []string{ 17 "root", 18 } 19 } 20 21 func (s *MappingSet) beforeSave() {} 22 23 // +checklocksignore 24 func (s *MappingSet) StateSave(stateSinkObject state.Sink) { 25 s.beforeSave() 26 var rootValue []MappingFlatSegment 27 rootValue = s.saveRoot() 28 stateSinkObject.SaveValue(0, rootValue) 29 } 30 31 func (s *MappingSet) afterLoad(context.Context) {} 32 33 // +checklocksignore 34 func (s *MappingSet) StateLoad(ctx context.Context, stateSourceObject state.Source) { 35 stateSourceObject.LoadValue(0, new([]MappingFlatSegment), func(y any) { s.loadRoot(ctx, y.([]MappingFlatSegment)) }) 36 } 37 38 func (n *Mappingnode) StateTypeName() string { 39 return "pkg/sentry/memmap.Mappingnode" 40 } 41 42 func (n *Mappingnode) StateFields() []string { 43 return []string{ 44 "nrSegments", 45 "parent", 46 "parentIndex", 47 "hasChildren", 48 "maxGap", 49 "keys", 50 "values", 51 "children", 52 } 53 } 54 55 func (n *Mappingnode) beforeSave() {} 56 57 // +checklocksignore 58 func (n *Mappingnode) StateSave(stateSinkObject state.Sink) { 59 n.beforeSave() 60 stateSinkObject.Save(0, &n.nrSegments) 61 stateSinkObject.Save(1, &n.parent) 62 stateSinkObject.Save(2, &n.parentIndex) 63 stateSinkObject.Save(3, &n.hasChildren) 64 stateSinkObject.Save(4, &n.maxGap) 65 stateSinkObject.Save(5, &n.keys) 66 stateSinkObject.Save(6, &n.values) 67 stateSinkObject.Save(7, &n.children) 68 } 69 70 func (n *Mappingnode) afterLoad(context.Context) {} 71 72 // +checklocksignore 73 func (n *Mappingnode) StateLoad(ctx context.Context, stateSourceObject state.Source) { 74 stateSourceObject.Load(0, &n.nrSegments) 75 stateSourceObject.Load(1, &n.parent) 76 stateSourceObject.Load(2, &n.parentIndex) 77 stateSourceObject.Load(3, &n.hasChildren) 78 stateSourceObject.Load(4, &n.maxGap) 79 stateSourceObject.Load(5, &n.keys) 80 stateSourceObject.Load(6, &n.values) 81 stateSourceObject.Load(7, &n.children) 82 } 83 84 func (m *MappingFlatSegment) StateTypeName() string { 85 return "pkg/sentry/memmap.MappingFlatSegment" 86 } 87 88 func (m *MappingFlatSegment) StateFields() []string { 89 return []string{ 90 "Start", 91 "End", 92 "Value", 93 } 94 } 95 96 func (m *MappingFlatSegment) beforeSave() {} 97 98 // +checklocksignore 99 func (m *MappingFlatSegment) StateSave(stateSinkObject state.Sink) { 100 m.beforeSave() 101 stateSinkObject.Save(0, &m.Start) 102 stateSinkObject.Save(1, &m.End) 103 stateSinkObject.Save(2, &m.Value) 104 } 105 106 func (m *MappingFlatSegment) afterLoad(context.Context) {} 107 108 // +checklocksignore 109 func (m *MappingFlatSegment) StateLoad(ctx context.Context, stateSourceObject state.Source) { 110 stateSourceObject.Load(0, &m.Start) 111 stateSourceObject.Load(1, &m.End) 112 stateSourceObject.Load(2, &m.Value) 113 } 114 115 func init() { 116 state.Register((*MappingSet)(nil)) 117 state.Register((*Mappingnode)(nil)) 118 state.Register((*MappingFlatSegment)(nil)) 119 }