github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/socket/unix/unix_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  package unix
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/metacubex/gvisor/pkg/state"
     9  )
    10  
    11  func (r *socketRefs) StateTypeName() string {
    12  	return "pkg/sentry/socket/unix.socketRefs"
    13  }
    14  
    15  func (r *socketRefs) StateFields() []string {
    16  	return []string{
    17  		"refCount",
    18  	}
    19  }
    20  
    21  func (r *socketRefs) beforeSave() {}
    22  
    23  // +checklocksignore
    24  func (r *socketRefs) StateSave(stateSinkObject state.Sink) {
    25  	r.beforeSave()
    26  	stateSinkObject.Save(0, &r.refCount)
    27  }
    28  
    29  // +checklocksignore
    30  func (r *socketRefs) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    31  	stateSourceObject.Load(0, &r.refCount)
    32  	stateSourceObject.AfterLoad(func() { r.afterLoad(ctx) })
    33  }
    34  
    35  func (s *Socket) StateTypeName() string {
    36  	return "pkg/sentry/socket/unix.Socket"
    37  }
    38  
    39  func (s *Socket) StateFields() []string {
    40  	return []string{
    41  		"vfsfd",
    42  		"FileDescriptionDefaultImpl",
    43  		"DentryMetadataFileDescriptionImpl",
    44  		"LockFD",
    45  		"SendReceiveTimeout",
    46  		"socketRefs",
    47  		"namespace",
    48  		"ep",
    49  		"stype",
    50  		"abstractName",
    51  		"abstractBound",
    52  	}
    53  }
    54  
    55  func (s *Socket) beforeSave() {}
    56  
    57  // +checklocksignore
    58  func (s *Socket) StateSave(stateSinkObject state.Sink) {
    59  	s.beforeSave()
    60  	stateSinkObject.Save(0, &s.vfsfd)
    61  	stateSinkObject.Save(1, &s.FileDescriptionDefaultImpl)
    62  	stateSinkObject.Save(2, &s.DentryMetadataFileDescriptionImpl)
    63  	stateSinkObject.Save(3, &s.LockFD)
    64  	stateSinkObject.Save(4, &s.SendReceiveTimeout)
    65  	stateSinkObject.Save(5, &s.socketRefs)
    66  	stateSinkObject.Save(6, &s.namespace)
    67  	stateSinkObject.Save(7, &s.ep)
    68  	stateSinkObject.Save(8, &s.stype)
    69  	stateSinkObject.Save(9, &s.abstractName)
    70  	stateSinkObject.Save(10, &s.abstractBound)
    71  }
    72  
    73  func (s *Socket) afterLoad(context.Context) {}
    74  
    75  // +checklocksignore
    76  func (s *Socket) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    77  	stateSourceObject.Load(0, &s.vfsfd)
    78  	stateSourceObject.Load(1, &s.FileDescriptionDefaultImpl)
    79  	stateSourceObject.Load(2, &s.DentryMetadataFileDescriptionImpl)
    80  	stateSourceObject.Load(3, &s.LockFD)
    81  	stateSourceObject.Load(4, &s.SendReceiveTimeout)
    82  	stateSourceObject.Load(5, &s.socketRefs)
    83  	stateSourceObject.Load(6, &s.namespace)
    84  	stateSourceObject.Load(7, &s.ep)
    85  	stateSourceObject.Load(8, &s.stype)
    86  	stateSourceObject.Load(9, &s.abstractName)
    87  	stateSourceObject.Load(10, &s.abstractBound)
    88  }
    89  
    90  func init() {
    91  	state.Register((*socketRefs)(nil))
    92  	state.Register((*Socket)(nil))
    93  }