bpfd_api/
util.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright Authors of bpfd
3
4pub mod directories {
5    // The following directories are used by bpfd. They should be created by bpfd service
6    // via the bpfd.service settings. They will be manually created in the case where bpfd
7    // is not being run as a service.
8    //
9    // ConfigurationDirectory: /etc/bpfd/
10    pub const CFGDIR_MODE: u32 = 0o6750;
11    pub const CFGDIR: &str = "/etc/bpfd";
12    pub const CFGDIR_STATIC_PROGRAMS: &str = "/etc/bpfd/programs.d";
13    pub const CFGPATH_BPFD_CONFIG: &str = "/etc/bpfd/bpfd.toml";
14    pub const CFGPATH_CA_CERTS_PEM: &str = "/etc/bpfd/certs/ca/ca.pem";
15    pub const CFGPATH_CA_CERTS_KEY: &str = "/etc/bpfd/certs/ca/ca.key";
16    pub const CFGPATH_BPFD_CERTS_PEM: &str = "/etc/bpfd/certs/bpfd/bpfd.pem";
17    pub const CFGPATH_BPFD_CERTS_KEY: &str = "/etc/bpfd/certs/bpfd/bpfd.key";
18    pub const CFGPATH_BPFD_CLIENT_CERTS_PEM: &str = "/etc/bpfd/certs/bpfd-client/bpfd-client.pem";
19    pub const CFGPATH_BPFD_CLIENT_CERTS_KEY: &str = "/etc/bpfd/certs/bpfd-client/bpfd-client.key";
20
21    // RuntimeDirectory: /run/bpfd/
22    pub const RTDIR_MODE: u32 = 0o6770;
23    pub const RTDIR: &str = "/run/bpfd";
24    pub const RTDIR_XDP_DISPATCHER: &str = "/run/bpfd/dispatchers/xdp";
25    pub const RTDIR_TC_INGRESS_DISPATCHER: &str = "/run/bpfd/dispatchers/tc-ingress";
26    pub const RTDIR_TC_EGRESS_DISPATCHER: &str = "/run/bpfd/dispatchers/tc-egress";
27    pub const RTDIR_FS: &str = "/run/bpfd/fs";
28    pub const RTDIR_FS_TC_INGRESS: &str = "/run/bpfd/fs/tc-ingress";
29    pub const RTDIR_FS_TC_EGRESS: &str = "/run/bpfd/fs/tc-egress";
30    pub const RTDIR_FS_XDP: &str = "/run/bpfd/fs/xdp";
31    pub const RTDIR_FS_MAPS: &str = "/run/bpfd/fs/maps";
32    pub const RTDIR_PROGRAMS: &str = "/run/bpfd/programs";
33    pub const RTPATH_BPFD_SOCKET: &str = "/run/bpfd/bpfd.sock";
34    // The CSI socket must be in it's own sub directory so we can easily create a dedicated
35    // K8s volume mount for it.
36    pub const RTDIR_BPFD_CSI: &str = "/run/bpfd/csi";
37    pub const RTPATH_BPFD_CSI_SOCKET: &str = "/run/bpfd/csi/csi.sock";
38    pub const RTDIR_BPFD_CSI_FS: &str = "/run/bpfd/csi/fs";
39
40    // StateDirectory: /var/lib/bpfd/
41    pub const STDIR_MODE: u32 = 0o6770;
42    pub const STDIR: &str = "/var/lib/bpfd";
43    pub const STDIR_BYTECODE_IMAGE_CONTENT_STORE: &str = "/var/lib/bpfd/io.bpfd.image.content";
44}