github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/kernel/shm/shm_state_autogen.go (about) 1 // automatically generated by stateify. 2 3 package shm 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/shm.Registry" 13 } 14 15 func (r *Registry) StateFields() []string { 16 return []string{ 17 "userNS", 18 "reg", 19 "totalPages", 20 } 21 } 22 23 func (r *Registry) beforeSave() {} 24 25 // +checklocksignore 26 func (r *Registry) StateSave(stateSinkObject state.Sink) { 27 r.beforeSave() 28 stateSinkObject.Save(0, &r.userNS) 29 stateSinkObject.Save(1, &r.reg) 30 stateSinkObject.Save(2, &r.totalPages) 31 } 32 33 func (r *Registry) afterLoad(context.Context) {} 34 35 // +checklocksignore 36 func (r *Registry) StateLoad(ctx context.Context, stateSourceObject state.Source) { 37 stateSourceObject.Load(0, &r.userNS) 38 stateSourceObject.Load(1, &r.reg) 39 stateSourceObject.Load(2, &r.totalPages) 40 } 41 42 func (s *Shm) StateTypeName() string { 43 return "pkg/sentry/kernel/shm.Shm" 44 } 45 46 func (s *Shm) StateFields() []string { 47 return []string{ 48 "ShmRefs", 49 "registry", 50 "devID", 51 "size", 52 "effectiveSize", 53 "fr", 54 "obj", 55 "attachTime", 56 "detachTime", 57 "changeTime", 58 "creatorPID", 59 "lastAttachDetachPID", 60 "pendingDestruction", 61 } 62 } 63 64 func (s *Shm) beforeSave() {} 65 66 // +checklocksignore 67 func (s *Shm) StateSave(stateSinkObject state.Sink) { 68 s.beforeSave() 69 stateSinkObject.Save(0, &s.ShmRefs) 70 stateSinkObject.Save(1, &s.registry) 71 stateSinkObject.Save(2, &s.devID) 72 stateSinkObject.Save(3, &s.size) 73 stateSinkObject.Save(4, &s.effectiveSize) 74 stateSinkObject.Save(5, &s.fr) 75 stateSinkObject.Save(6, &s.obj) 76 stateSinkObject.Save(7, &s.attachTime) 77 stateSinkObject.Save(8, &s.detachTime) 78 stateSinkObject.Save(9, &s.changeTime) 79 stateSinkObject.Save(10, &s.creatorPID) 80 stateSinkObject.Save(11, &s.lastAttachDetachPID) 81 stateSinkObject.Save(12, &s.pendingDestruction) 82 } 83 84 // +checklocksignore 85 func (s *Shm) StateLoad(ctx context.Context, stateSourceObject state.Source) { 86 stateSourceObject.Load(0, &s.ShmRefs) 87 stateSourceObject.Load(1, &s.registry) 88 stateSourceObject.Load(2, &s.devID) 89 stateSourceObject.Load(3, &s.size) 90 stateSourceObject.Load(4, &s.effectiveSize) 91 stateSourceObject.Load(5, &s.fr) 92 stateSourceObject.Load(6, &s.obj) 93 stateSourceObject.Load(7, &s.attachTime) 94 stateSourceObject.Load(8, &s.detachTime) 95 stateSourceObject.Load(9, &s.changeTime) 96 stateSourceObject.Load(10, &s.creatorPID) 97 stateSourceObject.Load(11, &s.lastAttachDetachPID) 98 stateSourceObject.Load(12, &s.pendingDestruction) 99 stateSourceObject.AfterLoad(func() { s.afterLoad(ctx) }) 100 } 101 102 func (r *ShmRefs) StateTypeName() string { 103 return "pkg/sentry/kernel/shm.ShmRefs" 104 } 105 106 func (r *ShmRefs) StateFields() []string { 107 return []string{ 108 "refCount", 109 } 110 } 111 112 func (r *ShmRefs) beforeSave() {} 113 114 // +checklocksignore 115 func (r *ShmRefs) StateSave(stateSinkObject state.Sink) { 116 r.beforeSave() 117 stateSinkObject.Save(0, &r.refCount) 118 } 119 120 // +checklocksignore 121 func (r *ShmRefs) StateLoad(ctx context.Context, stateSourceObject state.Source) { 122 stateSourceObject.Load(0, &r.refCount) 123 stateSourceObject.AfterLoad(func() { r.afterLoad(ctx) }) 124 } 125 126 func init() { 127 state.Register((*Registry)(nil)) 128 state.Register((*Shm)(nil)) 129 state.Register((*ShmRefs)(nil)) 130 }