github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/kernel/auth/auth_state_autogen.go (about) 1 // automatically generated by stateify. 2 3 package auth 4 5 import ( 6 "context" 7 8 "github.com/metacubex/gvisor/pkg/state" 9 ) 10 11 func (c *Credentials) StateTypeName() string { 12 return "pkg/sentry/kernel/auth.Credentials" 13 } 14 15 func (c *Credentials) StateFields() []string { 16 return []string{ 17 "RealKUID", 18 "EffectiveKUID", 19 "SavedKUID", 20 "RealKGID", 21 "EffectiveKGID", 22 "SavedKGID", 23 "ExtraKGIDs", 24 "PermittedCaps", 25 "InheritableCaps", 26 "EffectiveCaps", 27 "BoundingCaps", 28 "KeepCaps", 29 "UserNamespace", 30 } 31 } 32 33 func (c *Credentials) beforeSave() {} 34 35 // +checklocksignore 36 func (c *Credentials) StateSave(stateSinkObject state.Sink) { 37 c.beforeSave() 38 stateSinkObject.Save(0, &c.RealKUID) 39 stateSinkObject.Save(1, &c.EffectiveKUID) 40 stateSinkObject.Save(2, &c.SavedKUID) 41 stateSinkObject.Save(3, &c.RealKGID) 42 stateSinkObject.Save(4, &c.EffectiveKGID) 43 stateSinkObject.Save(5, &c.SavedKGID) 44 stateSinkObject.Save(6, &c.ExtraKGIDs) 45 stateSinkObject.Save(7, &c.PermittedCaps) 46 stateSinkObject.Save(8, &c.InheritableCaps) 47 stateSinkObject.Save(9, &c.EffectiveCaps) 48 stateSinkObject.Save(10, &c.BoundingCaps) 49 stateSinkObject.Save(11, &c.KeepCaps) 50 stateSinkObject.Save(12, &c.UserNamespace) 51 } 52 53 func (c *Credentials) afterLoad(context.Context) {} 54 55 // +checklocksignore 56 func (c *Credentials) StateLoad(ctx context.Context, stateSourceObject state.Source) { 57 stateSourceObject.Load(0, &c.RealKUID) 58 stateSourceObject.Load(1, &c.EffectiveKUID) 59 stateSourceObject.Load(2, &c.SavedKUID) 60 stateSourceObject.Load(3, &c.RealKGID) 61 stateSourceObject.Load(4, &c.EffectiveKGID) 62 stateSourceObject.Load(5, &c.SavedKGID) 63 stateSourceObject.Load(6, &c.ExtraKGIDs) 64 stateSourceObject.Load(7, &c.PermittedCaps) 65 stateSourceObject.Load(8, &c.InheritableCaps) 66 stateSourceObject.Load(9, &c.EffectiveCaps) 67 stateSourceObject.Load(10, &c.BoundingCaps) 68 stateSourceObject.Load(11, &c.KeepCaps) 69 stateSourceObject.Load(12, &c.UserNamespace) 70 } 71 72 func (i *IDMapEntry) StateTypeName() string { 73 return "pkg/sentry/kernel/auth.IDMapEntry" 74 } 75 76 func (i *IDMapEntry) StateFields() []string { 77 return []string{ 78 "FirstID", 79 "FirstParentID", 80 "Length", 81 } 82 } 83 84 func (i *IDMapEntry) beforeSave() {} 85 86 // +checklocksignore 87 func (i *IDMapEntry) StateSave(stateSinkObject state.Sink) { 88 i.beforeSave() 89 stateSinkObject.Save(0, &i.FirstID) 90 stateSinkObject.Save(1, &i.FirstParentID) 91 stateSinkObject.Save(2, &i.Length) 92 } 93 94 func (i *IDMapEntry) afterLoad(context.Context) {} 95 96 // +checklocksignore 97 func (i *IDMapEntry) StateLoad(ctx context.Context, stateSourceObject state.Source) { 98 stateSourceObject.Load(0, &i.FirstID) 99 stateSourceObject.Load(1, &i.FirstParentID) 100 stateSourceObject.Load(2, &i.Length) 101 } 102 103 func (r *idMapRange) StateTypeName() string { 104 return "pkg/sentry/kernel/auth.idMapRange" 105 } 106 107 func (r *idMapRange) StateFields() []string { 108 return []string{ 109 "Start", 110 "End", 111 } 112 } 113 114 func (r *idMapRange) beforeSave() {} 115 116 // +checklocksignore 117 func (r *idMapRange) StateSave(stateSinkObject state.Sink) { 118 r.beforeSave() 119 stateSinkObject.Save(0, &r.Start) 120 stateSinkObject.Save(1, &r.End) 121 } 122 123 func (r *idMapRange) afterLoad(context.Context) {} 124 125 // +checklocksignore 126 func (r *idMapRange) StateLoad(ctx context.Context, stateSourceObject state.Source) { 127 stateSourceObject.Load(0, &r.Start) 128 stateSourceObject.Load(1, &r.End) 129 } 130 131 func (s *idMapSet) StateTypeName() string { 132 return "pkg/sentry/kernel/auth.idMapSet" 133 } 134 135 func (s *idMapSet) StateFields() []string { 136 return []string{ 137 "root", 138 } 139 } 140 141 func (s *idMapSet) beforeSave() {} 142 143 // +checklocksignore 144 func (s *idMapSet) StateSave(stateSinkObject state.Sink) { 145 s.beforeSave() 146 var rootValue []idMapFlatSegment 147 rootValue = s.saveRoot() 148 stateSinkObject.SaveValue(0, rootValue) 149 } 150 151 func (s *idMapSet) afterLoad(context.Context) {} 152 153 // +checklocksignore 154 func (s *idMapSet) StateLoad(ctx context.Context, stateSourceObject state.Source) { 155 stateSourceObject.LoadValue(0, new([]idMapFlatSegment), func(y any) { s.loadRoot(ctx, y.([]idMapFlatSegment)) }) 156 } 157 158 func (n *idMapnode) StateTypeName() string { 159 return "pkg/sentry/kernel/auth.idMapnode" 160 } 161 162 func (n *idMapnode) StateFields() []string { 163 return []string{ 164 "nrSegments", 165 "parent", 166 "parentIndex", 167 "hasChildren", 168 "maxGap", 169 "keys", 170 "values", 171 "children", 172 } 173 } 174 175 func (n *idMapnode) beforeSave() {} 176 177 // +checklocksignore 178 func (n *idMapnode) StateSave(stateSinkObject state.Sink) { 179 n.beforeSave() 180 stateSinkObject.Save(0, &n.nrSegments) 181 stateSinkObject.Save(1, &n.parent) 182 stateSinkObject.Save(2, &n.parentIndex) 183 stateSinkObject.Save(3, &n.hasChildren) 184 stateSinkObject.Save(4, &n.maxGap) 185 stateSinkObject.Save(5, &n.keys) 186 stateSinkObject.Save(6, &n.values) 187 stateSinkObject.Save(7, &n.children) 188 } 189 190 func (n *idMapnode) afterLoad(context.Context) {} 191 192 // +checklocksignore 193 func (n *idMapnode) StateLoad(ctx context.Context, stateSourceObject state.Source) { 194 stateSourceObject.Load(0, &n.nrSegments) 195 stateSourceObject.Load(1, &n.parent) 196 stateSourceObject.Load(2, &n.parentIndex) 197 stateSourceObject.Load(3, &n.hasChildren) 198 stateSourceObject.Load(4, &n.maxGap) 199 stateSourceObject.Load(5, &n.keys) 200 stateSourceObject.Load(6, &n.values) 201 stateSourceObject.Load(7, &n.children) 202 } 203 204 func (i *idMapFlatSegment) StateTypeName() string { 205 return "pkg/sentry/kernel/auth.idMapFlatSegment" 206 } 207 208 func (i *idMapFlatSegment) StateFields() []string { 209 return []string{ 210 "Start", 211 "End", 212 "Value", 213 } 214 } 215 216 func (i *idMapFlatSegment) beforeSave() {} 217 218 // +checklocksignore 219 func (i *idMapFlatSegment) StateSave(stateSinkObject state.Sink) { 220 i.beforeSave() 221 stateSinkObject.Save(0, &i.Start) 222 stateSinkObject.Save(1, &i.End) 223 stateSinkObject.Save(2, &i.Value) 224 } 225 226 func (i *idMapFlatSegment) afterLoad(context.Context) {} 227 228 // +checklocksignore 229 func (i *idMapFlatSegment) StateLoad(ctx context.Context, stateSourceObject state.Source) { 230 stateSourceObject.Load(0, &i.Start) 231 stateSourceObject.Load(1, &i.End) 232 stateSourceObject.Load(2, &i.Value) 233 } 234 235 func (k *Key) StateTypeName() string { 236 return "pkg/sentry/kernel/auth.Key" 237 } 238 239 func (k *Key) StateFields() []string { 240 return []string{ 241 "ID", 242 "Description", 243 "kuid", 244 "kgid", 245 "perms", 246 } 247 } 248 249 func (k *Key) beforeSave() {} 250 251 // +checklocksignore 252 func (k *Key) StateSave(stateSinkObject state.Sink) { 253 k.beforeSave() 254 stateSinkObject.Save(0, &k.ID) 255 stateSinkObject.Save(1, &k.Description) 256 stateSinkObject.Save(2, &k.kuid) 257 stateSinkObject.Save(3, &k.kgid) 258 stateSinkObject.Save(4, &k.perms) 259 } 260 261 func (k *Key) afterLoad(context.Context) {} 262 263 // +checklocksignore 264 func (k *Key) StateLoad(ctx context.Context, stateSourceObject state.Source) { 265 stateSourceObject.Load(0, &k.ID) 266 stateSourceObject.Load(1, &k.Description) 267 stateSourceObject.Load(2, &k.kuid) 268 stateSourceObject.Load(3, &k.kgid) 269 stateSourceObject.Load(4, &k.perms) 270 } 271 272 func (s *KeySet) StateTypeName() string { 273 return "pkg/sentry/kernel/auth.KeySet" 274 } 275 276 func (s *KeySet) StateFields() []string { 277 return []string{ 278 "keys", 279 } 280 } 281 282 func (s *KeySet) beforeSave() {} 283 284 // +checklocksignore 285 func (s *KeySet) StateSave(stateSinkObject state.Sink) { 286 s.beforeSave() 287 stateSinkObject.Save(0, &s.keys) 288 } 289 290 func (s *KeySet) afterLoad(context.Context) {} 291 292 // +checklocksignore 293 func (s *KeySet) StateLoad(ctx context.Context, stateSourceObject state.Source) { 294 stateSourceObject.Load(0, &s.keys) 295 } 296 297 func (ns *UserNamespace) StateTypeName() string { 298 return "pkg/sentry/kernel/auth.UserNamespace" 299 } 300 301 func (ns *UserNamespace) StateFields() []string { 302 return []string{ 303 "parent", 304 "owner", 305 "Keys", 306 "uidMapFromParent", 307 "uidMapToParent", 308 "gidMapFromParent", 309 "gidMapToParent", 310 } 311 } 312 313 func (ns *UserNamespace) beforeSave() {} 314 315 // +checklocksignore 316 func (ns *UserNamespace) StateSave(stateSinkObject state.Sink) { 317 ns.beforeSave() 318 stateSinkObject.Save(0, &ns.parent) 319 stateSinkObject.Save(1, &ns.owner) 320 stateSinkObject.Save(2, &ns.Keys) 321 stateSinkObject.Save(3, &ns.uidMapFromParent) 322 stateSinkObject.Save(4, &ns.uidMapToParent) 323 stateSinkObject.Save(5, &ns.gidMapFromParent) 324 stateSinkObject.Save(6, &ns.gidMapToParent) 325 } 326 327 func (ns *UserNamespace) afterLoad(context.Context) {} 328 329 // +checklocksignore 330 func (ns *UserNamespace) StateLoad(ctx context.Context, stateSourceObject state.Source) { 331 stateSourceObject.Load(0, &ns.parent) 332 stateSourceObject.Load(1, &ns.owner) 333 stateSourceObject.Load(2, &ns.Keys) 334 stateSourceObject.Load(3, &ns.uidMapFromParent) 335 stateSourceObject.Load(4, &ns.uidMapToParent) 336 stateSourceObject.Load(5, &ns.gidMapFromParent) 337 stateSourceObject.Load(6, &ns.gidMapToParent) 338 } 339 340 func init() { 341 state.Register((*Credentials)(nil)) 342 state.Register((*IDMapEntry)(nil)) 343 state.Register((*idMapRange)(nil)) 344 state.Register((*idMapSet)(nil)) 345 state.Register((*idMapnode)(nil)) 346 state.Register((*idMapFlatSegment)(nil)) 347 state.Register((*Key)(nil)) 348 state.Register((*KeySet)(nil)) 349 state.Register((*UserNamespace)(nil)) 350 }