github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go (about) 1 // automatically generated by stateify. 2 3 package tmpfs 4 5 import ( 6 "context" 7 8 "github.com/metacubex/gvisor/pkg/state" 9 ) 10 11 func (l *dentryList) StateTypeName() string { 12 return "pkg/sentry/fsimpl/tmpfs.dentryList" 13 } 14 15 func (l *dentryList) StateFields() []string { 16 return []string{ 17 "head", 18 "tail", 19 } 20 } 21 22 func (l *dentryList) beforeSave() {} 23 24 // +checklocksignore 25 func (l *dentryList) StateSave(stateSinkObject state.Sink) { 26 l.beforeSave() 27 stateSinkObject.Save(0, &l.head) 28 stateSinkObject.Save(1, &l.tail) 29 } 30 31 func (l *dentryList) afterLoad(context.Context) {} 32 33 // +checklocksignore 34 func (l *dentryList) StateLoad(ctx context.Context, stateSourceObject state.Source) { 35 stateSourceObject.Load(0, &l.head) 36 stateSourceObject.Load(1, &l.tail) 37 } 38 39 func (e *dentryEntry) StateTypeName() string { 40 return "pkg/sentry/fsimpl/tmpfs.dentryEntry" 41 } 42 43 func (e *dentryEntry) StateFields() []string { 44 return []string{ 45 "next", 46 "prev", 47 } 48 } 49 50 func (e *dentryEntry) beforeSave() {} 51 52 // +checklocksignore 53 func (e *dentryEntry) StateSave(stateSinkObject state.Sink) { 54 e.beforeSave() 55 stateSinkObject.Save(0, &e.next) 56 stateSinkObject.Save(1, &e.prev) 57 } 58 59 func (e *dentryEntry) afterLoad(context.Context) {} 60 61 // +checklocksignore 62 func (e *dentryEntry) StateLoad(ctx context.Context, stateSourceObject state.Source) { 63 stateSourceObject.Load(0, &e.next) 64 stateSourceObject.Load(1, &e.prev) 65 } 66 67 func (d *deviceFile) StateTypeName() string { 68 return "pkg/sentry/fsimpl/tmpfs.deviceFile" 69 } 70 71 func (d *deviceFile) StateFields() []string { 72 return []string{ 73 "inode", 74 "kind", 75 "major", 76 "minor", 77 } 78 } 79 80 func (d *deviceFile) beforeSave() {} 81 82 // +checklocksignore 83 func (d *deviceFile) StateSave(stateSinkObject state.Sink) { 84 d.beforeSave() 85 stateSinkObject.Save(0, &d.inode) 86 stateSinkObject.Save(1, &d.kind) 87 stateSinkObject.Save(2, &d.major) 88 stateSinkObject.Save(3, &d.minor) 89 } 90 91 func (d *deviceFile) afterLoad(context.Context) {} 92 93 // +checklocksignore 94 func (d *deviceFile) StateLoad(ctx context.Context, stateSourceObject state.Source) { 95 stateSourceObject.Load(0, &d.inode) 96 stateSourceObject.Load(1, &d.kind) 97 stateSourceObject.Load(2, &d.major) 98 stateSourceObject.Load(3, &d.minor) 99 } 100 101 func (dir *directory) StateTypeName() string { 102 return "pkg/sentry/fsimpl/tmpfs.directory" 103 } 104 105 func (dir *directory) StateFields() []string { 106 return []string{ 107 "dentry", 108 "inode", 109 "childMap", 110 "numChildren", 111 "childList", 112 } 113 } 114 115 func (dir *directory) beforeSave() {} 116 117 // +checklocksignore 118 func (dir *directory) StateSave(stateSinkObject state.Sink) { 119 dir.beforeSave() 120 stateSinkObject.Save(0, &dir.dentry) 121 stateSinkObject.Save(1, &dir.inode) 122 stateSinkObject.Save(2, &dir.childMap) 123 stateSinkObject.Save(3, &dir.numChildren) 124 stateSinkObject.Save(4, &dir.childList) 125 } 126 127 func (dir *directory) afterLoad(context.Context) {} 128 129 // +checklocksignore 130 func (dir *directory) StateLoad(ctx context.Context, stateSourceObject state.Source) { 131 stateSourceObject.Load(0, &dir.dentry) 132 stateSourceObject.Load(1, &dir.inode) 133 stateSourceObject.Load(2, &dir.childMap) 134 stateSourceObject.Load(3, &dir.numChildren) 135 stateSourceObject.Load(4, &dir.childList) 136 } 137 138 func (fd *directoryFD) StateTypeName() string { 139 return "pkg/sentry/fsimpl/tmpfs.directoryFD" 140 } 141 142 func (fd *directoryFD) StateFields() []string { 143 return []string{ 144 "fileDescription", 145 "DirectoryFileDescriptionDefaultImpl", 146 "iter", 147 "off", 148 } 149 } 150 151 func (fd *directoryFD) beforeSave() {} 152 153 // +checklocksignore 154 func (fd *directoryFD) StateSave(stateSinkObject state.Sink) { 155 fd.beforeSave() 156 stateSinkObject.Save(0, &fd.fileDescription) 157 stateSinkObject.Save(1, &fd.DirectoryFileDescriptionDefaultImpl) 158 stateSinkObject.Save(2, &fd.iter) 159 stateSinkObject.Save(3, &fd.off) 160 } 161 162 func (fd *directoryFD) afterLoad(context.Context) {} 163 164 // +checklocksignore 165 func (fd *directoryFD) StateLoad(ctx context.Context, stateSourceObject state.Source) { 166 stateSourceObject.Load(0, &fd.fileDescription) 167 stateSourceObject.Load(1, &fd.DirectoryFileDescriptionDefaultImpl) 168 stateSourceObject.Load(2, &fd.iter) 169 stateSourceObject.Load(3, &fd.off) 170 } 171 172 func (r *inodeRefs) StateTypeName() string { 173 return "pkg/sentry/fsimpl/tmpfs.inodeRefs" 174 } 175 176 func (r *inodeRefs) StateFields() []string { 177 return []string{ 178 "refCount", 179 } 180 } 181 182 func (r *inodeRefs) beforeSave() {} 183 184 // +checklocksignore 185 func (r *inodeRefs) StateSave(stateSinkObject state.Sink) { 186 r.beforeSave() 187 stateSinkObject.Save(0, &r.refCount) 188 } 189 190 // +checklocksignore 191 func (r *inodeRefs) StateLoad(ctx context.Context, stateSourceObject state.Source) { 192 stateSourceObject.Load(0, &r.refCount) 193 stateSourceObject.AfterLoad(func() { r.afterLoad(ctx) }) 194 } 195 196 func (n *namedPipe) StateTypeName() string { 197 return "pkg/sentry/fsimpl/tmpfs.namedPipe" 198 } 199 200 func (n *namedPipe) StateFields() []string { 201 return []string{ 202 "inode", 203 "pipe", 204 } 205 } 206 207 func (n *namedPipe) beforeSave() {} 208 209 // +checklocksignore 210 func (n *namedPipe) StateSave(stateSinkObject state.Sink) { 211 n.beforeSave() 212 stateSinkObject.Save(0, &n.inode) 213 stateSinkObject.Save(1, &n.pipe) 214 } 215 216 func (n *namedPipe) afterLoad(context.Context) {} 217 218 // +checklocksignore 219 func (n *namedPipe) StateLoad(ctx context.Context, stateSourceObject state.Source) { 220 stateSourceObject.Load(0, &n.inode) 221 stateSourceObject.Load(1, &n.pipe) 222 } 223 224 func (rf *regularFile) StateTypeName() string { 225 return "pkg/sentry/fsimpl/tmpfs.regularFile" 226 } 227 228 func (rf *regularFile) StateFields() []string { 229 return []string{ 230 "inode", 231 "memoryUsageKind", 232 "mappings", 233 "writableMappingPages", 234 "data", 235 "seals", 236 "size", 237 } 238 } 239 240 func (rf *regularFile) beforeSave() {} 241 242 // +checklocksignore 243 func (rf *regularFile) StateSave(stateSinkObject state.Sink) { 244 rf.beforeSave() 245 stateSinkObject.Save(0, &rf.inode) 246 stateSinkObject.Save(1, &rf.memoryUsageKind) 247 stateSinkObject.Save(2, &rf.mappings) 248 stateSinkObject.Save(3, &rf.writableMappingPages) 249 stateSinkObject.Save(4, &rf.data) 250 stateSinkObject.Save(5, &rf.seals) 251 stateSinkObject.Save(6, &rf.size) 252 } 253 254 func (rf *regularFile) afterLoad(context.Context) {} 255 256 // +checklocksignore 257 func (rf *regularFile) StateLoad(ctx context.Context, stateSourceObject state.Source) { 258 stateSourceObject.Load(0, &rf.inode) 259 stateSourceObject.Load(1, &rf.memoryUsageKind) 260 stateSourceObject.Load(2, &rf.mappings) 261 stateSourceObject.Load(3, &rf.writableMappingPages) 262 stateSourceObject.Load(4, &rf.data) 263 stateSourceObject.Load(5, &rf.seals) 264 stateSourceObject.Load(6, &rf.size) 265 } 266 267 func (fd *regularFileFD) StateTypeName() string { 268 return "pkg/sentry/fsimpl/tmpfs.regularFileFD" 269 } 270 271 func (fd *regularFileFD) StateFields() []string { 272 return []string{ 273 "fileDescription", 274 "off", 275 } 276 } 277 278 func (fd *regularFileFD) beforeSave() {} 279 280 // +checklocksignore 281 func (fd *regularFileFD) StateSave(stateSinkObject state.Sink) { 282 fd.beforeSave() 283 stateSinkObject.Save(0, &fd.fileDescription) 284 stateSinkObject.Save(1, &fd.off) 285 } 286 287 func (fd *regularFileFD) afterLoad(context.Context) {} 288 289 // +checklocksignore 290 func (fd *regularFileFD) StateLoad(ctx context.Context, stateSourceObject state.Source) { 291 stateSourceObject.Load(0, &fd.fileDescription) 292 stateSourceObject.Load(1, &fd.off) 293 } 294 295 func (s *socketFile) StateTypeName() string { 296 return "pkg/sentry/fsimpl/tmpfs.socketFile" 297 } 298 299 func (s *socketFile) StateFields() []string { 300 return []string{ 301 "inode", 302 "ep", 303 } 304 } 305 306 func (s *socketFile) beforeSave() {} 307 308 // +checklocksignore 309 func (s *socketFile) StateSave(stateSinkObject state.Sink) { 310 s.beforeSave() 311 stateSinkObject.Save(0, &s.inode) 312 stateSinkObject.Save(1, &s.ep) 313 } 314 315 func (s *socketFile) afterLoad(context.Context) {} 316 317 // +checklocksignore 318 func (s *socketFile) StateLoad(ctx context.Context, stateSourceObject state.Source) { 319 stateSourceObject.Load(0, &s.inode) 320 stateSourceObject.Load(1, &s.ep) 321 } 322 323 func (s *symlink) StateTypeName() string { 324 return "pkg/sentry/fsimpl/tmpfs.symlink" 325 } 326 327 func (s *symlink) StateFields() []string { 328 return []string{ 329 "inode", 330 "target", 331 } 332 } 333 334 func (s *symlink) beforeSave() {} 335 336 // +checklocksignore 337 func (s *symlink) StateSave(stateSinkObject state.Sink) { 338 s.beforeSave() 339 stateSinkObject.Save(0, &s.inode) 340 stateSinkObject.Save(1, &s.target) 341 } 342 343 func (s *symlink) afterLoad(context.Context) {} 344 345 // +checklocksignore 346 func (s *symlink) StateLoad(ctx context.Context, stateSourceObject state.Source) { 347 stateSourceObject.Load(0, &s.inode) 348 stateSourceObject.Load(1, &s.target) 349 } 350 351 func (fstype *FilesystemType) StateTypeName() string { 352 return "pkg/sentry/fsimpl/tmpfs.FilesystemType" 353 } 354 355 func (fstype *FilesystemType) StateFields() []string { 356 return []string{} 357 } 358 359 func (fstype *FilesystemType) beforeSave() {} 360 361 // +checklocksignore 362 func (fstype *FilesystemType) StateSave(stateSinkObject state.Sink) { 363 fstype.beforeSave() 364 } 365 366 func (fstype *FilesystemType) afterLoad(context.Context) {} 367 368 // +checklocksignore 369 func (fstype *FilesystemType) StateLoad(ctx context.Context, stateSourceObject state.Source) { 370 } 371 372 func (fs *filesystem) StateTypeName() string { 373 return "pkg/sentry/fsimpl/tmpfs.filesystem" 374 } 375 376 func (fs *filesystem) StateFields() []string { 377 return []string{ 378 "vfsfs", 379 "mf", 380 "clock", 381 "devMinor", 382 "mopts", 383 "usage", 384 "nextInoMinusOne", 385 "root", 386 "maxFilenameLen", 387 "maxSizeInPages", 388 "pagesUsed", 389 "allowXattrPrefix", 390 } 391 } 392 393 func (fs *filesystem) beforeSave() {} 394 395 // +checklocksignore 396 func (fs *filesystem) StateSave(stateSinkObject state.Sink) { 397 fs.beforeSave() 398 var mfValue string 399 mfValue = fs.saveMf() 400 stateSinkObject.SaveValue(1, mfValue) 401 stateSinkObject.Save(0, &fs.vfsfs) 402 stateSinkObject.Save(2, &fs.clock) 403 stateSinkObject.Save(3, &fs.devMinor) 404 stateSinkObject.Save(4, &fs.mopts) 405 stateSinkObject.Save(5, &fs.usage) 406 stateSinkObject.Save(6, &fs.nextInoMinusOne) 407 stateSinkObject.Save(7, &fs.root) 408 stateSinkObject.Save(8, &fs.maxFilenameLen) 409 stateSinkObject.Save(9, &fs.maxSizeInPages) 410 stateSinkObject.Save(10, &fs.pagesUsed) 411 stateSinkObject.Save(11, &fs.allowXattrPrefix) 412 } 413 414 func (fs *filesystem) afterLoad(context.Context) {} 415 416 // +checklocksignore 417 func (fs *filesystem) StateLoad(ctx context.Context, stateSourceObject state.Source) { 418 stateSourceObject.Load(0, &fs.vfsfs) 419 stateSourceObject.Load(2, &fs.clock) 420 stateSourceObject.Load(3, &fs.devMinor) 421 stateSourceObject.Load(4, &fs.mopts) 422 stateSourceObject.Load(5, &fs.usage) 423 stateSourceObject.Load(6, &fs.nextInoMinusOne) 424 stateSourceObject.Load(7, &fs.root) 425 stateSourceObject.Load(8, &fs.maxFilenameLen) 426 stateSourceObject.Load(9, &fs.maxSizeInPages) 427 stateSourceObject.Load(10, &fs.pagesUsed) 428 stateSourceObject.Load(11, &fs.allowXattrPrefix) 429 stateSourceObject.LoadValue(1, new(string), func(y any) { fs.loadMf(ctx, y.(string)) }) 430 } 431 432 func (f *FilesystemOpts) StateTypeName() string { 433 return "pkg/sentry/fsimpl/tmpfs.FilesystemOpts" 434 } 435 436 func (f *FilesystemOpts) StateFields() []string { 437 return []string{ 438 "RootFileType", 439 "RootSymlinkTarget", 440 "FilesystemType", 441 "Usage", 442 "MaxFilenameLen", 443 "MemoryFile", 444 "DisableDefaultSizeLimit", 445 "AllowXattrPrefix", 446 } 447 } 448 449 func (f *FilesystemOpts) beforeSave() {} 450 451 // +checklocksignore 452 func (f *FilesystemOpts) StateSave(stateSinkObject state.Sink) { 453 f.beforeSave() 454 stateSinkObject.Save(0, &f.RootFileType) 455 stateSinkObject.Save(1, &f.RootSymlinkTarget) 456 stateSinkObject.Save(2, &f.FilesystemType) 457 stateSinkObject.Save(3, &f.Usage) 458 stateSinkObject.Save(4, &f.MaxFilenameLen) 459 stateSinkObject.Save(5, &f.MemoryFile) 460 stateSinkObject.Save(6, &f.DisableDefaultSizeLimit) 461 stateSinkObject.Save(7, &f.AllowXattrPrefix) 462 } 463 464 func (f *FilesystemOpts) afterLoad(context.Context) {} 465 466 // +checklocksignore 467 func (f *FilesystemOpts) StateLoad(ctx context.Context, stateSourceObject state.Source) { 468 stateSourceObject.Load(0, &f.RootFileType) 469 stateSourceObject.Load(1, &f.RootSymlinkTarget) 470 stateSourceObject.Load(2, &f.FilesystemType) 471 stateSourceObject.Load(3, &f.Usage) 472 stateSourceObject.Load(4, &f.MaxFilenameLen) 473 stateSourceObject.Load(5, &f.MemoryFile) 474 stateSourceObject.Load(6, &f.DisableDefaultSizeLimit) 475 stateSourceObject.Load(7, &f.AllowXattrPrefix) 476 } 477 478 func (d *dentry) StateTypeName() string { 479 return "pkg/sentry/fsimpl/tmpfs.dentry" 480 } 481 482 func (d *dentry) StateFields() []string { 483 return []string{ 484 "vfsd", 485 "parent", 486 "name", 487 "dentryEntry", 488 "inode", 489 } 490 } 491 492 func (d *dentry) beforeSave() {} 493 494 // +checklocksignore 495 func (d *dentry) StateSave(stateSinkObject state.Sink) { 496 d.beforeSave() 497 var parentValue *dentry 498 parentValue = d.saveParent() 499 stateSinkObject.SaveValue(1, parentValue) 500 stateSinkObject.Save(0, &d.vfsd) 501 stateSinkObject.Save(2, &d.name) 502 stateSinkObject.Save(3, &d.dentryEntry) 503 stateSinkObject.Save(4, &d.inode) 504 } 505 506 func (d *dentry) afterLoad(context.Context) {} 507 508 // +checklocksignore 509 func (d *dentry) StateLoad(ctx context.Context, stateSourceObject state.Source) { 510 stateSourceObject.Load(0, &d.vfsd) 511 stateSourceObject.Load(2, &d.name) 512 stateSourceObject.Load(3, &d.dentryEntry) 513 stateSourceObject.Load(4, &d.inode) 514 stateSourceObject.LoadValue(1, new(*dentry), func(y any) { d.loadParent(ctx, y.(*dentry)) }) 515 } 516 517 func (i *inode) StateTypeName() string { 518 return "pkg/sentry/fsimpl/tmpfs.inode" 519 } 520 521 func (i *inode) StateFields() []string { 522 return []string{ 523 "fs", 524 "refs", 525 "xattrs", 526 "mode", 527 "nlink", 528 "uid", 529 "gid", 530 "ino", 531 "atime", 532 "ctime", 533 "mtime", 534 "locks", 535 "watches", 536 "impl", 537 } 538 } 539 540 func (i *inode) beforeSave() {} 541 542 // +checklocksignore 543 func (i *inode) StateSave(stateSinkObject state.Sink) { 544 i.beforeSave() 545 stateSinkObject.Save(0, &i.fs) 546 stateSinkObject.Save(1, &i.refs) 547 stateSinkObject.Save(2, &i.xattrs) 548 stateSinkObject.Save(3, &i.mode) 549 stateSinkObject.Save(4, &i.nlink) 550 stateSinkObject.Save(5, &i.uid) 551 stateSinkObject.Save(6, &i.gid) 552 stateSinkObject.Save(7, &i.ino) 553 stateSinkObject.Save(8, &i.atime) 554 stateSinkObject.Save(9, &i.ctime) 555 stateSinkObject.Save(10, &i.mtime) 556 stateSinkObject.Save(11, &i.locks) 557 stateSinkObject.Save(12, &i.watches) 558 stateSinkObject.Save(13, &i.impl) 559 } 560 561 func (i *inode) afterLoad(context.Context) {} 562 563 // +checklocksignore 564 func (i *inode) StateLoad(ctx context.Context, stateSourceObject state.Source) { 565 stateSourceObject.Load(0, &i.fs) 566 stateSourceObject.Load(1, &i.refs) 567 stateSourceObject.Load(2, &i.xattrs) 568 stateSourceObject.Load(3, &i.mode) 569 stateSourceObject.Load(4, &i.nlink) 570 stateSourceObject.Load(5, &i.uid) 571 stateSourceObject.Load(6, &i.gid) 572 stateSourceObject.Load(7, &i.ino) 573 stateSourceObject.Load(8, &i.atime) 574 stateSourceObject.Load(9, &i.ctime) 575 stateSourceObject.Load(10, &i.mtime) 576 stateSourceObject.Load(11, &i.locks) 577 stateSourceObject.Load(12, &i.watches) 578 stateSourceObject.Load(13, &i.impl) 579 } 580 581 func (fd *fileDescription) StateTypeName() string { 582 return "pkg/sentry/fsimpl/tmpfs.fileDescription" 583 } 584 585 func (fd *fileDescription) StateFields() []string { 586 return []string{ 587 "vfsfd", 588 "FileDescriptionDefaultImpl", 589 "LockFD", 590 } 591 } 592 593 func (fd *fileDescription) beforeSave() {} 594 595 // +checklocksignore 596 func (fd *fileDescription) StateSave(stateSinkObject state.Sink) { 597 fd.beforeSave() 598 stateSinkObject.Save(0, &fd.vfsfd) 599 stateSinkObject.Save(1, &fd.FileDescriptionDefaultImpl) 600 stateSinkObject.Save(2, &fd.LockFD) 601 } 602 603 func (fd *fileDescription) afterLoad(context.Context) {} 604 605 // +checklocksignore 606 func (fd *fileDescription) StateLoad(ctx context.Context, stateSourceObject state.Source) { 607 stateSourceObject.Load(0, &fd.vfsfd) 608 stateSourceObject.Load(1, &fd.FileDescriptionDefaultImpl) 609 stateSourceObject.Load(2, &fd.LockFD) 610 } 611 612 func init() { 613 state.Register((*dentryList)(nil)) 614 state.Register((*dentryEntry)(nil)) 615 state.Register((*deviceFile)(nil)) 616 state.Register((*directory)(nil)) 617 state.Register((*directoryFD)(nil)) 618 state.Register((*inodeRefs)(nil)) 619 state.Register((*namedPipe)(nil)) 620 state.Register((*regularFile)(nil)) 621 state.Register((*regularFileFD)(nil)) 622 state.Register((*socketFile)(nil)) 623 state.Register((*symlink)(nil)) 624 state.Register((*FilesystemType)(nil)) 625 state.Register((*filesystem)(nil)) 626 state.Register((*FilesystemOpts)(nil)) 627 state.Register((*dentry)(nil)) 628 state.Register((*inode)(nil)) 629 state.Register((*fileDescription)(nil)) 630 }