github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/sentry/platform/systrap/systrap_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  //go:build systrap_profiling && !systrap_profiling
     4  // +build systrap_profiling,!systrap_profiling
     5  
     6  package systrap
     7  
     8  import (
     9  	"context"
    10  
    11  	"github.com/metacubex/gvisor/pkg/state"
    12  )
    13  
    14  func (l *contextList) StateTypeName() string {
    15  	return "pkg/sentry/platform/systrap.contextList"
    16  }
    17  
    18  func (l *contextList) StateFields() []string {
    19  	return []string{
    20  		"head",
    21  		"tail",
    22  	}
    23  }
    24  
    25  func (l *contextList) beforeSave() {}
    26  
    27  // +checklocksignore
    28  func (l *contextList) StateSave(stateSinkObject state.Sink) {
    29  	l.beforeSave()
    30  	stateSinkObject.Save(0, &l.head)
    31  	stateSinkObject.Save(1, &l.tail)
    32  }
    33  
    34  func (l *contextList) afterLoad(context.Context) {}
    35  
    36  // +checklocksignore
    37  func (l *contextList) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    38  	stateSourceObject.Load(0, &l.head)
    39  	stateSourceObject.Load(1, &l.tail)
    40  }
    41  
    42  func (e *contextEntry) StateTypeName() string {
    43  	return "pkg/sentry/platform/systrap.contextEntry"
    44  }
    45  
    46  func (e *contextEntry) StateFields() []string {
    47  	return []string{
    48  		"next",
    49  		"prev",
    50  	}
    51  }
    52  
    53  func (e *contextEntry) beforeSave() {}
    54  
    55  // +checklocksignore
    56  func (e *contextEntry) StateSave(stateSinkObject state.Sink) {
    57  	e.beforeSave()
    58  	stateSinkObject.Save(0, &e.next)
    59  	stateSinkObject.Save(1, &e.prev)
    60  }
    61  
    62  func (e *contextEntry) afterLoad(context.Context) {}
    63  
    64  // +checklocksignore
    65  func (e *contextEntry) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    66  	stateSourceObject.Load(0, &e.next)
    67  	stateSourceObject.Load(1, &e.prev)
    68  }
    69  
    70  func (r *subprocessRefs) StateTypeName() string {
    71  	return "pkg/sentry/platform/systrap.subprocessRefs"
    72  }
    73  
    74  func (r *subprocessRefs) StateFields() []string {
    75  	return []string{
    76  		"refCount",
    77  	}
    78  }
    79  
    80  func (r *subprocessRefs) beforeSave() {}
    81  
    82  // +checklocksignore
    83  func (r *subprocessRefs) StateSave(stateSinkObject state.Sink) {
    84  	r.beforeSave()
    85  	stateSinkObject.Save(0, &r.refCount)
    86  }
    87  
    88  // +checklocksignore
    89  func (r *subprocessRefs) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    90  	stateSourceObject.Load(0, &r.refCount)
    91  	stateSourceObject.AfterLoad(func() { r.afterLoad(ctx) })
    92  }
    93  
    94  func init() {
    95  	state.Register((*contextList)(nil))
    96  	state.Register((*contextEntry)(nil))
    97  	state.Register((*subprocessRefs)(nil))
    98  }