github.com/MerlinKodo/gvisor@v0.0.0-20231110090155-957f62ecf90e/pkg/sentry/devices/accel/accel_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  package accel
     4  
     5  import (
     6  	"github.com/MerlinKodo/gvisor/pkg/state"
     7  )
     8  
     9  func (r *DevAddrRange) StateTypeName() string {
    10  	return "pkg/sentry/devices/accel.DevAddrRange"
    11  }
    12  
    13  func (r *DevAddrRange) StateFields() []string {
    14  	return []string{
    15  		"Start",
    16  		"End",
    17  	}
    18  }
    19  
    20  func (r *DevAddrRange) beforeSave() {}
    21  
    22  // +checklocksignore
    23  func (r *DevAddrRange) StateSave(stateSinkObject state.Sink) {
    24  	r.beforeSave()
    25  	stateSinkObject.Save(0, &r.Start)
    26  	stateSinkObject.Save(1, &r.End)
    27  }
    28  
    29  func (r *DevAddrRange) afterLoad() {}
    30  
    31  // +checklocksignore
    32  func (r *DevAddrRange) StateLoad(stateSourceObject state.Source) {
    33  	stateSourceObject.Load(0, &r.Start)
    34  	stateSourceObject.Load(1, &r.End)
    35  }
    36  
    37  func (s *DevAddrSet) StateTypeName() string {
    38  	return "pkg/sentry/devices/accel.DevAddrSet"
    39  }
    40  
    41  func (s *DevAddrSet) StateFields() []string {
    42  	return []string{
    43  		"root",
    44  	}
    45  }
    46  
    47  func (s *DevAddrSet) beforeSave() {}
    48  
    49  // +checklocksignore
    50  func (s *DevAddrSet) StateSave(stateSinkObject state.Sink) {
    51  	s.beforeSave()
    52  	var rootValue *DevAddrSegmentDataSlices
    53  	rootValue = s.saveRoot()
    54  	stateSinkObject.SaveValue(0, rootValue)
    55  }
    56  
    57  func (s *DevAddrSet) afterLoad() {}
    58  
    59  // +checklocksignore
    60  func (s *DevAddrSet) StateLoad(stateSourceObject state.Source) {
    61  	stateSourceObject.LoadValue(0, new(*DevAddrSegmentDataSlices), func(y any) { s.loadRoot(y.(*DevAddrSegmentDataSlices)) })
    62  }
    63  
    64  func (n *DevAddrnode) StateTypeName() string {
    65  	return "pkg/sentry/devices/accel.DevAddrnode"
    66  }
    67  
    68  func (n *DevAddrnode) StateFields() []string {
    69  	return []string{
    70  		"nrSegments",
    71  		"parent",
    72  		"parentIndex",
    73  		"hasChildren",
    74  		"maxGap",
    75  		"keys",
    76  		"values",
    77  		"children",
    78  	}
    79  }
    80  
    81  func (n *DevAddrnode) beforeSave() {}
    82  
    83  // +checklocksignore
    84  func (n *DevAddrnode) StateSave(stateSinkObject state.Sink) {
    85  	n.beforeSave()
    86  	stateSinkObject.Save(0, &n.nrSegments)
    87  	stateSinkObject.Save(1, &n.parent)
    88  	stateSinkObject.Save(2, &n.parentIndex)
    89  	stateSinkObject.Save(3, &n.hasChildren)
    90  	stateSinkObject.Save(4, &n.maxGap)
    91  	stateSinkObject.Save(5, &n.keys)
    92  	stateSinkObject.Save(6, &n.values)
    93  	stateSinkObject.Save(7, &n.children)
    94  }
    95  
    96  func (n *DevAddrnode) afterLoad() {}
    97  
    98  // +checklocksignore
    99  func (n *DevAddrnode) StateLoad(stateSourceObject state.Source) {
   100  	stateSourceObject.Load(0, &n.nrSegments)
   101  	stateSourceObject.Load(1, &n.parent)
   102  	stateSourceObject.Load(2, &n.parentIndex)
   103  	stateSourceObject.Load(3, &n.hasChildren)
   104  	stateSourceObject.Load(4, &n.maxGap)
   105  	stateSourceObject.Load(5, &n.keys)
   106  	stateSourceObject.Load(6, &n.values)
   107  	stateSourceObject.Load(7, &n.children)
   108  }
   109  
   110  func (d *DevAddrSegmentDataSlices) StateTypeName() string {
   111  	return "pkg/sentry/devices/accel.DevAddrSegmentDataSlices"
   112  }
   113  
   114  func (d *DevAddrSegmentDataSlices) StateFields() []string {
   115  	return []string{
   116  		"Start",
   117  		"End",
   118  		"Values",
   119  	}
   120  }
   121  
   122  func (d *DevAddrSegmentDataSlices) beforeSave() {}
   123  
   124  // +checklocksignore
   125  func (d *DevAddrSegmentDataSlices) StateSave(stateSinkObject state.Sink) {
   126  	d.beforeSave()
   127  	stateSinkObject.Save(0, &d.Start)
   128  	stateSinkObject.Save(1, &d.End)
   129  	stateSinkObject.Save(2, &d.Values)
   130  }
   131  
   132  func (d *DevAddrSegmentDataSlices) afterLoad() {}
   133  
   134  // +checklocksignore
   135  func (d *DevAddrSegmentDataSlices) StateLoad(stateSourceObject state.Source) {
   136  	stateSourceObject.Load(0, &d.Start)
   137  	stateSourceObject.Load(1, &d.End)
   138  	stateSourceObject.Load(2, &d.Values)
   139  }
   140  
   141  func (dev *accelDevice) StateTypeName() string {
   142  	return "pkg/sentry/devices/accel.accelDevice"
   143  }
   144  
   145  func (dev *accelDevice) StateFields() []string {
   146  	return []string{
   147  		"mu",
   148  		"minor",
   149  		"openWriteFDs",
   150  		"devAddrSet",
   151  	}
   152  }
   153  
   154  func (dev *accelDevice) beforeSave() {}
   155  
   156  // +checklocksignore
   157  func (dev *accelDevice) StateSave(stateSinkObject state.Sink) {
   158  	dev.beforeSave()
   159  	stateSinkObject.Save(0, &dev.mu)
   160  	stateSinkObject.Save(1, &dev.minor)
   161  	stateSinkObject.Save(2, &dev.openWriteFDs)
   162  	stateSinkObject.Save(3, &dev.devAddrSet)
   163  }
   164  
   165  func (dev *accelDevice) afterLoad() {}
   166  
   167  // +checklocksignore
   168  func (dev *accelDevice) StateLoad(stateSourceObject state.Source) {
   169  	stateSourceObject.Load(0, &dev.mu)
   170  	stateSourceObject.Load(1, &dev.minor)
   171  	stateSourceObject.Load(2, &dev.openWriteFDs)
   172  	stateSourceObject.Load(3, &dev.devAddrSet)
   173  }
   174  
   175  func init() {
   176  	state.Register((*DevAddrRange)(nil))
   177  	state.Register((*DevAddrSet)(nil))
   178  	state.Register((*DevAddrnode)(nil))
   179  	state.Register((*DevAddrSegmentDataSlices)(nil))
   180  	state.Register((*accelDevice)(nil))
   181  }