-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
paths.go
29 lines (24 loc) · 905 Bytes
/
paths.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium
package loader
import (
"path/filepath"
"github.com/vishvananda/netlink"
)
// bpffsDevicesDir returns the path to the 'devices' directory on bpffs, usually
// /sys/fs/bpf/cilium/devices. It does not ensure the directory exists.
//
// base is typically set to /sys/fs/bpf/cilium, but can be a temp directory
// during tests.
func bpffsDevicesDir(base string) string {
return filepath.Join(base, "devices")
}
// bpffsDeviceLinksDir returns the bpffs path to the per-device links directory,
// usually /sys/fs/bpf/cilium/devices/<device>/links. It does not ensure the
// directory exists.
//
// base is typically set to /sys/fs/bpf/cilium, but can be a temp directory
// during tests.
func bpffsDeviceLinksDir(base string, device netlink.Link) string {
return filepath.Join(bpffsDevicesDir(base), device.Attrs().Name, "links")
}