github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/fsimpl/erofs/erofs_state_autogen.go (about) 1 // automatically generated by stateify. 2 3 package erofs 4 5 import ( 6 "context" 7 8 "github.com/metacubex/gvisor/pkg/state" 9 ) 10 11 func (r *dentryRefs) StateTypeName() string { 12 return "pkg/sentry/fsimpl/erofs.dentryRefs" 13 } 14 15 func (r *dentryRefs) StateFields() []string { 16 return []string{ 17 "refCount", 18 } 19 } 20 21 func (r *dentryRefs) beforeSave() {} 22 23 // +checklocksignore 24 func (r *dentryRefs) StateSave(stateSinkObject state.Sink) { 25 r.beforeSave() 26 stateSinkObject.Save(0, &r.refCount) 27 } 28 29 // +checklocksignore 30 func (r *dentryRefs) StateLoad(ctx context.Context, stateSourceObject state.Source) { 31 stateSourceObject.Load(0, &r.refCount) 32 stateSourceObject.AfterLoad(func() { r.afterLoad(ctx) }) 33 } 34 35 func (fd *directoryFD) StateTypeName() string { 36 return "pkg/sentry/fsimpl/erofs.directoryFD" 37 } 38 39 func (fd *directoryFD) StateFields() []string { 40 return []string{ 41 "fileDescription", 42 "DirectoryFileDescriptionDefaultImpl", 43 "off", 44 } 45 } 46 47 func (fd *directoryFD) beforeSave() {} 48 49 // +checklocksignore 50 func (fd *directoryFD) StateSave(stateSinkObject state.Sink) { 51 fd.beforeSave() 52 stateSinkObject.Save(0, &fd.fileDescription) 53 stateSinkObject.Save(1, &fd.DirectoryFileDescriptionDefaultImpl) 54 stateSinkObject.Save(2, &fd.off) 55 } 56 57 func (fd *directoryFD) afterLoad(context.Context) {} 58 59 // +checklocksignore 60 func (fd *directoryFD) StateLoad(ctx context.Context, stateSourceObject state.Source) { 61 stateSourceObject.Load(0, &fd.fileDescription) 62 stateSourceObject.Load(1, &fd.DirectoryFileDescriptionDefaultImpl) 63 stateSourceObject.Load(2, &fd.off) 64 } 65 66 func (fstype *FilesystemType) StateTypeName() string { 67 return "pkg/sentry/fsimpl/erofs.FilesystemType" 68 } 69 70 func (fstype *FilesystemType) StateFields() []string { 71 return []string{} 72 } 73 74 func (fstype *FilesystemType) beforeSave() {} 75 76 // +checklocksignore 77 func (fstype *FilesystemType) StateSave(stateSinkObject state.Sink) { 78 fstype.beforeSave() 79 } 80 81 func (fstype *FilesystemType) afterLoad(context.Context) {} 82 83 // +checklocksignore 84 func (fstype *FilesystemType) StateLoad(ctx context.Context, stateSourceObject state.Source) { 85 } 86 87 func (fs *filesystem) StateTypeName() string { 88 return "pkg/sentry/fsimpl/erofs.filesystem" 89 } 90 91 func (fs *filesystem) StateFields() []string { 92 return []string{ 93 "vfsfs", 94 "mopts", 95 "iopts", 96 "devMinor", 97 "root", 98 "image", 99 "mf", 100 "inodeBuckets", 101 } 102 } 103 104 func (fs *filesystem) beforeSave() {} 105 106 // +checklocksignore 107 func (fs *filesystem) StateSave(stateSinkObject state.Sink) { 108 fs.beforeSave() 109 stateSinkObject.Save(0, &fs.vfsfs) 110 stateSinkObject.Save(1, &fs.mopts) 111 stateSinkObject.Save(2, &fs.iopts) 112 stateSinkObject.Save(3, &fs.devMinor) 113 stateSinkObject.Save(4, &fs.root) 114 stateSinkObject.Save(5, &fs.image) 115 stateSinkObject.Save(6, &fs.mf) 116 stateSinkObject.Save(7, &fs.inodeBuckets) 117 } 118 119 // +checklocksignore 120 func (fs *filesystem) StateLoad(ctx context.Context, stateSourceObject state.Source) { 121 stateSourceObject.Load(0, &fs.vfsfs) 122 stateSourceObject.Load(1, &fs.mopts) 123 stateSourceObject.Load(2, &fs.iopts) 124 stateSourceObject.Load(3, &fs.devMinor) 125 stateSourceObject.Load(4, &fs.root) 126 stateSourceObject.Load(5, &fs.image) 127 stateSourceObject.Load(6, &fs.mf) 128 stateSourceObject.Load(7, &fs.inodeBuckets) 129 stateSourceObject.AfterLoad(func() { fs.afterLoad(ctx) }) 130 } 131 132 func (i *InternalFilesystemOptions) StateTypeName() string { 133 return "pkg/sentry/fsimpl/erofs.InternalFilesystemOptions" 134 } 135 136 func (i *InternalFilesystemOptions) StateFields() []string { 137 return []string{ 138 "UniqueID", 139 } 140 } 141 142 func (i *InternalFilesystemOptions) beforeSave() {} 143 144 // +checklocksignore 145 func (i *InternalFilesystemOptions) StateSave(stateSinkObject state.Sink) { 146 i.beforeSave() 147 stateSinkObject.Save(0, &i.UniqueID) 148 } 149 150 func (i *InternalFilesystemOptions) afterLoad(context.Context) {} 151 152 // +checklocksignore 153 func (i *InternalFilesystemOptions) StateLoad(ctx context.Context, stateSourceObject state.Source) { 154 stateSourceObject.Load(0, &i.UniqueID) 155 } 156 157 func (ib *inodeBucket) StateTypeName() string { 158 return "pkg/sentry/fsimpl/erofs.inodeBucket" 159 } 160 161 func (ib *inodeBucket) StateFields() []string { 162 return []string{ 163 "inodeMap", 164 } 165 } 166 167 func (ib *inodeBucket) beforeSave() {} 168 169 // +checklocksignore 170 func (ib *inodeBucket) StateSave(stateSinkObject state.Sink) { 171 ib.beforeSave() 172 stateSinkObject.Save(0, &ib.inodeMap) 173 } 174 175 func (ib *inodeBucket) afterLoad(context.Context) {} 176 177 // +checklocksignore 178 func (ib *inodeBucket) StateLoad(ctx context.Context, stateSourceObject state.Source) { 179 stateSourceObject.Load(0, &ib.inodeMap) 180 } 181 182 func (i *inode) StateTypeName() string { 183 return "pkg/sentry/fsimpl/erofs.inode" 184 } 185 186 func (i *inode) StateFields() []string { 187 return []string{ 188 "Inode", 189 "inodeRefs", 190 "fs", 191 "mappings", 192 "locks", 193 "watches", 194 } 195 } 196 197 func (i *inode) beforeSave() {} 198 199 // +checklocksignore 200 func (i *inode) StateSave(stateSinkObject state.Sink) { 201 i.beforeSave() 202 stateSinkObject.Save(0, &i.Inode) 203 stateSinkObject.Save(1, &i.inodeRefs) 204 stateSinkObject.Save(2, &i.fs) 205 stateSinkObject.Save(3, &i.mappings) 206 stateSinkObject.Save(4, &i.locks) 207 stateSinkObject.Save(5, &i.watches) 208 } 209 210 func (i *inode) afterLoad(context.Context) {} 211 212 // +checklocksignore 213 func (i *inode) StateLoad(ctx context.Context, stateSourceObject state.Source) { 214 stateSourceObject.Load(0, &i.Inode) 215 stateSourceObject.Load(1, &i.inodeRefs) 216 stateSourceObject.Load(2, &i.fs) 217 stateSourceObject.Load(3, &i.mappings) 218 stateSourceObject.Load(4, &i.locks) 219 stateSourceObject.Load(5, &i.watches) 220 } 221 222 func (d *dentry) StateTypeName() string { 223 return "pkg/sentry/fsimpl/erofs.dentry" 224 } 225 226 func (d *dentry) StateFields() []string { 227 return []string{ 228 "vfsd", 229 "dentryRefs", 230 "parent", 231 "name", 232 "inode", 233 "childMap", 234 } 235 } 236 237 func (d *dentry) beforeSave() {} 238 239 // +checklocksignore 240 func (d *dentry) StateSave(stateSinkObject state.Sink) { 241 d.beforeSave() 242 var parentValue *dentry 243 parentValue = d.saveParent() 244 stateSinkObject.SaveValue(2, parentValue) 245 stateSinkObject.Save(0, &d.vfsd) 246 stateSinkObject.Save(1, &d.dentryRefs) 247 stateSinkObject.Save(3, &d.name) 248 stateSinkObject.Save(4, &d.inode) 249 stateSinkObject.Save(5, &d.childMap) 250 } 251 252 func (d *dentry) afterLoad(context.Context) {} 253 254 // +checklocksignore 255 func (d *dentry) StateLoad(ctx context.Context, stateSourceObject state.Source) { 256 stateSourceObject.Load(0, &d.vfsd) 257 stateSourceObject.Load(1, &d.dentryRefs) 258 stateSourceObject.Load(3, &d.name) 259 stateSourceObject.Load(4, &d.inode) 260 stateSourceObject.Load(5, &d.childMap) 261 stateSourceObject.LoadValue(2, new(*dentry), func(y any) { d.loadParent(ctx, y.(*dentry)) }) 262 } 263 264 func (fd *fileDescription) StateTypeName() string { 265 return "pkg/sentry/fsimpl/erofs.fileDescription" 266 } 267 268 func (fd *fileDescription) StateFields() []string { 269 return []string{ 270 "vfsfd", 271 "FileDescriptionDefaultImpl", 272 "LockFD", 273 } 274 } 275 276 func (fd *fileDescription) beforeSave() {} 277 278 // +checklocksignore 279 func (fd *fileDescription) StateSave(stateSinkObject state.Sink) { 280 fd.beforeSave() 281 stateSinkObject.Save(0, &fd.vfsfd) 282 stateSinkObject.Save(1, &fd.FileDescriptionDefaultImpl) 283 stateSinkObject.Save(2, &fd.LockFD) 284 } 285 286 func (fd *fileDescription) afterLoad(context.Context) {} 287 288 // +checklocksignore 289 func (fd *fileDescription) StateLoad(ctx context.Context, stateSourceObject state.Source) { 290 stateSourceObject.Load(0, &fd.vfsfd) 291 stateSourceObject.Load(1, &fd.FileDescriptionDefaultImpl) 292 stateSourceObject.Load(2, &fd.LockFD) 293 } 294 295 func (r *inodeRefs) StateTypeName() string { 296 return "pkg/sentry/fsimpl/erofs.inodeRefs" 297 } 298 299 func (r *inodeRefs) StateFields() []string { 300 return []string{ 301 "refCount", 302 } 303 } 304 305 func (r *inodeRefs) beforeSave() {} 306 307 // +checklocksignore 308 func (r *inodeRefs) StateSave(stateSinkObject state.Sink) { 309 r.beforeSave() 310 stateSinkObject.Save(0, &r.refCount) 311 } 312 313 // +checklocksignore 314 func (r *inodeRefs) StateLoad(ctx context.Context, stateSourceObject state.Source) { 315 stateSourceObject.Load(0, &r.refCount) 316 stateSourceObject.AfterLoad(func() { r.afterLoad(ctx) }) 317 } 318 319 func (fd *regularFileFD) StateTypeName() string { 320 return "pkg/sentry/fsimpl/erofs.regularFileFD" 321 } 322 323 func (fd *regularFileFD) StateFields() []string { 324 return []string{ 325 "fileDescription", 326 "off", 327 } 328 } 329 330 func (fd *regularFileFD) beforeSave() {} 331 332 // +checklocksignore 333 func (fd *regularFileFD) StateSave(stateSinkObject state.Sink) { 334 fd.beforeSave() 335 stateSinkObject.Save(0, &fd.fileDescription) 336 stateSinkObject.Save(1, &fd.off) 337 } 338 339 func (fd *regularFileFD) afterLoad(context.Context) {} 340 341 // +checklocksignore 342 func (fd *regularFileFD) StateLoad(ctx context.Context, stateSourceObject state.Source) { 343 stateSourceObject.Load(0, &fd.fileDescription) 344 stateSourceObject.Load(1, &fd.off) 345 } 346 347 func (mf *imageMemmapFile) StateTypeName() string { 348 return "pkg/sentry/fsimpl/erofs.imageMemmapFile" 349 } 350 351 func (mf *imageMemmapFile) StateFields() []string { 352 return []string{ 353 "image", 354 } 355 } 356 357 func (mf *imageMemmapFile) beforeSave() {} 358 359 // +checklocksignore 360 func (mf *imageMemmapFile) StateSave(stateSinkObject state.Sink) { 361 mf.beforeSave() 362 stateSinkObject.Save(0, &mf.image) 363 } 364 365 func (mf *imageMemmapFile) afterLoad(context.Context) {} 366 367 // +checklocksignore 368 func (mf *imageMemmapFile) StateLoad(ctx context.Context, stateSourceObject state.Source) { 369 stateSourceObject.Load(0, &mf.image) 370 } 371 372 func init() { 373 state.Register((*dentryRefs)(nil)) 374 state.Register((*directoryFD)(nil)) 375 state.Register((*FilesystemType)(nil)) 376 state.Register((*filesystem)(nil)) 377 state.Register((*InternalFilesystemOptions)(nil)) 378 state.Register((*inodeBucket)(nil)) 379 state.Register((*inode)(nil)) 380 state.Register((*dentry)(nil)) 381 state.Register((*fileDescription)(nil)) 382 state.Register((*inodeRefs)(nil)) 383 state.Register((*regularFileFD)(nil)) 384 state.Register((*imageMemmapFile)(nil)) 385 }