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

     1  // automatically generated by stateify.
     2  
     3  package transport
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/metacubex/gvisor/pkg/state"
     9  )
    10  
    11  func (e *connectionedEndpoint) StateTypeName() string {
    12  	return "pkg/sentry/socket/unix/transport.connectionedEndpoint"
    13  }
    14  
    15  func (e *connectionedEndpoint) StateFields() []string {
    16  	return []string{
    17  		"baseEndpoint",
    18  		"id",
    19  		"idGenerator",
    20  		"stype",
    21  		"acceptedChan",
    22  		"boundSocketFD",
    23  	}
    24  }
    25  
    26  // +checklocksignore
    27  func (e *connectionedEndpoint) StateSave(stateSinkObject state.Sink) {
    28  	e.beforeSave()
    29  	var acceptedChanValue []*connectionedEndpoint
    30  	acceptedChanValue = e.saveAcceptedChan()
    31  	stateSinkObject.SaveValue(4, acceptedChanValue)
    32  	stateSinkObject.Save(0, &e.baseEndpoint)
    33  	stateSinkObject.Save(1, &e.id)
    34  	stateSinkObject.Save(2, &e.idGenerator)
    35  	stateSinkObject.Save(3, &e.stype)
    36  	stateSinkObject.Save(5, &e.boundSocketFD)
    37  }
    38  
    39  // +checklocksignore
    40  func (e *connectionedEndpoint) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    41  	stateSourceObject.Load(0, &e.baseEndpoint)
    42  	stateSourceObject.Load(1, &e.id)
    43  	stateSourceObject.Load(2, &e.idGenerator)
    44  	stateSourceObject.Load(3, &e.stype)
    45  	stateSourceObject.Load(5, &e.boundSocketFD)
    46  	stateSourceObject.LoadValue(4, new([]*connectionedEndpoint), func(y any) { e.loadAcceptedChan(ctx, y.([]*connectionedEndpoint)) })
    47  	stateSourceObject.AfterLoad(func() { e.afterLoad(ctx) })
    48  }
    49  
    50  func (e *connectionlessEndpoint) StateTypeName() string {
    51  	return "pkg/sentry/socket/unix/transport.connectionlessEndpoint"
    52  }
    53  
    54  func (e *connectionlessEndpoint) StateFields() []string {
    55  	return []string{
    56  		"baseEndpoint",
    57  	}
    58  }
    59  
    60  func (e *connectionlessEndpoint) beforeSave() {}
    61  
    62  // +checklocksignore
    63  func (e *connectionlessEndpoint) StateSave(stateSinkObject state.Sink) {
    64  	e.beforeSave()
    65  	stateSinkObject.Save(0, &e.baseEndpoint)
    66  }
    67  
    68  // +checklocksignore
    69  func (e *connectionlessEndpoint) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    70  	stateSourceObject.Load(0, &e.baseEndpoint)
    71  	stateSourceObject.AfterLoad(func() { e.afterLoad(ctx) })
    72  }
    73  
    74  func (c *HostConnectedEndpoint) StateTypeName() string {
    75  	return "pkg/sentry/socket/unix/transport.HostConnectedEndpoint"
    76  }
    77  
    78  func (c *HostConnectedEndpoint) StateFields() []string {
    79  	return []string{
    80  		"HostConnectedEndpointRefs",
    81  		"fd",
    82  		"addr",
    83  		"stype",
    84  		"rdShutdown",
    85  		"wrShutdown",
    86  	}
    87  }
    88  
    89  func (c *HostConnectedEndpoint) beforeSave() {}
    90  
    91  // +checklocksignore
    92  func (c *HostConnectedEndpoint) StateSave(stateSinkObject state.Sink) {
    93  	c.beforeSave()
    94  	stateSinkObject.Save(0, &c.HostConnectedEndpointRefs)
    95  	stateSinkObject.Save(1, &c.fd)
    96  	stateSinkObject.Save(2, &c.addr)
    97  	stateSinkObject.Save(3, &c.stype)
    98  	stateSinkObject.Save(4, &c.rdShutdown)
    99  	stateSinkObject.Save(5, &c.wrShutdown)
   100  }
   101  
   102  // +checklocksignore
   103  func (c *HostConnectedEndpoint) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   104  	stateSourceObject.Load(0, &c.HostConnectedEndpointRefs)
   105  	stateSourceObject.Load(1, &c.fd)
   106  	stateSourceObject.Load(2, &c.addr)
   107  	stateSourceObject.Load(3, &c.stype)
   108  	stateSourceObject.Load(4, &c.rdShutdown)
   109  	stateSourceObject.Load(5, &c.wrShutdown)
   110  	stateSourceObject.AfterLoad(func() { c.afterLoad(ctx) })
   111  }
   112  
   113  func (r *HostConnectedEndpointRefs) StateTypeName() string {
   114  	return "pkg/sentry/socket/unix/transport.HostConnectedEndpointRefs"
   115  }
   116  
   117  func (r *HostConnectedEndpointRefs) StateFields() []string {
   118  	return []string{
   119  		"refCount",
   120  	}
   121  }
   122  
   123  func (r *HostConnectedEndpointRefs) beforeSave() {}
   124  
   125  // +checklocksignore
   126  func (r *HostConnectedEndpointRefs) StateSave(stateSinkObject state.Sink) {
   127  	r.beforeSave()
   128  	stateSinkObject.Save(0, &r.refCount)
   129  }
   130  
   131  // +checklocksignore
   132  func (r *HostConnectedEndpointRefs) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   133  	stateSourceObject.Load(0, &r.refCount)
   134  	stateSourceObject.AfterLoad(func() { r.afterLoad(ctx) })
   135  }
   136  
   137  func (q *queue) StateTypeName() string {
   138  	return "pkg/sentry/socket/unix/transport.queue"
   139  }
   140  
   141  func (q *queue) StateFields() []string {
   142  	return []string{
   143  		"queueRefs",
   144  		"ReaderQueue",
   145  		"WriterQueue",
   146  		"closed",
   147  		"unread",
   148  		"used",
   149  		"limit",
   150  		"dataList",
   151  	}
   152  }
   153  
   154  func (q *queue) beforeSave() {}
   155  
   156  // +checklocksignore
   157  func (q *queue) StateSave(stateSinkObject state.Sink) {
   158  	q.beforeSave()
   159  	stateSinkObject.Save(0, &q.queueRefs)
   160  	stateSinkObject.Save(1, &q.ReaderQueue)
   161  	stateSinkObject.Save(2, &q.WriterQueue)
   162  	stateSinkObject.Save(3, &q.closed)
   163  	stateSinkObject.Save(4, &q.unread)
   164  	stateSinkObject.Save(5, &q.used)
   165  	stateSinkObject.Save(6, &q.limit)
   166  	stateSinkObject.Save(7, &q.dataList)
   167  }
   168  
   169  func (q *queue) afterLoad(context.Context) {}
   170  
   171  // +checklocksignore
   172  func (q *queue) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   173  	stateSourceObject.Load(0, &q.queueRefs)
   174  	stateSourceObject.Load(1, &q.ReaderQueue)
   175  	stateSourceObject.Load(2, &q.WriterQueue)
   176  	stateSourceObject.Load(3, &q.closed)
   177  	stateSourceObject.Load(4, &q.unread)
   178  	stateSourceObject.Load(5, &q.used)
   179  	stateSourceObject.Load(6, &q.limit)
   180  	stateSourceObject.Load(7, &q.dataList)
   181  }
   182  
   183  func (r *queueRefs) StateTypeName() string {
   184  	return "pkg/sentry/socket/unix/transport.queueRefs"
   185  }
   186  
   187  func (r *queueRefs) StateFields() []string {
   188  	return []string{
   189  		"refCount",
   190  	}
   191  }
   192  
   193  func (r *queueRefs) beforeSave() {}
   194  
   195  // +checklocksignore
   196  func (r *queueRefs) StateSave(stateSinkObject state.Sink) {
   197  	r.beforeSave()
   198  	stateSinkObject.Save(0, &r.refCount)
   199  }
   200  
   201  // +checklocksignore
   202  func (r *queueRefs) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   203  	stateSourceObject.Load(0, &r.refCount)
   204  	stateSourceObject.AfterLoad(func() { r.afterLoad(ctx) })
   205  }
   206  
   207  func (l *messageList) StateTypeName() string {
   208  	return "pkg/sentry/socket/unix/transport.messageList"
   209  }
   210  
   211  func (l *messageList) StateFields() []string {
   212  	return []string{
   213  		"head",
   214  		"tail",
   215  	}
   216  }
   217  
   218  func (l *messageList) beforeSave() {}
   219  
   220  // +checklocksignore
   221  func (l *messageList) StateSave(stateSinkObject state.Sink) {
   222  	l.beforeSave()
   223  	stateSinkObject.Save(0, &l.head)
   224  	stateSinkObject.Save(1, &l.tail)
   225  }
   226  
   227  func (l *messageList) afterLoad(context.Context) {}
   228  
   229  // +checklocksignore
   230  func (l *messageList) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   231  	stateSourceObject.Load(0, &l.head)
   232  	stateSourceObject.Load(1, &l.tail)
   233  }
   234  
   235  func (e *messageEntry) StateTypeName() string {
   236  	return "pkg/sentry/socket/unix/transport.messageEntry"
   237  }
   238  
   239  func (e *messageEntry) StateFields() []string {
   240  	return []string{
   241  		"next",
   242  		"prev",
   243  	}
   244  }
   245  
   246  func (e *messageEntry) beforeSave() {}
   247  
   248  // +checklocksignore
   249  func (e *messageEntry) StateSave(stateSinkObject state.Sink) {
   250  	e.beforeSave()
   251  	stateSinkObject.Save(0, &e.next)
   252  	stateSinkObject.Save(1, &e.prev)
   253  }
   254  
   255  func (e *messageEntry) afterLoad(context.Context) {}
   256  
   257  // +checklocksignore
   258  func (e *messageEntry) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   259  	stateSourceObject.Load(0, &e.next)
   260  	stateSourceObject.Load(1, &e.prev)
   261  }
   262  
   263  func (c *ControlMessages) StateTypeName() string {
   264  	return "pkg/sentry/socket/unix/transport.ControlMessages"
   265  }
   266  
   267  func (c *ControlMessages) StateFields() []string {
   268  	return []string{
   269  		"Rights",
   270  		"Credentials",
   271  	}
   272  }
   273  
   274  func (c *ControlMessages) beforeSave() {}
   275  
   276  // +checklocksignore
   277  func (c *ControlMessages) StateSave(stateSinkObject state.Sink) {
   278  	c.beforeSave()
   279  	stateSinkObject.Save(0, &c.Rights)
   280  	stateSinkObject.Save(1, &c.Credentials)
   281  }
   282  
   283  func (c *ControlMessages) afterLoad(context.Context) {}
   284  
   285  // +checklocksignore
   286  func (c *ControlMessages) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   287  	stateSourceObject.Load(0, &c.Rights)
   288  	stateSourceObject.Load(1, &c.Credentials)
   289  }
   290  
   291  func (m *message) StateTypeName() string {
   292  	return "pkg/sentry/socket/unix/transport.message"
   293  }
   294  
   295  func (m *message) StateFields() []string {
   296  	return []string{
   297  		"messageEntry",
   298  		"Data",
   299  		"Control",
   300  		"Address",
   301  	}
   302  }
   303  
   304  func (m *message) beforeSave() {}
   305  
   306  // +checklocksignore
   307  func (m *message) StateSave(stateSinkObject state.Sink) {
   308  	m.beforeSave()
   309  	stateSinkObject.Save(0, &m.messageEntry)
   310  	stateSinkObject.Save(1, &m.Data)
   311  	stateSinkObject.Save(2, &m.Control)
   312  	stateSinkObject.Save(3, &m.Address)
   313  }
   314  
   315  func (m *message) afterLoad(context.Context) {}
   316  
   317  // +checklocksignore
   318  func (m *message) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   319  	stateSourceObject.Load(0, &m.messageEntry)
   320  	stateSourceObject.Load(1, &m.Data)
   321  	stateSourceObject.Load(2, &m.Control)
   322  	stateSourceObject.Load(3, &m.Address)
   323  }
   324  
   325  func (a *Address) StateTypeName() string {
   326  	return "pkg/sentry/socket/unix/transport.Address"
   327  }
   328  
   329  func (a *Address) StateFields() []string {
   330  	return []string{
   331  		"Addr",
   332  	}
   333  }
   334  
   335  func (a *Address) beforeSave() {}
   336  
   337  // +checklocksignore
   338  func (a *Address) StateSave(stateSinkObject state.Sink) {
   339  	a.beforeSave()
   340  	stateSinkObject.Save(0, &a.Addr)
   341  }
   342  
   343  func (a *Address) afterLoad(context.Context) {}
   344  
   345  // +checklocksignore
   346  func (a *Address) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   347  	stateSourceObject.Load(0, &a.Addr)
   348  }
   349  
   350  func (q *queueReceiver) StateTypeName() string {
   351  	return "pkg/sentry/socket/unix/transport.queueReceiver"
   352  }
   353  
   354  func (q *queueReceiver) StateFields() []string {
   355  	return []string{
   356  		"readQueue",
   357  	}
   358  }
   359  
   360  func (q *queueReceiver) beforeSave() {}
   361  
   362  // +checklocksignore
   363  func (q *queueReceiver) StateSave(stateSinkObject state.Sink) {
   364  	q.beforeSave()
   365  	stateSinkObject.Save(0, &q.readQueue)
   366  }
   367  
   368  func (q *queueReceiver) afterLoad(context.Context) {}
   369  
   370  // +checklocksignore
   371  func (q *queueReceiver) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   372  	stateSourceObject.Load(0, &q.readQueue)
   373  }
   374  
   375  func (q *streamQueueReceiver) StateTypeName() string {
   376  	return "pkg/sentry/socket/unix/transport.streamQueueReceiver"
   377  }
   378  
   379  func (q *streamQueueReceiver) StateFields() []string {
   380  	return []string{
   381  		"queueReceiver",
   382  		"buffer",
   383  		"control",
   384  		"addr",
   385  	}
   386  }
   387  
   388  func (q *streamQueueReceiver) beforeSave() {}
   389  
   390  // +checklocksignore
   391  func (q *streamQueueReceiver) StateSave(stateSinkObject state.Sink) {
   392  	q.beforeSave()
   393  	stateSinkObject.Save(0, &q.queueReceiver)
   394  	stateSinkObject.Save(1, &q.buffer)
   395  	stateSinkObject.Save(2, &q.control)
   396  	stateSinkObject.Save(3, &q.addr)
   397  }
   398  
   399  func (q *streamQueueReceiver) afterLoad(context.Context) {}
   400  
   401  // +checklocksignore
   402  func (q *streamQueueReceiver) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   403  	stateSourceObject.Load(0, &q.queueReceiver)
   404  	stateSourceObject.Load(1, &q.buffer)
   405  	stateSourceObject.Load(2, &q.control)
   406  	stateSourceObject.Load(3, &q.addr)
   407  }
   408  
   409  func (e *connectedEndpoint) StateTypeName() string {
   410  	return "pkg/sentry/socket/unix/transport.connectedEndpoint"
   411  }
   412  
   413  func (e *connectedEndpoint) StateFields() []string {
   414  	return []string{
   415  		"endpoint",
   416  		"writeQueue",
   417  	}
   418  }
   419  
   420  func (e *connectedEndpoint) beforeSave() {}
   421  
   422  // +checklocksignore
   423  func (e *connectedEndpoint) StateSave(stateSinkObject state.Sink) {
   424  	e.beforeSave()
   425  	stateSinkObject.Save(0, &e.endpoint)
   426  	stateSinkObject.Save(1, &e.writeQueue)
   427  }
   428  
   429  func (e *connectedEndpoint) afterLoad(context.Context) {}
   430  
   431  // +checklocksignore
   432  func (e *connectedEndpoint) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   433  	stateSourceObject.Load(0, &e.endpoint)
   434  	stateSourceObject.Load(1, &e.writeQueue)
   435  }
   436  
   437  func (e *baseEndpoint) StateTypeName() string {
   438  	return "pkg/sentry/socket/unix/transport.baseEndpoint"
   439  }
   440  
   441  func (e *baseEndpoint) StateFields() []string {
   442  	return []string{
   443  		"Queue",
   444  		"DefaultSocketOptionsHandler",
   445  		"receiver",
   446  		"connected",
   447  		"path",
   448  		"ops",
   449  	}
   450  }
   451  
   452  func (e *baseEndpoint) beforeSave() {}
   453  
   454  // +checklocksignore
   455  func (e *baseEndpoint) StateSave(stateSinkObject state.Sink) {
   456  	e.beforeSave()
   457  	stateSinkObject.Save(0, &e.Queue)
   458  	stateSinkObject.Save(1, &e.DefaultSocketOptionsHandler)
   459  	stateSinkObject.Save(2, &e.receiver)
   460  	stateSinkObject.Save(3, &e.connected)
   461  	stateSinkObject.Save(4, &e.path)
   462  	stateSinkObject.Save(5, &e.ops)
   463  }
   464  
   465  func (e *baseEndpoint) afterLoad(context.Context) {}
   466  
   467  // +checklocksignore
   468  func (e *baseEndpoint) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   469  	stateSourceObject.Load(0, &e.Queue)
   470  	stateSourceObject.Load(1, &e.DefaultSocketOptionsHandler)
   471  	stateSourceObject.Load(2, &e.receiver)
   472  	stateSourceObject.Load(3, &e.connected)
   473  	stateSourceObject.Load(4, &e.path)
   474  	stateSourceObject.Load(5, &e.ops)
   475  }
   476  
   477  func init() {
   478  	state.Register((*connectionedEndpoint)(nil))
   479  	state.Register((*connectionlessEndpoint)(nil))
   480  	state.Register((*HostConnectedEndpoint)(nil))
   481  	state.Register((*HostConnectedEndpointRefs)(nil))
   482  	state.Register((*queue)(nil))
   483  	state.Register((*queueRefs)(nil))
   484  	state.Register((*messageList)(nil))
   485  	state.Register((*messageEntry)(nil))
   486  	state.Register((*ControlMessages)(nil))
   487  	state.Register((*message)(nil))
   488  	state.Register((*Address)(nil))
   489  	state.Register((*queueReceiver)(nil))
   490  	state.Register((*streamQueueReceiver)(nil))
   491  	state.Register((*connectedEndpoint)(nil))
   492  	state.Register((*baseEndpoint)(nil))
   493  }