github.com/sagernet/gvisor@v0.0.0-20240428053021-e691de28565f/pkg/hostarch/hostarch_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  package hostarch
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/sagernet/gvisor/pkg/state"
     9  )
    10  
    11  func (a *AccessType) StateTypeName() string {
    12  	return "pkg/hostarch.AccessType"
    13  }
    14  
    15  func (a *AccessType) StateFields() []string {
    16  	return []string{
    17  		"Read",
    18  		"Write",
    19  		"Execute",
    20  	}
    21  }
    22  
    23  func (a *AccessType) beforeSave() {}
    24  
    25  // +checklocksignore
    26  func (a *AccessType) StateSave(stateSinkObject state.Sink) {
    27  	a.beforeSave()
    28  	stateSinkObject.Save(0, &a.Read)
    29  	stateSinkObject.Save(1, &a.Write)
    30  	stateSinkObject.Save(2, &a.Execute)
    31  }
    32  
    33  func (a *AccessType) afterLoad(context.Context) {}
    34  
    35  // +checklocksignore
    36  func (a *AccessType) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    37  	stateSourceObject.Load(0, &a.Read)
    38  	stateSourceObject.Load(1, &a.Write)
    39  	stateSourceObject.Load(2, &a.Execute)
    40  }
    41  
    42  func (v *Addr) StateTypeName() string {
    43  	return "pkg/hostarch.Addr"
    44  }
    45  
    46  func (v *Addr) StateFields() []string {
    47  	return nil
    48  }
    49  
    50  func (r *AddrRange) StateTypeName() string {
    51  	return "pkg/hostarch.AddrRange"
    52  }
    53  
    54  func (r *AddrRange) StateFields() []string {
    55  	return []string{
    56  		"Start",
    57  		"End",
    58  	}
    59  }
    60  
    61  func (r *AddrRange) beforeSave() {}
    62  
    63  // +checklocksignore
    64  func (r *AddrRange) StateSave(stateSinkObject state.Sink) {
    65  	r.beforeSave()
    66  	stateSinkObject.Save(0, &r.Start)
    67  	stateSinkObject.Save(1, &r.End)
    68  }
    69  
    70  func (r *AddrRange) afterLoad(context.Context) {}
    71  
    72  // +checklocksignore
    73  func (r *AddrRange) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    74  	stateSourceObject.Load(0, &r.Start)
    75  	stateSourceObject.Load(1, &r.End)
    76  }
    77  
    78  func init() {
    79  	state.Register((*AccessType)(nil))
    80  	state.Register((*Addr)(nil))
    81  	state.Register((*AddrRange)(nil))
    82  }