diff --git a/pkg/sensors/load.go b/pkg/sensors/load.go index 4ec318e775f..e45fcbf8104 100644 --- a/pkg/sensors/load.go +++ b/pkg/sensors/load.go @@ -220,13 +220,13 @@ func (s *Sensor) FindPrograms() error { func (s *Sensor) SetMapPinPath(m *program.Map) { switch m.Type { case program.MapTypeGlobal: - m.PinPath = filepath.Join(m.PinName) + m.PinPath = filepath.Join(m.Name) case program.MapTypePolicy: - m.PinPath = filepath.Join(s.Policy, m.PinName) + m.PinPath = filepath.Join(s.Policy, m.Name) case program.MapTypeSensor: - m.PinPath = filepath.Join(s.Policy, s.Name, m.PinName) + m.PinPath = filepath.Join(s.Policy, s.Name, m.Name) case program.MapTypeProgram: - m.PinPath = filepath.Join(s.Policy, s.Name, m.Prog.PinName, m.PinName) + m.PinPath = filepath.Join(s.Policy, s.Name, m.Prog.PinName, m.Name) } } diff --git a/pkg/sensors/program/map.go b/pkg/sensors/program/map.go index 1d7b6693ac4..13048174d06 100644 --- a/pkg/sensors/program/map.go +++ b/pkg/sensors/program/map.go @@ -25,7 +25,6 @@ const ( // Map represents BPF maps. type Map struct { Name string - PinName string PinPath string Prog *Program PinState State @@ -33,26 +32,22 @@ type Map struct { Type MapType } -func mapBuilder(name, pin string, ld *Program, ty MapType) *Map { - m := &Map{name, pin, "", ld, Idle(), nil, ty} +func mapBuilder(name string, ld *Program, ty MapType) *Map { + m := &Map{name, "", ld, Idle(), nil, ty} ld.PinMap[name] = m return m } func MapBuilder(name string, ld *Program) *Map { - return mapBuilder(name, name, ld, MapTypeGlobal) + return mapBuilder(name, ld, MapTypeGlobal) } func MapBuilderType(name string, ld *Program, ty MapType) *Map { - return mapBuilder(name, name, ld, ty) -} - -func MapBuilderPin(name, pin string, ld *Program) *Map { - return mapBuilder(name, pin, ld, MapTypeGlobal) + return mapBuilder(name, ld, ty) } func (m *Map) Unload() error { - log := logger.GetLogger().WithField("map", m.Name).WithField("pin", m.PinName) + log := logger.GetLogger().WithField("map", m.Name).WithField("pin", m.Name) if !m.PinState.IsLoaded() { log.WithField("count", m.PinState.count).Debug("Refusing to unload map as it is not loaded") return nil