github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/kernel/pipe/pipe_state_autogen.go (about) 1 // automatically generated by stateify. 2 3 package pipe 4 5 import ( 6 "context" 7 8 "github.com/metacubex/gvisor/pkg/state" 9 ) 10 11 func (p *Pipe) StateTypeName() string { 12 return "pkg/sentry/kernel/pipe.Pipe" 13 } 14 15 func (p *Pipe) StateFields() []string { 16 return []string{ 17 "queue", 18 "isNamed", 19 "readers", 20 "totalReaders", 21 "writers", 22 "totalWriters", 23 "buf", 24 "off", 25 "size", 26 "max", 27 "hadWriter", 28 } 29 } 30 31 func (p *Pipe) beforeSave() {} 32 33 // +checklocksignore 34 func (p *Pipe) StateSave(stateSinkObject state.Sink) { 35 p.beforeSave() 36 stateSinkObject.Save(0, &p.queue) 37 stateSinkObject.Save(1, &p.isNamed) 38 stateSinkObject.Save(2, &p.readers) 39 stateSinkObject.Save(3, &p.totalReaders) 40 stateSinkObject.Save(4, &p.writers) 41 stateSinkObject.Save(5, &p.totalWriters) 42 stateSinkObject.Save(6, &p.buf) 43 stateSinkObject.Save(7, &p.off) 44 stateSinkObject.Save(8, &p.size) 45 stateSinkObject.Save(9, &p.max) 46 stateSinkObject.Save(10, &p.hadWriter) 47 } 48 49 // +checklocksignore 50 func (p *Pipe) StateLoad(ctx context.Context, stateSourceObject state.Source) { 51 stateSourceObject.Load(0, &p.queue) 52 stateSourceObject.Load(1, &p.isNamed) 53 stateSourceObject.Load(2, &p.readers) 54 stateSourceObject.Load(3, &p.totalReaders) 55 stateSourceObject.Load(4, &p.writers) 56 stateSourceObject.Load(5, &p.totalWriters) 57 stateSourceObject.Load(6, &p.buf) 58 stateSourceObject.Load(7, &p.off) 59 stateSourceObject.Load(8, &p.size) 60 stateSourceObject.Load(9, &p.max) 61 stateSourceObject.Load(10, &p.hadWriter) 62 stateSourceObject.AfterLoad(func() { p.afterLoad(ctx) }) 63 } 64 65 func (vp *VFSPipe) StateTypeName() string { 66 return "pkg/sentry/kernel/pipe.VFSPipe" 67 } 68 69 func (vp *VFSPipe) StateFields() []string { 70 return []string{ 71 "pipe", 72 } 73 } 74 75 func (vp *VFSPipe) beforeSave() {} 76 77 // +checklocksignore 78 func (vp *VFSPipe) StateSave(stateSinkObject state.Sink) { 79 vp.beforeSave() 80 stateSinkObject.Save(0, &vp.pipe) 81 } 82 83 func (vp *VFSPipe) afterLoad(context.Context) {} 84 85 // +checklocksignore 86 func (vp *VFSPipe) StateLoad(ctx context.Context, stateSourceObject state.Source) { 87 stateSourceObject.Load(0, &vp.pipe) 88 } 89 90 func (fd *VFSPipeFD) StateTypeName() string { 91 return "pkg/sentry/kernel/pipe.VFSPipeFD" 92 } 93 94 func (fd *VFSPipeFD) StateFields() []string { 95 return []string{ 96 "vfsfd", 97 "FileDescriptionDefaultImpl", 98 "DentryMetadataFileDescriptionImpl", 99 "LockFD", 100 "pipe", 101 "lastAddr", 102 } 103 } 104 105 func (fd *VFSPipeFD) beforeSave() {} 106 107 // +checklocksignore 108 func (fd *VFSPipeFD) StateSave(stateSinkObject state.Sink) { 109 fd.beforeSave() 110 stateSinkObject.Save(0, &fd.vfsfd) 111 stateSinkObject.Save(1, &fd.FileDescriptionDefaultImpl) 112 stateSinkObject.Save(2, &fd.DentryMetadataFileDescriptionImpl) 113 stateSinkObject.Save(3, &fd.LockFD) 114 stateSinkObject.Save(4, &fd.pipe) 115 stateSinkObject.Save(5, &fd.lastAddr) 116 } 117 118 func (fd *VFSPipeFD) afterLoad(context.Context) {} 119 120 // +checklocksignore 121 func (fd *VFSPipeFD) StateLoad(ctx context.Context, stateSourceObject state.Source) { 122 stateSourceObject.Load(0, &fd.vfsfd) 123 stateSourceObject.Load(1, &fd.FileDescriptionDefaultImpl) 124 stateSourceObject.Load(2, &fd.DentryMetadataFileDescriptionImpl) 125 stateSourceObject.Load(3, &fd.LockFD) 126 stateSourceObject.Load(4, &fd.pipe) 127 stateSourceObject.Load(5, &fd.lastAddr) 128 } 129 130 func init() { 131 state.Register((*Pipe)(nil)) 132 state.Register((*VFSPipe)(nil)) 133 state.Register((*VFSPipeFD)(nil)) 134 }