github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/gadgettracermanager/containers-map/containersmap_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 containersmap
     5  
     6  import (
     7  	"bytes"
     8  	_ "embed"
     9  	"fmt"
    10  	"io"
    11  
    12  	"github.com/cilium/ebpf"
    13  )
    14  
    15  type containersmapContainer struct {
    16  	ContainerId [256]int8
    17  	Namespace   [256]int8
    18  	Pod         [256]int8
    19  	Container   [256]int8
    20  }
    21  
    22  // loadContainersmap returns the embedded CollectionSpec for containersmap.
    23  func loadContainersmap() (*ebpf.CollectionSpec, error) {
    24  	reader := bytes.NewReader(_ContainersmapBytes)
    25  	spec, err := ebpf.LoadCollectionSpecFromReader(reader)
    26  	if err != nil {
    27  		return nil, fmt.Errorf("can't load containersmap: %w", err)
    28  	}
    29  
    30  	return spec, err
    31  }
    32  
    33  // loadContainersmapObjects loads containersmap and converts it into a struct.
    34  //
    35  // The following types are suitable as obj argument:
    36  //
    37  //	*containersmapObjects
    38  //	*containersmapPrograms
    39  //	*containersmapMaps
    40  //
    41  // See ebpf.CollectionSpec.LoadAndAssign documentation for details.
    42  func loadContainersmapObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
    43  	spec, err := loadContainersmap()
    44  	if err != nil {
    45  		return err
    46  	}
    47  
    48  	return spec.LoadAndAssign(obj, opts)
    49  }
    50  
    51  // containersmapSpecs contains maps and programs before they are loaded into the kernel.
    52  //
    53  // It can be passed ebpf.CollectionSpec.Assign.
    54  type containersmapSpecs struct {
    55  	containersmapProgramSpecs
    56  	containersmapMapSpecs
    57  }
    58  
    59  // containersmapSpecs contains programs before they are loaded into the kernel.
    60  //
    61  // It can be passed ebpf.CollectionSpec.Assign.
    62  type containersmapProgramSpecs struct {
    63  }
    64  
    65  // containersmapMapSpecs contains maps before they are loaded into the kernel.
    66  //
    67  // It can be passed ebpf.CollectionSpec.Assign.
    68  type containersmapMapSpecs struct {
    69  	Containers *ebpf.MapSpec `ebpf:"containers"`
    70  }
    71  
    72  // containersmapObjects contains all objects after they have been loaded into the kernel.
    73  //
    74  // It can be passed to loadContainersmapObjects or ebpf.CollectionSpec.LoadAndAssign.
    75  type containersmapObjects struct {
    76  	containersmapPrograms
    77  	containersmapMaps
    78  }
    79  
    80  func (o *containersmapObjects) Close() error {
    81  	return _ContainersmapClose(
    82  		&o.containersmapPrograms,
    83  		&o.containersmapMaps,
    84  	)
    85  }
    86  
    87  // containersmapMaps contains all maps after they have been loaded into the kernel.
    88  //
    89  // It can be passed to loadContainersmapObjects or ebpf.CollectionSpec.LoadAndAssign.
    90  type containersmapMaps struct {
    91  	Containers *ebpf.Map `ebpf:"containers"`
    92  }
    93  
    94  func (m *containersmapMaps) Close() error {
    95  	return _ContainersmapClose(
    96  		m.Containers,
    97  	)
    98  }
    99  
   100  // containersmapPrograms contains all programs after they have been loaded into the kernel.
   101  //
   102  // It can be passed to loadContainersmapObjects or ebpf.CollectionSpec.LoadAndAssign.
   103  type containersmapPrograms struct {
   104  }
   105  
   106  func (p *containersmapPrograms) Close() error {
   107  	return _ContainersmapClose()
   108  }
   109  
   110  func _ContainersmapClose(closers ...io.Closer) error {
   111  	for _, closer := range closers {
   112  		if err := closer.Close(); err != nil {
   113  			return err
   114  		}
   115  	}
   116  	return nil
   117  }
   118  
   119  // Do not access this directly.
   120  //
   121  //go:embed containersmap_bpfel.o
   122  var _ContainersmapBytes []byte