block_bpfel.go - Katyusha's blog
mobile wallpaper 1mobile wallpaper 2mobile wallpaper 3mobile wallpaper 4
block_bpfel.go
Go Source File · 141 lines
block_bpfel.go
// Code generated by bpf2go; DO NOT EDIT.
//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64
package collector
import (
"bytes"
_ "embed"
"fmt"
"io"
"github.com/cilium/ebpf"
)
type blockDevStat struct {
Count uint64
TotalLatNs uint64
MaxLatNs uint64
Bytes uint64
Inflight int64
Slots [32]uint64
}
type blockRqKey struct {
Dev uint32
Pad uint32
Sector uint64
}
// loadBlock returns the embedded CollectionSpec for block.
func loadBlock() (*ebpf.CollectionSpec, error) {
reader := bytes.NewReader(_BlockBytes)
spec, err := ebpf.LoadCollectionSpecFromReader(reader)
if err != nil {
return nil, fmt.Errorf("can't load block: %w", err)
}
return spec, err
}
// loadBlockObjects loads block and converts it into a struct.
//
// The following types are suitable as obj argument:
//
// *blockObjects
// *blockPrograms
// *blockMaps
//
// See ebpf.CollectionSpec.LoadAndAssign documentation for details.
func loadBlockObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
spec, err := loadBlock()
if err != nil {
return err
}
return spec.LoadAndAssign(obj, opts)
}
// blockSpecs contains maps and programs before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type blockSpecs struct {
blockProgramSpecs
blockMapSpecs
}
// blockSpecs contains programs before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type blockProgramSpecs struct {
HandleComplete *ebpf.ProgramSpec `ebpf:"handle_complete"`
HandleIssue *ebpf.ProgramSpec `ebpf:"handle_issue"`
}
// blockMapSpecs contains maps before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type blockMapSpecs struct {
DevStats *ebpf.MapSpec `ebpf:"dev_stats"`
Start *ebpf.MapSpec `ebpf:"start"`
}
// blockObjects contains all objects after they have been loaded into the kernel.
//
// It can be passed to loadBlockObjects or ebpf.CollectionSpec.LoadAndAssign.
type blockObjects struct {
blockPrograms
blockMaps
}
func (o *blockObjects) Close() error {
return _BlockClose(
&o.blockPrograms,
&o.blockMaps,
)
}
// blockMaps contains all maps after they have been loaded into the kernel.
//
// It can be passed to loadBlockObjects or ebpf.CollectionSpec.LoadAndAssign.
type blockMaps struct {
DevStats *ebpf.Map `ebpf:"dev_stats"`
Start *ebpf.Map `ebpf:"start"`
}
func (m *blockMaps) Close() error {
return _BlockClose(
m.DevStats,
m.Start,
)
}
// blockPrograms contains all programs after they have been loaded into the kernel.
//
// It can be passed to loadBlockObjects or ebpf.CollectionSpec.LoadAndAssign.
type blockPrograms struct {
HandleComplete *ebpf.Program `ebpf:"handle_complete"`
HandleIssue *ebpf.Program `ebpf:"handle_issue"`
}
func (p *blockPrograms) Close() error {
return _BlockClose(
p.HandleComplete,
p.HandleIssue,
)
}
func _BlockClose(closers ...io.Closer) error {
for _, closer := range closers {
if err := closer.Close(); err != nil {
return err
}
}
return nil
}
// Do not access this directly.
//
//go:embed block_bpfel.o
var _BlockBytes []byte

目录