github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/kernel/mq/mq_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  package mq
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/metacubex/gvisor/pkg/state"
     9  )
    10  
    11  func (l *msgList) StateTypeName() string {
    12  	return "pkg/sentry/kernel/mq.msgList"
    13  }
    14  
    15  func (l *msgList) StateFields() []string {
    16  	return []string{
    17  		"head",
    18  		"tail",
    19  	}
    20  }
    21  
    22  func (l *msgList) beforeSave() {}
    23  
    24  // +checklocksignore
    25  func (l *msgList) StateSave(stateSinkObject state.Sink) {
    26  	l.beforeSave()
    27  	stateSinkObject.Save(0, &l.head)
    28  	stateSinkObject.Save(1, &l.tail)
    29  }
    30  
    31  func (l *msgList) afterLoad(context.Context) {}
    32  
    33  // +checklocksignore
    34  func (l *msgList) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    35  	stateSourceObject.Load(0, &l.head)
    36  	stateSourceObject.Load(1, &l.tail)
    37  }
    38  
    39  func (e *msgEntry) StateTypeName() string {
    40  	return "pkg/sentry/kernel/mq.msgEntry"
    41  }
    42  
    43  func (e *msgEntry) StateFields() []string {
    44  	return []string{
    45  		"next",
    46  		"prev",
    47  	}
    48  }
    49  
    50  func (e *msgEntry) beforeSave() {}
    51  
    52  // +checklocksignore
    53  func (e *msgEntry) StateSave(stateSinkObject state.Sink) {
    54  	e.beforeSave()
    55  	stateSinkObject.Save(0, &e.next)
    56  	stateSinkObject.Save(1, &e.prev)
    57  }
    58  
    59  func (e *msgEntry) afterLoad(context.Context) {}
    60  
    61  // +checklocksignore
    62  func (e *msgEntry) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    63  	stateSourceObject.Load(0, &e.next)
    64  	stateSourceObject.Load(1, &e.prev)
    65  }
    66  
    67  func (r *Registry) StateTypeName() string {
    68  	return "pkg/sentry/kernel/mq.Registry"
    69  }
    70  
    71  func (r *Registry) StateFields() []string {
    72  	return []string{
    73  		"userNS",
    74  		"impl",
    75  	}
    76  }
    77  
    78  func (r *Registry) beforeSave() {}
    79  
    80  // +checklocksignore
    81  func (r *Registry) StateSave(stateSinkObject state.Sink) {
    82  	r.beforeSave()
    83  	stateSinkObject.Save(0, &r.userNS)
    84  	stateSinkObject.Save(1, &r.impl)
    85  }
    86  
    87  func (r *Registry) afterLoad(context.Context) {}
    88  
    89  // +checklocksignore
    90  func (r *Registry) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    91  	stateSourceObject.Load(0, &r.userNS)
    92  	stateSourceObject.Load(1, &r.impl)
    93  }
    94  
    95  func (q *Queue) StateTypeName() string {
    96  	return "pkg/sentry/kernel/mq.Queue"
    97  }
    98  
    99  func (q *Queue) StateFields() []string {
   100  	return []string{
   101  		"ownerUID",
   102  		"ownerGID",
   103  		"mode",
   104  		"queue",
   105  		"messages",
   106  		"subscriber",
   107  		"messageCount",
   108  		"maxMessageCount",
   109  		"maxMessageSize",
   110  		"byteCount",
   111  	}
   112  }
   113  
   114  func (q *Queue) beforeSave() {}
   115  
   116  // +checklocksignore
   117  func (q *Queue) StateSave(stateSinkObject state.Sink) {
   118  	q.beforeSave()
   119  	stateSinkObject.Save(0, &q.ownerUID)
   120  	stateSinkObject.Save(1, &q.ownerGID)
   121  	stateSinkObject.Save(2, &q.mode)
   122  	stateSinkObject.Save(3, &q.queue)
   123  	stateSinkObject.Save(4, &q.messages)
   124  	stateSinkObject.Save(5, &q.subscriber)
   125  	stateSinkObject.Save(6, &q.messageCount)
   126  	stateSinkObject.Save(7, &q.maxMessageCount)
   127  	stateSinkObject.Save(8, &q.maxMessageSize)
   128  	stateSinkObject.Save(9, &q.byteCount)
   129  }
   130  
   131  func (q *Queue) afterLoad(context.Context) {}
   132  
   133  // +checklocksignore
   134  func (q *Queue) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   135  	stateSourceObject.Load(0, &q.ownerUID)
   136  	stateSourceObject.Load(1, &q.ownerGID)
   137  	stateSourceObject.Load(2, &q.mode)
   138  	stateSourceObject.Load(3, &q.queue)
   139  	stateSourceObject.Load(4, &q.messages)
   140  	stateSourceObject.Load(5, &q.subscriber)
   141  	stateSourceObject.Load(6, &q.messageCount)
   142  	stateSourceObject.Load(7, &q.maxMessageCount)
   143  	stateSourceObject.Load(8, &q.maxMessageSize)
   144  	stateSourceObject.Load(9, &q.byteCount)
   145  }
   146  
   147  func (r *ReaderWriter) StateTypeName() string {
   148  	return "pkg/sentry/kernel/mq.ReaderWriter"
   149  }
   150  
   151  func (r *ReaderWriter) StateFields() []string {
   152  	return []string{
   153  		"Queue",
   154  		"block",
   155  	}
   156  }
   157  
   158  func (r *ReaderWriter) beforeSave() {}
   159  
   160  // +checklocksignore
   161  func (r *ReaderWriter) StateSave(stateSinkObject state.Sink) {
   162  	r.beforeSave()
   163  	stateSinkObject.Save(0, &r.Queue)
   164  	stateSinkObject.Save(1, &r.block)
   165  }
   166  
   167  func (r *ReaderWriter) afterLoad(context.Context) {}
   168  
   169  // +checklocksignore
   170  func (r *ReaderWriter) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   171  	stateSourceObject.Load(0, &r.Queue)
   172  	stateSourceObject.Load(1, &r.block)
   173  }
   174  
   175  func (r *Reader) StateTypeName() string {
   176  	return "pkg/sentry/kernel/mq.Reader"
   177  }
   178  
   179  func (r *Reader) StateFields() []string {
   180  	return []string{
   181  		"Queue",
   182  		"block",
   183  	}
   184  }
   185  
   186  func (r *Reader) beforeSave() {}
   187  
   188  // +checklocksignore
   189  func (r *Reader) StateSave(stateSinkObject state.Sink) {
   190  	r.beforeSave()
   191  	stateSinkObject.Save(0, &r.Queue)
   192  	stateSinkObject.Save(1, &r.block)
   193  }
   194  
   195  func (r *Reader) afterLoad(context.Context) {}
   196  
   197  // +checklocksignore
   198  func (r *Reader) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   199  	stateSourceObject.Load(0, &r.Queue)
   200  	stateSourceObject.Load(1, &r.block)
   201  }
   202  
   203  func (w *Writer) StateTypeName() string {
   204  	return "pkg/sentry/kernel/mq.Writer"
   205  }
   206  
   207  func (w *Writer) StateFields() []string {
   208  	return []string{
   209  		"Queue",
   210  		"block",
   211  	}
   212  }
   213  
   214  func (w *Writer) beforeSave() {}
   215  
   216  // +checklocksignore
   217  func (w *Writer) StateSave(stateSinkObject state.Sink) {
   218  	w.beforeSave()
   219  	stateSinkObject.Save(0, &w.Queue)
   220  	stateSinkObject.Save(1, &w.block)
   221  }
   222  
   223  func (w *Writer) afterLoad(context.Context) {}
   224  
   225  // +checklocksignore
   226  func (w *Writer) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   227  	stateSourceObject.Load(0, &w.Queue)
   228  	stateSourceObject.Load(1, &w.block)
   229  }
   230  
   231  func (m *Message) StateTypeName() string {
   232  	return "pkg/sentry/kernel/mq.Message"
   233  }
   234  
   235  func (m *Message) StateFields() []string {
   236  	return []string{
   237  		"msgEntry",
   238  		"Text",
   239  		"Size",
   240  		"Priority",
   241  	}
   242  }
   243  
   244  func (m *Message) beforeSave() {}
   245  
   246  // +checklocksignore
   247  func (m *Message) StateSave(stateSinkObject state.Sink) {
   248  	m.beforeSave()
   249  	stateSinkObject.Save(0, &m.msgEntry)
   250  	stateSinkObject.Save(1, &m.Text)
   251  	stateSinkObject.Save(2, &m.Size)
   252  	stateSinkObject.Save(3, &m.Priority)
   253  }
   254  
   255  func (m *Message) afterLoad(context.Context) {}
   256  
   257  // +checklocksignore
   258  func (m *Message) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   259  	stateSourceObject.Load(0, &m.msgEntry)
   260  	stateSourceObject.Load(1, &m.Text)
   261  	stateSourceObject.Load(2, &m.Size)
   262  	stateSourceObject.Load(3, &m.Priority)
   263  }
   264  
   265  func (s *Subscriber) StateTypeName() string {
   266  	return "pkg/sentry/kernel/mq.Subscriber"
   267  }
   268  
   269  func (s *Subscriber) StateFields() []string {
   270  	return []string{
   271  		"pid",
   272  	}
   273  }
   274  
   275  func (s *Subscriber) beforeSave() {}
   276  
   277  // +checklocksignore
   278  func (s *Subscriber) StateSave(stateSinkObject state.Sink) {
   279  	s.beforeSave()
   280  	stateSinkObject.Save(0, &s.pid)
   281  }
   282  
   283  func (s *Subscriber) afterLoad(context.Context) {}
   284  
   285  // +checklocksignore
   286  func (s *Subscriber) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   287  	stateSourceObject.Load(0, &s.pid)
   288  }
   289  
   290  func init() {
   291  	state.Register((*msgList)(nil))
   292  	state.Register((*msgEntry)(nil))
   293  	state.Register((*Registry)(nil))
   294  	state.Register((*Queue)(nil))
   295  	state.Register((*ReaderWriter)(nil))
   296  	state.Register((*Reader)(nil))
   297  	state.Register((*Writer)(nil))
   298  	state.Register((*Message)(nil))
   299  	state.Register((*Subscriber)(nil))
   300  }