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

     1  // automatically generated by stateify.
     2  
     3  package netstack
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/metacubex/gvisor/pkg/state"
     9  )
    10  
    11  func (s *sock) StateTypeName() string {
    12  	return "pkg/sentry/socket/netstack.sock"
    13  }
    14  
    15  func (s *sock) StateFields() []string {
    16  	return []string{
    17  		"vfsfd",
    18  		"FileDescriptionDefaultImpl",
    19  		"DentryMetadataFileDescriptionImpl",
    20  		"LockFD",
    21  		"SendReceiveTimeout",
    22  		"Queue",
    23  		"family",
    24  		"Endpoint",
    25  		"skType",
    26  		"protocol",
    27  		"namespace",
    28  		"sockOptTimestamp",
    29  		"timestampValid",
    30  		"timestamp",
    31  		"sockOptInq",
    32  	}
    33  }
    34  
    35  func (s *sock) beforeSave() {}
    36  
    37  // +checklocksignore
    38  func (s *sock) StateSave(stateSinkObject state.Sink) {
    39  	s.beforeSave()
    40  	var timestampValue int64
    41  	timestampValue = s.saveTimestamp()
    42  	stateSinkObject.SaveValue(13, timestampValue)
    43  	stateSinkObject.Save(0, &s.vfsfd)
    44  	stateSinkObject.Save(1, &s.FileDescriptionDefaultImpl)
    45  	stateSinkObject.Save(2, &s.DentryMetadataFileDescriptionImpl)
    46  	stateSinkObject.Save(3, &s.LockFD)
    47  	stateSinkObject.Save(4, &s.SendReceiveTimeout)
    48  	stateSinkObject.Save(5, &s.Queue)
    49  	stateSinkObject.Save(6, &s.family)
    50  	stateSinkObject.Save(7, &s.Endpoint)
    51  	stateSinkObject.Save(8, &s.skType)
    52  	stateSinkObject.Save(9, &s.protocol)
    53  	stateSinkObject.Save(10, &s.namespace)
    54  	stateSinkObject.Save(11, &s.sockOptTimestamp)
    55  	stateSinkObject.Save(12, &s.timestampValid)
    56  	stateSinkObject.Save(14, &s.sockOptInq)
    57  }
    58  
    59  func (s *sock) afterLoad(context.Context) {}
    60  
    61  // +checklocksignore
    62  func (s *sock) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    63  	stateSourceObject.Load(0, &s.vfsfd)
    64  	stateSourceObject.Load(1, &s.FileDescriptionDefaultImpl)
    65  	stateSourceObject.Load(2, &s.DentryMetadataFileDescriptionImpl)
    66  	stateSourceObject.Load(3, &s.LockFD)
    67  	stateSourceObject.Load(4, &s.SendReceiveTimeout)
    68  	stateSourceObject.Load(5, &s.Queue)
    69  	stateSourceObject.Load(6, &s.family)
    70  	stateSourceObject.Load(7, &s.Endpoint)
    71  	stateSourceObject.Load(8, &s.skType)
    72  	stateSourceObject.Load(9, &s.protocol)
    73  	stateSourceObject.Load(10, &s.namespace)
    74  	stateSourceObject.Load(11, &s.sockOptTimestamp)
    75  	stateSourceObject.Load(12, &s.timestampValid)
    76  	stateSourceObject.Load(14, &s.sockOptInq)
    77  	stateSourceObject.LoadValue(13, new(int64), func(y any) { s.loadTimestamp(ctx, y.(int64)) })
    78  }
    79  
    80  func (s *Stack) StateTypeName() string {
    81  	return "pkg/sentry/socket/netstack.Stack"
    82  }
    83  
    84  func (s *Stack) StateFields() []string {
    85  	return []string{}
    86  }
    87  
    88  func (s *Stack) beforeSave() {}
    89  
    90  // +checklocksignore
    91  func (s *Stack) StateSave(stateSinkObject state.Sink) {
    92  	s.beforeSave()
    93  }
    94  
    95  // +checklocksignore
    96  func (s *Stack) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    97  	stateSourceObject.AfterLoad(func() { s.afterLoad(ctx) })
    98  }
    99  
   100  func init() {
   101  	state.Register((*sock)(nil))
   102  	state.Register((*Stack)(nil))
   103  }