github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/kfilefields/filefields_x86_bpfel.go (about) 1 // Code generated by bpf2go; DO NOT EDIT. 2 //go:build 386 || amd64 3 4 package kfilefields 5 6 import ( 7 "bytes" 8 _ "embed" 9 "fmt" 10 "io" 11 12 "github.com/cilium/ebpf" 13 ) 14 15 // loadFilefields returns the embedded CollectionSpec for filefields. 16 func loadFilefields() (*ebpf.CollectionSpec, error) { 17 reader := bytes.NewReader(_FilefieldsBytes) 18 spec, err := ebpf.LoadCollectionSpecFromReader(reader) 19 if err != nil { 20 return nil, fmt.Errorf("can't load filefields: %w", err) 21 } 22 23 return spec, err 24 } 25 26 // loadFilefieldsObjects loads filefields and converts it into a struct. 27 // 28 // The following types are suitable as obj argument: 29 // 30 // *filefieldsObjects 31 // *filefieldsPrograms 32 // *filefieldsMaps 33 // 34 // See ebpf.CollectionSpec.LoadAndAssign documentation for details. 35 func loadFilefieldsObjects(obj interface{}, opts *ebpf.CollectionOptions) error { 36 spec, err := loadFilefields() 37 if err != nil { 38 return err 39 } 40 41 return spec.LoadAndAssign(obj, opts) 42 } 43 44 // filefieldsSpecs contains maps and programs before they are loaded into the kernel. 45 // 46 // It can be passed ebpf.CollectionSpec.Assign. 47 type filefieldsSpecs struct { 48 filefieldsProgramSpecs 49 filefieldsMapSpecs 50 } 51 52 // filefieldsSpecs contains programs before they are loaded into the kernel. 53 // 54 // It can be passed ebpf.CollectionSpec.Assign. 55 type filefieldsProgramSpecs struct { 56 IgFgetX *ebpf.ProgramSpec `ebpf:"ig_fget_x"` 57 IgScmSndE *ebpf.ProgramSpec `ebpf:"ig_scm_snd_e"` 58 } 59 60 // filefieldsMapSpecs contains maps before they are loaded into the kernel. 61 // 62 // It can be passed ebpf.CollectionSpec.Assign. 63 type filefieldsMapSpecs struct { 64 IgFileFields *ebpf.MapSpec `ebpf:"ig_file_fields"` 65 } 66 67 // filefieldsObjects contains all objects after they have been loaded into the kernel. 68 // 69 // It can be passed to loadFilefieldsObjects or ebpf.CollectionSpec.LoadAndAssign. 70 type filefieldsObjects struct { 71 filefieldsPrograms 72 filefieldsMaps 73 } 74 75 func (o *filefieldsObjects) Close() error { 76 return _FilefieldsClose( 77 &o.filefieldsPrograms, 78 &o.filefieldsMaps, 79 ) 80 } 81 82 // filefieldsMaps contains all maps after they have been loaded into the kernel. 83 // 84 // It can be passed to loadFilefieldsObjects or ebpf.CollectionSpec.LoadAndAssign. 85 type filefieldsMaps struct { 86 IgFileFields *ebpf.Map `ebpf:"ig_file_fields"` 87 } 88 89 func (m *filefieldsMaps) Close() error { 90 return _FilefieldsClose( 91 m.IgFileFields, 92 ) 93 } 94 95 // filefieldsPrograms contains all programs after they have been loaded into the kernel. 96 // 97 // It can be passed to loadFilefieldsObjects or ebpf.CollectionSpec.LoadAndAssign. 98 type filefieldsPrograms struct { 99 IgFgetX *ebpf.Program `ebpf:"ig_fget_x"` 100 IgScmSndE *ebpf.Program `ebpf:"ig_scm_snd_e"` 101 } 102 103 func (p *filefieldsPrograms) Close() error { 104 return _FilefieldsClose( 105 p.IgFgetX, 106 p.IgScmSndE, 107 ) 108 } 109 110 func _FilefieldsClose(closers ...io.Closer) error { 111 for _, closer := range closers { 112 if err := closer.Close(); err != nil { 113 return err 114 } 115 } 116 return nil 117 } 118 119 // Do not access this directly. 120 // 121 //go:embed filefields_x86_bpfel.o 122 var _FilefieldsBytes []byte