Module bpf_loader_lib::meta

source ·
Expand description

Skeleton data types SPDX-License-Identifier: MIT

Copyright (c) 2023, eunomia-bpf All rights reserved.

bpf-loader-meta

Here are metadata types used for deserilizing JSON skeletons

A valid json skeleton is encoded using one of the two types:

  • EunomiaObjectMeta
  • ComposedObject

In fact, the second one is EunomiaObjectMeta + ELF binary. So in another words, they are same

EunomiaObjectMeta

Two fields need extra explanation:

export_types : Vec<ExportedTypesStructMeta>

Here describes the types (usually a struct) of the data that this ebpf program exported to the userspace program. The types described here will be verified using BTF, and used to format the output the ebpf program gives, and passed to the user-callback or stdout. Due to a strange limitation, each program can only have one export types in the Vec

bpf_skel: BpfSkeletonMeta

Will be explained in the next words.

BpfSkeletonMeta

This struct describes the skeleton of an ebpf object.

  • data_sections: Describes .rodata and .bss sections, and variables in that
  • maps: Describes map declarations that are used in this ebpf object.
  • progs: Describes ebpf programs (functions) in this ebpf object
  • obj_name: The name of this ebpf object
  • doc: Docs, will be used to generate command line parser

DataSectionMeta

Describes a data section, and variables declared in it.

DataSectionVariableMeta

Describes a variable in the corresponding data section.

  • name: The name of this variable
  • ty: The C type of this variable
  • value: The default value of this variable. If not provided and not filled by command line parser, bpf-loader will fill the variable with zero bytes
  • description: The description of the variable. Will be used to generate command line parser
  • cmdarg: Detailed configuration on the command line argument of this variable

VariableCommandArgument

Describes the detailed configuration of this variable’s command line argument.

  • default: The default value of this command line argument
  • long: The long name of this argument
  • short: The short name of this argument, in one char.

MapMeta

Describes an eBPF map

ProgMeta

Describes an eBPF program

Modules

  • The builder of Command SPDX-License-Identifier: MIT
  • A parser that can parse values from command line SPDX-License-Identifier: MIT

Structs

Enums

  • Indicate how to inteprete the buffer value polled by the userspace program DefaultStruct - Inteprete the data to a map constructed using BTF StackTrace - Inteprete the data that received as StackTrace data. Will also use BTF, but the user is responsible to provide a function to translate the fields to the corresponding requiring fields
  • Describe whether and how a map’s value will be exported
  • Sample types
  • TC attach point options