github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/devices/accel/accel_state_autogen.go (about)

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