Minor cleanup in code comments

This commit is contained in:
Alexandr Stelnykovych
2025-07-11 19:47:28 +03:00
committed by GitHub
parent d5698270e9
commit 1b76004a63

View File

@@ -150,7 +150,7 @@ func loadBpfObjects_Ex(objs interface{}, opts *ebpf.CollectionOptions) error {
return fmt.Errorf("ebpf: failed to modify program attach points: %w", err) return fmt.Errorf("ebpf: failed to modify program attach points: %w", err)
} }
// Load the eBPF programs and maps into the kernel. // Load the eBPF programs and maps into the kernel.
if err := spec.LoadAndAssign(objs, opts); err != nil { // object only has ONE tracing prog if err := spec.LoadAndAssign(objs, opts); err != nil {
return fmt.Errorf("ebpf: failed to load and assign ebpf objects: %w", err) return fmt.Errorf("ebpf: failed to load and assign ebpf objects: %w", err)
} }
return nil return nil
@@ -159,13 +159,13 @@ func loadBpfObjects_Ex(objs interface{}, opts *ebpf.CollectionOptions) error {
// modifyProgramAttachPoints modifies the attach points of the eBPF programs, if necessary. // modifyProgramAttachPoints modifies the attach points of the eBPF programs, if necessary.
// This is needed to ensure compatibility with different kernel versions. // This is needed to ensure compatibility with different kernel versions.
func modifyProgramsAttachPoints(spec *ebpf.CollectionSpec) error { func modifyProgramsAttachPoints(spec *ebpf.CollectionSpec) error {
// Load the kernel spec to find the udp_connect function. // Load the kernel spec
kspec, err := btf.LoadKernelSpec() kspec, err := btf.LoadKernelSpec()
if err != nil { if err != nil {
return err return err
} }
// Function to update the attach point to single bpf program // Function to update the attach point to a single BPF program
updateIfNeeded := func(bpfProgramName, attachPoint, attachPointLegacy string) error { updateIfNeeded := func(bpfProgramName, attachPoint, attachPointLegacy string) error {
ps, ok := spec.Programs[bpfProgramName] ps, ok := spec.Programs[bpfProgramName]
if !ok { if !ok {