github.com/MerlinKodo/gvisor@v0.0.0-20231110090155-957f62ecf90e/pkg/buffer/buffer_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  package buffer
     4  
     5  import (
     6  	"github.com/MerlinKodo/gvisor/pkg/state"
     7  )
     8  
     9  func (b *Buffer) StateTypeName() string {
    10  	return "pkg/buffer.Buffer"
    11  }
    12  
    13  func (b *Buffer) StateFields() []string {
    14  	return []string{
    15  		"data",
    16  		"size",
    17  	}
    18  }
    19  
    20  func (b *Buffer) beforeSave() {}
    21  
    22  // +checklocksignore
    23  func (b *Buffer) StateSave(stateSinkObject state.Sink) {
    24  	b.beforeSave()
    25  	var dataValue []byte
    26  	dataValue = b.saveData()
    27  	stateSinkObject.SaveValue(0, dataValue)
    28  	stateSinkObject.Save(1, &b.size)
    29  }
    30  
    31  func (b *Buffer) afterLoad() {}
    32  
    33  // +checklocksignore
    34  func (b *Buffer) StateLoad(stateSourceObject state.Source) {
    35  	stateSourceObject.Load(1, &b.size)
    36  	stateSourceObject.LoadValue(0, new([]byte), func(y any) { b.loadData(y.([]byte)) })
    37  }
    38  
    39  func (c *chunk) StateTypeName() string {
    40  	return "pkg/buffer.chunk"
    41  }
    42  
    43  func (c *chunk) StateFields() []string {
    44  	return []string{
    45  		"chunkRefs",
    46  		"data",
    47  	}
    48  }
    49  
    50  func (c *chunk) beforeSave() {}
    51  
    52  // +checklocksignore
    53  func (c *chunk) StateSave(stateSinkObject state.Sink) {
    54  	c.beforeSave()
    55  	stateSinkObject.Save(0, &c.chunkRefs)
    56  	stateSinkObject.Save(1, &c.data)
    57  }
    58  
    59  func (c *chunk) afterLoad() {}
    60  
    61  // +checklocksignore
    62  func (c *chunk) StateLoad(stateSourceObject state.Source) {
    63  	stateSourceObject.Load(0, &c.chunkRefs)
    64  	stateSourceObject.Load(1, &c.data)
    65  }
    66  
    67  func (r *chunkRefs) StateTypeName() string {
    68  	return "pkg/buffer.chunkRefs"
    69  }
    70  
    71  func (r *chunkRefs) StateFields() []string {
    72  	return []string{
    73  		"refCount",
    74  	}
    75  }
    76  
    77  func (r *chunkRefs) beforeSave() {}
    78  
    79  // +checklocksignore
    80  func (r *chunkRefs) StateSave(stateSinkObject state.Sink) {
    81  	r.beforeSave()
    82  	stateSinkObject.Save(0, &r.refCount)
    83  }
    84  
    85  // +checklocksignore
    86  func (r *chunkRefs) StateLoad(stateSourceObject state.Source) {
    87  	stateSourceObject.Load(0, &r.refCount)
    88  	stateSourceObject.AfterLoad(r.afterLoad)
    89  }
    90  
    91  func (v *View) StateTypeName() string {
    92  	return "pkg/buffer.View"
    93  }
    94  
    95  func (v *View) StateFields() []string {
    96  	return []string{
    97  		"read",
    98  		"write",
    99  		"chunk",
   100  	}
   101  }
   102  
   103  func (v *View) beforeSave() {}
   104  
   105  // +checklocksignore
   106  func (v *View) StateSave(stateSinkObject state.Sink) {
   107  	v.beforeSave()
   108  	stateSinkObject.Save(0, &v.read)
   109  	stateSinkObject.Save(1, &v.write)
   110  	stateSinkObject.Save(2, &v.chunk)
   111  }
   112  
   113  func (v *View) afterLoad() {}
   114  
   115  // +checklocksignore
   116  func (v *View) StateLoad(stateSourceObject state.Source) {
   117  	stateSourceObject.Load(0, &v.read)
   118  	stateSourceObject.Load(1, &v.write)
   119  	stateSourceObject.Load(2, &v.chunk)
   120  }
   121  
   122  func (l *viewList) StateTypeName() string {
   123  	return "pkg/buffer.viewList"
   124  }
   125  
   126  func (l *viewList) StateFields() []string {
   127  	return []string{
   128  		"head",
   129  		"tail",
   130  	}
   131  }
   132  
   133  func (l *viewList) beforeSave() {}
   134  
   135  // +checklocksignore
   136  func (l *viewList) StateSave(stateSinkObject state.Sink) {
   137  	l.beforeSave()
   138  	stateSinkObject.Save(0, &l.head)
   139  	stateSinkObject.Save(1, &l.tail)
   140  }
   141  
   142  func (l *viewList) afterLoad() {}
   143  
   144  // +checklocksignore
   145  func (l *viewList) StateLoad(stateSourceObject state.Source) {
   146  	stateSourceObject.Load(0, &l.head)
   147  	stateSourceObject.Load(1, &l.tail)
   148  }
   149  
   150  func (e *viewEntry) StateTypeName() string {
   151  	return "pkg/buffer.viewEntry"
   152  }
   153  
   154  func (e *viewEntry) StateFields() []string {
   155  	return []string{
   156  		"next",
   157  		"prev",
   158  	}
   159  }
   160  
   161  func (e *viewEntry) beforeSave() {}
   162  
   163  // +checklocksignore
   164  func (e *viewEntry) StateSave(stateSinkObject state.Sink) {
   165  	e.beforeSave()
   166  	stateSinkObject.Save(0, &e.next)
   167  	stateSinkObject.Save(1, &e.prev)
   168  }
   169  
   170  func (e *viewEntry) afterLoad() {}
   171  
   172  // +checklocksignore
   173  func (e *viewEntry) StateLoad(stateSourceObject state.Source) {
   174  	stateSourceObject.Load(0, &e.next)
   175  	stateSourceObject.Load(1, &e.prev)
   176  }
   177  
   178  func init() {
   179  	state.Register((*Buffer)(nil))
   180  	state.Register((*chunk)(nil))
   181  	state.Register((*chunkRefs)(nil))
   182  	state.Register((*View)(nil))
   183  	state.Register((*viewList)(nil))
   184  	state.Register((*viewEntry)(nil))
   185  }