github.com/MerlinKodo/gvisor@v0.0.0-20231110090155-957f62ecf90e/pkg/sentry/kernel/shm/shm_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  package shm
     4  
     5  import (
     6  	"github.com/MerlinKodo/gvisor/pkg/state"
     7  )
     8  
     9  func (r *Registry) StateTypeName() string {
    10  	return "pkg/sentry/kernel/shm.Registry"
    11  }
    12  
    13  func (r *Registry) StateFields() []string {
    14  	return []string{
    15  		"userNS",
    16  		"reg",
    17  		"totalPages",
    18  	}
    19  }
    20  
    21  func (r *Registry) beforeSave() {}
    22  
    23  // +checklocksignore
    24  func (r *Registry) StateSave(stateSinkObject state.Sink) {
    25  	r.beforeSave()
    26  	stateSinkObject.Save(0, &r.userNS)
    27  	stateSinkObject.Save(1, &r.reg)
    28  	stateSinkObject.Save(2, &r.totalPages)
    29  }
    30  
    31  func (r *Registry) afterLoad() {}
    32  
    33  // +checklocksignore
    34  func (r *Registry) StateLoad(stateSourceObject state.Source) {
    35  	stateSourceObject.Load(0, &r.userNS)
    36  	stateSourceObject.Load(1, &r.reg)
    37  	stateSourceObject.Load(2, &r.totalPages)
    38  }
    39  
    40  func (s *Shm) StateTypeName() string {
    41  	return "pkg/sentry/kernel/shm.Shm"
    42  }
    43  
    44  func (s *Shm) StateFields() []string {
    45  	return []string{
    46  		"ShmRefs",
    47  		"mfp",
    48  		"registry",
    49  		"devID",
    50  		"size",
    51  		"effectiveSize",
    52  		"fr",
    53  		"obj",
    54  		"attachTime",
    55  		"detachTime",
    56  		"changeTime",
    57  		"creatorPID",
    58  		"lastAttachDetachPID",
    59  		"pendingDestruction",
    60  	}
    61  }
    62  
    63  func (s *Shm) beforeSave() {}
    64  
    65  // +checklocksignore
    66  func (s *Shm) StateSave(stateSinkObject state.Sink) {
    67  	s.beforeSave()
    68  	stateSinkObject.Save(0, &s.ShmRefs)
    69  	stateSinkObject.Save(1, &s.mfp)
    70  	stateSinkObject.Save(2, &s.registry)
    71  	stateSinkObject.Save(3, &s.devID)
    72  	stateSinkObject.Save(4, &s.size)
    73  	stateSinkObject.Save(5, &s.effectiveSize)
    74  	stateSinkObject.Save(6, &s.fr)
    75  	stateSinkObject.Save(7, &s.obj)
    76  	stateSinkObject.Save(8, &s.attachTime)
    77  	stateSinkObject.Save(9, &s.detachTime)
    78  	stateSinkObject.Save(10, &s.changeTime)
    79  	stateSinkObject.Save(11, &s.creatorPID)
    80  	stateSinkObject.Save(12, &s.lastAttachDetachPID)
    81  	stateSinkObject.Save(13, &s.pendingDestruction)
    82  }
    83  
    84  func (s *Shm) afterLoad() {}
    85  
    86  // +checklocksignore
    87  func (s *Shm) StateLoad(stateSourceObject state.Source) {
    88  	stateSourceObject.Load(0, &s.ShmRefs)
    89  	stateSourceObject.Load(1, &s.mfp)
    90  	stateSourceObject.Load(2, &s.registry)
    91  	stateSourceObject.Load(3, &s.devID)
    92  	stateSourceObject.Load(4, &s.size)
    93  	stateSourceObject.Load(5, &s.effectiveSize)
    94  	stateSourceObject.Load(6, &s.fr)
    95  	stateSourceObject.Load(7, &s.obj)
    96  	stateSourceObject.Load(8, &s.attachTime)
    97  	stateSourceObject.Load(9, &s.detachTime)
    98  	stateSourceObject.Load(10, &s.changeTime)
    99  	stateSourceObject.Load(11, &s.creatorPID)
   100  	stateSourceObject.Load(12, &s.lastAttachDetachPID)
   101  	stateSourceObject.Load(13, &s.pendingDestruction)
   102  }
   103  
   104  func (r *ShmRefs) StateTypeName() string {
   105  	return "pkg/sentry/kernel/shm.ShmRefs"
   106  }
   107  
   108  func (r *ShmRefs) StateFields() []string {
   109  	return []string{
   110  		"refCount",
   111  	}
   112  }
   113  
   114  func (r *ShmRefs) beforeSave() {}
   115  
   116  // +checklocksignore
   117  func (r *ShmRefs) StateSave(stateSinkObject state.Sink) {
   118  	r.beforeSave()
   119  	stateSinkObject.Save(0, &r.refCount)
   120  }
   121  
   122  // +checklocksignore
   123  func (r *ShmRefs) StateLoad(stateSourceObject state.Source) {
   124  	stateSourceObject.Load(0, &r.refCount)
   125  	stateSourceObject.AfterLoad(r.afterLoad)
   126  }
   127  
   128  func init() {
   129  	state.Register((*Registry)(nil))
   130  	state.Register((*Shm)(nil))
   131  	state.Register((*ShmRefs)(nil))
   132  }