github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/tchandler/dispatcher_bpfel.go (about)

     1  // Code generated by bpf2go; DO NOT EDIT.
     2  //go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64
     3  
     4  package tchandler
     5  
     6  import (
     7  	"bytes"
     8  	_ "embed"
     9  	"fmt"
    10  	"io"
    11  
    12  	"github.com/cilium/ebpf"
    13  )
    14  
    15  // loadDispatcher returns the embedded CollectionSpec for dispatcher.
    16  func loadDispatcher() (*ebpf.CollectionSpec, error) {
    17  	reader := bytes.NewReader(_DispatcherBytes)
    18  	spec, err := ebpf.LoadCollectionSpecFromReader(reader)
    19  	if err != nil {
    20  		return nil, fmt.Errorf("can't load dispatcher: %w", err)
    21  	}
    22  
    23  	return spec, err
    24  }
    25  
    26  // loadDispatcherObjects loads dispatcher and converts it into a struct.
    27  //
    28  // The following types are suitable as obj argument:
    29  //
    30  //	*dispatcherObjects
    31  //	*dispatcherPrograms
    32  //	*dispatcherMaps
    33  //
    34  // See ebpf.CollectionSpec.LoadAndAssign documentation for details.
    35  func loadDispatcherObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
    36  	spec, err := loadDispatcher()
    37  	if err != nil {
    38  		return err
    39  	}
    40  
    41  	return spec.LoadAndAssign(obj, opts)
    42  }
    43  
    44  // dispatcherSpecs contains maps and programs before they are loaded into the kernel.
    45  //
    46  // It can be passed ebpf.CollectionSpec.Assign.
    47  type dispatcherSpecs struct {
    48  	dispatcherProgramSpecs
    49  	dispatcherMapSpecs
    50  }
    51  
    52  // dispatcherSpecs contains programs before they are loaded into the kernel.
    53  //
    54  // It can be passed ebpf.CollectionSpec.Assign.
    55  type dispatcherProgramSpecs struct {
    56  	IgNetDisp *ebpf.ProgramSpec `ebpf:"ig_net_disp"`
    57  }
    58  
    59  // dispatcherMapSpecs contains maps before they are loaded into the kernel.
    60  //
    61  // It can be passed ebpf.CollectionSpec.Assign.
    62  type dispatcherMapSpecs struct {
    63  	GadgetTailCall *ebpf.MapSpec `ebpf:"gadget_tail_call"`
    64  }
    65  
    66  // dispatcherObjects contains all objects after they have been loaded into the kernel.
    67  //
    68  // It can be passed to loadDispatcherObjects or ebpf.CollectionSpec.LoadAndAssign.
    69  type dispatcherObjects struct {
    70  	dispatcherPrograms
    71  	dispatcherMaps
    72  }
    73  
    74  func (o *dispatcherObjects) Close() error {
    75  	return _DispatcherClose(
    76  		&o.dispatcherPrograms,
    77  		&o.dispatcherMaps,
    78  	)
    79  }
    80  
    81  // dispatcherMaps contains all maps after they have been loaded into the kernel.
    82  //
    83  // It can be passed to loadDispatcherObjects or ebpf.CollectionSpec.LoadAndAssign.
    84  type dispatcherMaps struct {
    85  	GadgetTailCall *ebpf.Map `ebpf:"gadget_tail_call"`
    86  }
    87  
    88  func (m *dispatcherMaps) Close() error {
    89  	return _DispatcherClose(
    90  		m.GadgetTailCall,
    91  	)
    92  }
    93  
    94  // dispatcherPrograms contains all programs after they have been loaded into the kernel.
    95  //
    96  // It can be passed to loadDispatcherObjects or ebpf.CollectionSpec.LoadAndAssign.
    97  type dispatcherPrograms struct {
    98  	IgNetDisp *ebpf.Program `ebpf:"ig_net_disp"`
    99  }
   100  
   101  func (p *dispatcherPrograms) Close() error {
   102  	return _DispatcherClose(
   103  		p.IgNetDisp,
   104  	)
   105  }
   106  
   107  func _DispatcherClose(closers ...io.Closer) error {
   108  	for _, closer := range closers {
   109  		if err := closer.Close(); err != nil {
   110  			return err
   111  		}
   112  	}
   113  	return nil
   114  }
   115  
   116  // Do not access this directly.
   117  //
   118  //go:embed dispatcher_bpfel.o
   119  var _DispatcherBytes []byte