| 1 | // Code generated by bpf2go; DO NOT EDIT. |
| 2 | //go:build (386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 || wasm) && linux |
| 3 | |
| 4 | package main |
| 5 | |
| 6 | import ( |
| 7 | "bytes" |
| 8 | _ "embed" |
| 9 | "fmt" |
| 10 | "io" |
| 11 | |
| 12 | "github.com/cilium/ebpf" |
| 13 | ) |
| 14 | |
| 15 | // Names of all BPF objects in the ELF. |
| 16 | // |
| 17 | // Used for safe lookups in a Collection or CollectionSpec. |
| 18 | const ( |
| 19 | bpfMapMinimalSched = "minimal_sched" |
| 20 | ) |
| 21 | |
| 22 | // loadBpf returns the embedded CollectionSpec for bpf. |
| 23 | func loadBpf() (*ebpf.CollectionSpec, error) { |
| 24 | reader := bytes.NewReader(_BpfBytes) |
| 25 | spec, err := ebpf.LoadCollectionSpecFromReader(reader) |
| 26 | if err != nil { |
| 27 | return nil, fmt.Errorf("can't load bpf: %w", err) |
| 28 | } |
| 29 | |
| 30 | return spec, err |
| 31 | } |
| 32 | |
| 33 | // loadBpfObjects loads bpf and converts it into a struct. |
| 34 | // |
| 35 | // The following types are suitable as obj argument: |
| 36 | // |
| 37 | // *bpfObjects |
| 38 | // *bpfPrograms |
| 39 | // *bpfMaps |
| 40 | // |
| 41 | // See ebpf.CollectionSpec.LoadAndAssign documentation for details. |
| 42 | func loadBpfObjects(obj any, opts *ebpf.CollectionOptions) error { |
| 43 | spec, err := loadBpf() |
| 44 | if err != nil { |
| 45 | return err |
| 46 | } |
| 47 | |
| 48 | return spec.LoadAndAssign(obj, opts) |
| 49 | } |
| 50 | |
| 51 | // bpfSpecs contains maps and programs before they are loaded into the kernel. |
| 52 | // |
| 53 | // It can be passed ebpf.CollectionSpec.Assign. |
| 54 | type bpfSpecs struct { |
| 55 | bpfProgramSpecs |
| 56 | bpfMapSpecs |
| 57 | bpfVariableSpecs |
| 58 | } |
| 59 | |
| 60 | // bpfProgramSpecs contains programs before they are loaded into the kernel. |
| 61 | // |
| 62 | // It can be passed ebpf.CollectionSpec.Assign. |
| 63 | type bpfProgramSpecs struct { |
| 64 | } |
| 65 | |
| 66 | // bpfMapSpecs contains maps before they are loaded into the kernel. |
| 67 | // |
| 68 | // It can be passed ebpf.CollectionSpec.Assign. |
| 69 | type bpfMapSpecs struct { |
| 70 | MinimalSched *ebpf.MapSpec `ebpf:"minimal_sched"` |
| 71 | } |
| 72 | |
| 73 | // bpfVariableSpecs contains global variables before they are loaded into the kernel. |
| 74 | // |
| 75 | // It can be passed ebpf.CollectionSpec.Assign. |
| 76 | type bpfVariableSpecs struct { |
| 77 | } |
| 78 | |
| 79 | // bpfObjects contains all objects after they have been loaded into the kernel. |
| 80 | // |
| 81 | // It can be passed to loadBpfObjects or ebpf.CollectionSpec.LoadAndAssign. |
| 82 | type bpfObjects struct { |
| 83 | bpfPrograms |
| 84 | bpfMaps |
| 85 | bpfVariables |
| 86 | } |
| 87 | |
| 88 | func (o *bpfObjects) Close() error { |
| 89 | return _BpfClose( |
| 90 | &o.bpfPrograms, |
| 91 | &o.bpfMaps, |
| 92 | ) |
| 93 | } |
| 94 | |
| 95 | // bpfMaps contains all maps after they have been loaded into the kernel. |
| 96 | // |
| 97 | // It can be passed to loadBpfObjects or ebpf.CollectionSpec.LoadAndAssign. |
| 98 | type bpfMaps struct { |
| 99 | MinimalSched *ebpf.Map `ebpf:"minimal_sched"` |
| 100 | } |
| 101 | |
| 102 | func (m *bpfMaps) Close() error { |
| 103 | return _BpfClose( |
| 104 | m.MinimalSched, |
| 105 | ) |
| 106 | } |
| 107 | |
| 108 | // bpfVariables contains all global variables after they have been loaded into the kernel. |
| 109 | // |
| 110 | // It can be passed to loadBpfObjects or ebpf.CollectionSpec.LoadAndAssign. |
| 111 | type bpfVariables struct { |
| 112 | } |
| 113 | |
| 114 | // bpfPrograms contains all programs after they have been loaded into the kernel. |
| 115 | // |
| 116 | // It can be passed to loadBpfObjects or ebpf.CollectionSpec.LoadAndAssign. |
| 117 | type bpfPrograms struct { |
| 118 | } |
| 119 | |
| 120 | func (p *bpfPrograms) Close() error { |
| 121 | return _BpfClose() |
| 122 | } |
| 123 | |
| 124 | func _BpfClose(closers ...io.Closer) error { |
| 125 | for _, closer := range closers { |
| 126 | if err := closer.Close(); err != nil { |
| 127 | return err |
| 128 | } |
| 129 | } |
| 130 | return nil |
| 131 | } |
| 132 | |
| 133 | // Do not access this directly. |
| 134 | // |
| 135 | //go:embed bpf_bpfel.o |
| 136 | var _BpfBytes []byte |