github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/inet/inet_state_autogen.go (about) 1 // automatically generated by stateify. 2 3 package inet 4 5 import ( 6 "context" 7 8 "github.com/metacubex/gvisor/pkg/state" 9 ) 10 11 func (a *abstractEndpoint) StateTypeName() string { 12 return "pkg/sentry/inet.abstractEndpoint" 13 } 14 15 func (a *abstractEndpoint) StateFields() []string { 16 return []string{ 17 "ep", 18 "socket", 19 "name", 20 "ns", 21 } 22 } 23 24 func (a *abstractEndpoint) beforeSave() {} 25 26 // +checklocksignore 27 func (a *abstractEndpoint) StateSave(stateSinkObject state.Sink) { 28 a.beforeSave() 29 stateSinkObject.Save(0, &a.ep) 30 stateSinkObject.Save(1, &a.socket) 31 stateSinkObject.Save(2, &a.name) 32 stateSinkObject.Save(3, &a.ns) 33 } 34 35 func (a *abstractEndpoint) afterLoad(context.Context) {} 36 37 // +checklocksignore 38 func (a *abstractEndpoint) StateLoad(ctx context.Context, stateSourceObject state.Source) { 39 stateSourceObject.Load(0, &a.ep) 40 stateSourceObject.Load(1, &a.socket) 41 stateSourceObject.Load(2, &a.name) 42 stateSourceObject.Load(3, &a.ns) 43 } 44 45 func (a *AbstractSocketNamespace) StateTypeName() string { 46 return "pkg/sentry/inet.AbstractSocketNamespace" 47 } 48 49 func (a *AbstractSocketNamespace) StateFields() []string { 50 return []string{ 51 "endpoints", 52 } 53 } 54 55 func (a *AbstractSocketNamespace) beforeSave() {} 56 57 // +checklocksignore 58 func (a *AbstractSocketNamespace) StateSave(stateSinkObject state.Sink) { 59 a.beforeSave() 60 stateSinkObject.Save(0, &a.endpoints) 61 } 62 63 func (a *AbstractSocketNamespace) afterLoad(context.Context) {} 64 65 // +checklocksignore 66 func (a *AbstractSocketNamespace) StateLoad(ctx context.Context, stateSourceObject state.Source) { 67 stateSourceObject.Load(0, &a.endpoints) 68 } 69 70 func (t *TCPBufferSize) StateTypeName() string { 71 return "pkg/sentry/inet.TCPBufferSize" 72 } 73 74 func (t *TCPBufferSize) StateFields() []string { 75 return []string{ 76 "Min", 77 "Default", 78 "Max", 79 } 80 } 81 82 func (t *TCPBufferSize) beforeSave() {} 83 84 // +checklocksignore 85 func (t *TCPBufferSize) StateSave(stateSinkObject state.Sink) { 86 t.beforeSave() 87 stateSinkObject.Save(0, &t.Min) 88 stateSinkObject.Save(1, &t.Default) 89 stateSinkObject.Save(2, &t.Max) 90 } 91 92 func (t *TCPBufferSize) afterLoad(context.Context) {} 93 94 // +checklocksignore 95 func (t *TCPBufferSize) StateLoad(ctx context.Context, stateSourceObject state.Source) { 96 stateSourceObject.Load(0, &t.Min) 97 stateSourceObject.Load(1, &t.Default) 98 stateSourceObject.Load(2, &t.Max) 99 } 100 101 func (n *Namespace) StateTypeName() string { 102 return "pkg/sentry/inet.Namespace" 103 } 104 105 func (n *Namespace) StateFields() []string { 106 return []string{ 107 "inode", 108 "creator", 109 "isRoot", 110 "userNS", 111 "abstractSockets", 112 } 113 } 114 115 func (n *Namespace) beforeSave() {} 116 117 // +checklocksignore 118 func (n *Namespace) StateSave(stateSinkObject state.Sink) { 119 n.beforeSave() 120 stateSinkObject.Save(0, &n.inode) 121 stateSinkObject.Save(1, &n.creator) 122 stateSinkObject.Save(2, &n.isRoot) 123 stateSinkObject.Save(3, &n.userNS) 124 stateSinkObject.Save(4, &n.abstractSockets) 125 } 126 127 // +checklocksignore 128 func (n *Namespace) StateLoad(ctx context.Context, stateSourceObject state.Source) { 129 stateSourceObject.Load(0, &n.inode) 130 stateSourceObject.LoadWait(1, &n.creator) 131 stateSourceObject.Load(2, &n.isRoot) 132 stateSourceObject.Load(3, &n.userNS) 133 stateSourceObject.Load(4, &n.abstractSockets) 134 stateSourceObject.AfterLoad(func() { n.afterLoad(ctx) }) 135 } 136 137 func (r *namespaceRefs) StateTypeName() string { 138 return "pkg/sentry/inet.namespaceRefs" 139 } 140 141 func (r *namespaceRefs) StateFields() []string { 142 return []string{ 143 "refCount", 144 } 145 } 146 147 func (r *namespaceRefs) beforeSave() {} 148 149 // +checklocksignore 150 func (r *namespaceRefs) StateSave(stateSinkObject state.Sink) { 151 r.beforeSave() 152 stateSinkObject.Save(0, &r.refCount) 153 } 154 155 // +checklocksignore 156 func (r *namespaceRefs) StateLoad(ctx context.Context, stateSourceObject state.Source) { 157 stateSourceObject.Load(0, &r.refCount) 158 stateSourceObject.AfterLoad(func() { r.afterLoad(ctx) }) 159 } 160 161 func init() { 162 state.Register((*abstractEndpoint)(nil)) 163 state.Register((*AbstractSocketNamespace)(nil)) 164 state.Register((*TCPBufferSize)(nil)) 165 state.Register((*Namespace)(nil)) 166 state.Register((*namespaceRefs)(nil)) 167 }