github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/gadgets/top/block-io/tracer/biotop_x86_bpfel.go (about)

     1  // Code generated by bpf2go; DO NOT EDIT.
     2  //go:build 386 || amd64
     3  
     4  package tracer
     5  
     6  import (
     7  	"bytes"
     8  	_ "embed"
     9  	"fmt"
    10  	"io"
    11  
    12  	"github.com/cilium/ebpf"
    13  )
    14  
    15  type biotopInfoT struct {
    16  	Mntnsid uint64
    17  	Pid     uint32
    18  	Rwflag  int32
    19  	Major   int32
    20  	Minor   int32
    21  	Name    [16]uint8
    22  }
    23  
    24  type biotopStartReqT struct {
    25  	Ts      uint64
    26  	DataLen uint64
    27  }
    28  
    29  type biotopValT struct {
    30  	Bytes uint64
    31  	Us    uint64
    32  	Io    uint32
    33  	_     [4]byte
    34  }
    35  
    36  type biotopWhoT struct {
    37  	Mntnsid uint64
    38  	Pid     uint32
    39  	Name    [16]int8
    40  	_       [4]byte
    41  }
    42  
    43  // loadBiotop returns the embedded CollectionSpec for biotop.
    44  func loadBiotop() (*ebpf.CollectionSpec, error) {
    45  	reader := bytes.NewReader(_BiotopBytes)
    46  	spec, err := ebpf.LoadCollectionSpecFromReader(reader)
    47  	if err != nil {
    48  		return nil, fmt.Errorf("can't load biotop: %w", err)
    49  	}
    50  
    51  	return spec, err
    52  }
    53  
    54  // loadBiotopObjects loads biotop and converts it into a struct.
    55  //
    56  // The following types are suitable as obj argument:
    57  //
    58  //	*biotopObjects
    59  //	*biotopPrograms
    60  //	*biotopMaps
    61  //
    62  // See ebpf.CollectionSpec.LoadAndAssign documentation for details.
    63  func loadBiotopObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
    64  	spec, err := loadBiotop()
    65  	if err != nil {
    66  		return err
    67  	}
    68  
    69  	return spec.LoadAndAssign(obj, opts)
    70  }
    71  
    72  // biotopSpecs contains maps and programs before they are loaded into the kernel.
    73  //
    74  // It can be passed ebpf.CollectionSpec.Assign.
    75  type biotopSpecs struct {
    76  	biotopProgramSpecs
    77  	biotopMapSpecs
    78  }
    79  
    80  // biotopSpecs contains programs before they are loaded into the kernel.
    81  //
    82  // It can be passed ebpf.CollectionSpec.Assign.
    83  type biotopProgramSpecs struct {
    84  	IgTopioDone  *ebpf.ProgramSpec `ebpf:"ig_topio_done"`
    85  	IgTopioReq   *ebpf.ProgramSpec `ebpf:"ig_topio_req"`
    86  	IgTopioStart *ebpf.ProgramSpec `ebpf:"ig_topio_start"`
    87  }
    88  
    89  // biotopMapSpecs contains maps before they are loaded into the kernel.
    90  //
    91  // It can be passed ebpf.CollectionSpec.Assign.
    92  type biotopMapSpecs struct {
    93  	Counts               *ebpf.MapSpec `ebpf:"counts"`
    94  	GadgetMntnsFilterMap *ebpf.MapSpec `ebpf:"gadget_mntns_filter_map"`
    95  	Start                *ebpf.MapSpec `ebpf:"start"`
    96  	Whobyreq             *ebpf.MapSpec `ebpf:"whobyreq"`
    97  }
    98  
    99  // biotopObjects contains all objects after they have been loaded into the kernel.
   100  //
   101  // It can be passed to loadBiotopObjects or ebpf.CollectionSpec.LoadAndAssign.
   102  type biotopObjects struct {
   103  	biotopPrograms
   104  	biotopMaps
   105  }
   106  
   107  func (o *biotopObjects) Close() error {
   108  	return _BiotopClose(
   109  		&o.biotopPrograms,
   110  		&o.biotopMaps,
   111  	)
   112  }
   113  
   114  // biotopMaps contains all maps after they have been loaded into the kernel.
   115  //
   116  // It can be passed to loadBiotopObjects or ebpf.CollectionSpec.LoadAndAssign.
   117  type biotopMaps struct {
   118  	Counts               *ebpf.Map `ebpf:"counts"`
   119  	GadgetMntnsFilterMap *ebpf.Map `ebpf:"gadget_mntns_filter_map"`
   120  	Start                *ebpf.Map `ebpf:"start"`
   121  	Whobyreq             *ebpf.Map `ebpf:"whobyreq"`
   122  }
   123  
   124  func (m *biotopMaps) Close() error {
   125  	return _BiotopClose(
   126  		m.Counts,
   127  		m.GadgetMntnsFilterMap,
   128  		m.Start,
   129  		m.Whobyreq,
   130  	)
   131  }
   132  
   133  // biotopPrograms contains all programs after they have been loaded into the kernel.
   134  //
   135  // It can be passed to loadBiotopObjects or ebpf.CollectionSpec.LoadAndAssign.
   136  type biotopPrograms struct {
   137  	IgTopioDone  *ebpf.Program `ebpf:"ig_topio_done"`
   138  	IgTopioReq   *ebpf.Program `ebpf:"ig_topio_req"`
   139  	IgTopioStart *ebpf.Program `ebpf:"ig_topio_start"`
   140  }
   141  
   142  func (p *biotopPrograms) Close() error {
   143  	return _BiotopClose(
   144  		p.IgTopioDone,
   145  		p.IgTopioReq,
   146  		p.IgTopioStart,
   147  	)
   148  }
   149  
   150  func _BiotopClose(closers ...io.Closer) error {
   151  	for _, closer := range closers {
   152  		if err := closer.Close(); err != nil {
   153  			return err
   154  		}
   155  	}
   156  	return nil
   157  }
   158  
   159  // Do not access this directly.
   160  //
   161  //go:embed biotop_x86_bpfel.o
   162  var _BiotopBytes []byte