Debian Codegraph @

cmd/bpf2go/test/test_bpfeb.go

raw symbols SCIP
1 // Code generated by bpf2go; DO NOT EDIT.
2 //go:build (mips || mips64 || ppc64 || s390x) && linux
3
4 package test
5
6 import (
7 "bytes"
8 _ "embed"
9 "fmt"
10 "io"
11 "structs"
12
13 "github.com/cilium/ebpf"
14 )
15
16 type testBar struct {
17 _ structs.HostLayout
18 A uint64
19 B uint32
20 _ [4]byte
21 }
22
23 type testBarfoo struct {
24 _ structs.HostLayout
25 Bar int64
26 Baz bool
27 _ [3]byte
28 Boo testE
29 }
30
31 type testBaz struct {
32 _ structs.HostLayout
33 A uint64
34 }
35
36 type testE uint32
37
38 const (
39 testEHOOPY testE = 0
40 testEFROOD testE = 1
41 )
42
43 type testUbar struct {
44 _ structs.HostLayout
45 A uint32
46 _ [4]byte
47 }
48
49 // Names of all BPF objects in the ELF.
50 //
51 // Used for safe lookups in a Collection or CollectionSpec.
52 const (
53 testMapMap1 = "map1"
54 testProgFilter = "filter"
55 testVarAnInt = "an_int"
56 testVarIntArray = "int_array"
57 testVarMyConstant = "my_constant"
58 testVarStructArray = "struct_array"
59 testVarStructConst = "struct_const"
60 testVarStructVar = "struct_var"
61 testVarUnionVar = "union_var"
62 )
63
64 // loadTest returns the embedded CollectionSpec for test.
65 func loadTest() (*ebpf.CollectionSpec, error) {
66 reader := bytes.NewReader(_TestBytes)
67 spec, err := ebpf.LoadCollectionSpecFromReader(reader)
68 if err != nil {
69 return nil, fmt.Errorf("can't load test: %w", err)
70 }
71
72 return spec, err
73 }
74
75 // loadTestObjects loads test and converts it into a struct.
76 //
77 // The following types are suitable as obj argument:
78 //
79 // *testObjects
80 // *testPrograms
81 // *testMaps
82 //
83 // See ebpf.CollectionSpec.LoadAndAssign documentation for details.
84 func loadTestObjects(obj any, opts *ebpf.CollectionOptions) error {
85 spec, err := loadTest()
86 if err != nil {
87 return err
88 }
89
90 return spec.LoadAndAssign(obj, opts)
91 }
92
93 // testSpecs contains maps and programs before they are loaded into the kernel.
94 //
95 // It can be passed ebpf.CollectionSpec.Assign.
96 type testSpecs struct {
97 testProgramSpecs
98 testMapSpecs
99 testVariableSpecs
100 }
101
102 // testProgramSpecs contains programs before they are loaded into the kernel.
103 //
104 // It can be passed ebpf.CollectionSpec.Assign.
105 type testProgramSpecs struct {
106 Filter *ebpf.ProgramSpec `ebpf:"filter"`
107 }
108
109 // testMapSpecs contains maps before they are loaded into the kernel.
110 //
111 // It can be passed ebpf.CollectionSpec.Assign.
112 type testMapSpecs struct {
113 Map1 *ebpf.MapSpec `ebpf:"map1"`
114 }
115
116 // testVariableSpecs contains global variables before they are loaded into the kernel.
117 //
118 // It can be passed ebpf.CollectionSpec.Assign.
119 type testVariableSpecs struct {
120 AnInt *ebpf.VariableSpec `ebpf:"an_int"`
121 IntArray *ebpf.VariableSpec `ebpf:"int_array"`
122 MyConstant *ebpf.VariableSpec `ebpf:"my_constant"`
123 StructArray *ebpf.VariableSpec `ebpf:"struct_array"`
124 StructConst *ebpf.VariableSpec `ebpf:"struct_const"`
125 StructVar *ebpf.VariableSpec `ebpf:"struct_var"`
126 UnionVar *ebpf.VariableSpec `ebpf:"union_var"`
127 }
128
129 // testObjects contains all objects after they have been loaded into the kernel.
130 //
131 // It can be passed to loadTestObjects or ebpf.CollectionSpec.LoadAndAssign.
132 type testObjects struct {
133 testPrograms
134 testMaps
135 testVariables
136 }
137
138 func (o *testObjects) Close() error {
139 return _TestClose(
140 &o.testPrograms,
141 &o.testMaps,
142 )
143 }
144
145 // testMaps contains all maps after they have been loaded into the kernel.
146 //
147 // It can be passed to loadTestObjects or ebpf.CollectionSpec.LoadAndAssign.
148 type testMaps struct {
149 Map1 *ebpf.Map `ebpf:"map1"`
150 }
151
152 func (m *testMaps) Close() error {
153 return _TestClose(
154 m.Map1,
155 )
156 }
157
158 // testVariables contains all global variables after they have been loaded into the kernel.
159 //
160 // It can be passed to loadTestObjects or ebpf.CollectionSpec.LoadAndAssign.
161 type testVariables struct {
162 AnInt *ebpf.Variable `ebpf:"an_int"`
163 IntArray *ebpf.Variable `ebpf:"int_array"`
164 MyConstant *ebpf.Variable `ebpf:"my_constant"`
165 StructArray *ebpf.Variable `ebpf:"struct_array"`
166 StructConst *ebpf.Variable `ebpf:"struct_const"`
167 StructVar *ebpf.Variable `ebpf:"struct_var"`
168 UnionVar *ebpf.Variable `ebpf:"union_var"`
169 }
170
171 // testPrograms contains all programs after they have been loaded into the kernel.
172 //
173 // It can be passed to loadTestObjects or ebpf.CollectionSpec.LoadAndAssign.
174 type testPrograms struct {
175 Filter *ebpf.Program `ebpf:"filter"`
176 }
177
178 func (p *testPrograms) Close() error {
179 return _TestClose(
180 p.Filter,
181 )
182 }
183
184 func _TestClose(closers ...io.Closer) error {
185 for _, closer := range closers {
186 if err := closer.Close(); err != nil {
187 return err
188 }
189 }
190 return nil
191 }
192
193 // Do not access this directly.
194 //
195 //go:embed test_bpfeb.o
196 var _TestBytes []byte