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

     1  // automatically generated by stateify.
     2  
     3  package bpf
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/sagernet/gvisor/pkg/abi/linux"
     9  	"github.com/sagernet/gvisor/pkg/state"
    10  )
    11  
    12  func (ins *Instruction) StateTypeName() string {
    13  	return "pkg/bpf.Instruction"
    14  }
    15  
    16  func (ins *Instruction) StateFields() []string {
    17  	return (*linux.BPFInstruction)(ins).StateFields()
    18  }
    19  
    20  // +checklocksignore
    21  func (ins *Instruction) StateSave(stateSinkObject state.Sink) {
    22  	(*linux.BPFInstruction)(ins).StateSave(stateSinkObject)
    23  }
    24  
    25  // +checklocksignore
    26  func (ins *Instruction) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    27  	(*linux.BPFInstruction)(ins).StateLoad(ctx, stateSourceObject)
    28  }
    29  
    30  func (p *Program) StateTypeName() string {
    31  	return "pkg/bpf.Program"
    32  }
    33  
    34  func (p *Program) StateFields() []string {
    35  	return []string{
    36  		"instructions",
    37  	}
    38  }
    39  
    40  func (p *Program) beforeSave() {}
    41  
    42  // +checklocksignore
    43  func (p *Program) StateSave(stateSinkObject state.Sink) {
    44  	p.beforeSave()
    45  	stateSinkObject.Save(0, &p.instructions)
    46  }
    47  
    48  func (p *Program) afterLoad(context.Context) {}
    49  
    50  // +checklocksignore
    51  func (p *Program) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    52  	stateSourceObject.Load(0, &p.instructions)
    53  }
    54  
    55  func init() {
    56  	state.Register((*Instruction)(nil))
    57  	state.Register((*Program)(nil))
    58  }