mybtf

package module
v0.0.0-...-9b78e6e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2025 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func DumpData

func DumpData(typ btf.Type, data []byte) (string, error)

func FindStruct

func FindStruct(spec *btf.Spec, name string) (*btf.Struct, error)

FindStruct finds a struct by name in the BTF spec. It returns the very first struct with the given name even if there are multiple structs with the same name, i.e. Ubuntu 20.04 has a malformed BTF with multiple sk_buff structs.

func FindStructMember

func FindStructMember(strct *btf.Struct, name string) (*btf.Member, error)

FindStructMember finds a member in a struct by name, even if the member is in embedded anonymous struct/union.

func FindUnionMember

func FindUnionMember(union *btf.Union, name string) (*btf.Member, error)

FindUnionMember finds a member in a union by name, even if the member is in embedded anonymous struct/union.

func HaveEnumValue

func HaveEnumValue(spec *btf.Spec, enumName, enumValue string) bool

func IsBigEndian

func IsBigEndian(t btf.Type) bool

IsBigEndian checks if the given btf.Type is big-endian or not by checking if it is typedef with a name starting with "__be". At most time, the big-endian type is typedef with a name starting with "__be" in the kernel.

func IsBool

func IsBool(typ btf.Type) bool

func IsChar

func IsChar(t btf.Type) bool

func IsInt

func IsInt(typ btf.Type) bool

func IsStructPointer

func IsStructPointer(t btf.Type, structName string) bool

func IsVoid

func IsVoid(t btf.Type) bool

func IsVoidPointer

func IsVoidPointer(t btf.Type) bool

func StructMemberOffset

func StructMemberOffset(strct *btf.Struct, name string) (uint32, error)

StructMemberOffset calculates the offset of a member in a struct, even if the member is in embedded anonymous struct/union.

func UnderlyingType

func UnderlyingType(t btf.Type) btf.Type

UnderlyingType returns the underlying type of the given btf.Type if it is typedef, volatile, const, restrict or type tag.

func UnionMemberOffset

func UnionMemberOffset(union *btf.Union, name string) (uint32, error)

UnionMemberOffset calculates the offset of a member in a union, even if the member is in embedded anonymous struct/union.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL