github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/gadgets/profile/block-io/tracer/biolatency_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 biolatencyHist struct{ Slots [27]uint32 }
    16  
    17  type biolatencyHistKey struct {
    18  	CmdFlags uint32
    19  	Dev      uint32
    20  }
    21  
    22  // loadBiolatency returns the embedded CollectionSpec for biolatency.
    23  func loadBiolatency() (*ebpf.CollectionSpec, error) {
    24  	reader := bytes.NewReader(_BiolatencyBytes)
    25  	spec, err := ebpf.LoadCollectionSpecFromReader(reader)
    26  	if err != nil {
    27  		return nil, fmt.Errorf("can't load biolatency: %w", err)
    28  	}
    29  
    30  	return spec, err
    31  }
    32  
    33  // loadBiolatencyObjects loads biolatency and converts it into a struct.
    34  //
    35  // The following types are suitable as obj argument:
    36  //
    37  //	*biolatencyObjects
    38  //	*biolatencyPrograms
    39  //	*biolatencyMaps
    40  //
    41  // See ebpf.CollectionSpec.LoadAndAssign documentation for details.
    42  func loadBiolatencyObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
    43  	spec, err := loadBiolatency()
    44  	if err != nil {
    45  		return err
    46  	}
    47  
    48  	return spec.LoadAndAssign(obj, opts)
    49  }
    50  
    51  // biolatencySpecs contains maps and programs before they are loaded into the kernel.
    52  //
    53  // It can be passed ebpf.CollectionSpec.Assign.
    54  type biolatencySpecs struct {
    55  	biolatencyProgramSpecs
    56  	biolatencyMapSpecs
    57  }
    58  
    59  // biolatencySpecs contains programs before they are loaded into the kernel.
    60  //
    61  // It can be passed ebpf.CollectionSpec.Assign.
    62  type biolatencyProgramSpecs struct {
    63  	IgProfioDone *ebpf.ProgramSpec `ebpf:"ig_profio_done"`
    64  	IgProfioIns  *ebpf.ProgramSpec `ebpf:"ig_profio_ins"`
    65  	IgProfioIss  *ebpf.ProgramSpec `ebpf:"ig_profio_iss"`
    66  }
    67  
    68  // biolatencyMapSpecs contains maps before they are loaded into the kernel.
    69  //
    70  // It can be passed ebpf.CollectionSpec.Assign.
    71  type biolatencyMapSpecs struct {
    72  	CgroupMap *ebpf.MapSpec `ebpf:"cgroup_map"`
    73  	Hists     *ebpf.MapSpec `ebpf:"hists"`
    74  	Start     *ebpf.MapSpec `ebpf:"start"`
    75  }
    76  
    77  // biolatencyObjects contains all objects after they have been loaded into the kernel.
    78  //
    79  // It can be passed to loadBiolatencyObjects or ebpf.CollectionSpec.LoadAndAssign.
    80  type biolatencyObjects struct {
    81  	biolatencyPrograms
    82  	biolatencyMaps
    83  }
    84  
    85  func (o *biolatencyObjects) Close() error {
    86  	return _BiolatencyClose(
    87  		&o.biolatencyPrograms,
    88  		&o.biolatencyMaps,
    89  	)
    90  }
    91  
    92  // biolatencyMaps contains all maps after they have been loaded into the kernel.
    93  //
    94  // It can be passed to loadBiolatencyObjects or ebpf.CollectionSpec.LoadAndAssign.
    95  type biolatencyMaps struct {
    96  	CgroupMap *ebpf.Map `ebpf:"cgroup_map"`
    97  	Hists     *ebpf.Map `ebpf:"hists"`
    98  	Start     *ebpf.Map `ebpf:"start"`
    99  }
   100  
   101  func (m *biolatencyMaps) Close() error {
   102  	return _BiolatencyClose(
   103  		m.CgroupMap,
   104  		m.Hists,
   105  		m.Start,
   106  	)
   107  }
   108  
   109  // biolatencyPrograms contains all programs after they have been loaded into the kernel.
   110  //
   111  // It can be passed to loadBiolatencyObjects or ebpf.CollectionSpec.LoadAndAssign.
   112  type biolatencyPrograms struct {
   113  	IgProfioDone *ebpf.Program `ebpf:"ig_profio_done"`
   114  	IgProfioIns  *ebpf.Program `ebpf:"ig_profio_ins"`
   115  	IgProfioIss  *ebpf.Program `ebpf:"ig_profio_iss"`
   116  }
   117  
   118  func (p *biolatencyPrograms) Close() error {
   119  	return _BiolatencyClose(
   120  		p.IgProfioDone,
   121  		p.IgProfioIns,
   122  		p.IgProfioIss,
   123  	)
   124  }
   125  
   126  func _BiolatencyClose(closers ...io.Closer) error {
   127  	for _, closer := range closers {
   128  		if err := closer.Close(); err != nil {
   129  			return err
   130  		}
   131  	}
   132  	return nil
   133  }
   134  
   135  // Do not access this directly.
   136  //
   137  //go:embed biolatency_x86_bpfel.o
   138  var _BiolatencyBytes []byte