On 4/23/22 4:00 PM, Yafang Shao wrote:
Let's use a macro DEFAULT_BPFFS instead of the hard-coded "/sys/fs/bpf".
Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>
[...]
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index cdbfee60ea3e..3784867811a4 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -28,6 +28,8 @@ LIBBPF_API __u32 libbpf_major_version(void);
LIBBPF_API __u32 libbpf_minor_version(void);
LIBBPF_API const char *libbpf_version_string(void);
+#define DEFAULT_BPFFS "/sys/fs/bpf"
Small nit, but given this is included in a lot of places potentially, it should
have a LIBBPF_ prefix to avoid collisions. Maybe: LIBBPF_BPFFS_DEFAULT_MNT
enum libbpf_errno {
__LIBBPF_ERRNO__START = 4000,
@@ -91,7 +93,7 @@ struct bpf_object_open_opts {
bool relaxed_core_relocs;
/* maps that set the 'pinning' attribute in their definition will have
* their pin_path attribute set to a file in this directory, and be
- * auto-pinned to that path on load; defaults to "/sys/fs/bpf".
+ * auto-pinned to that path on load; defaults to DEFAULT_BPFFS.
*/
const char *pin_root_path;
@@ -190,7 +192,7 @@ bpf_object__open_xattr(struct bpf_object_open_attr *attr);
enum libbpf_pin_type {
LIBBPF_PIN_NONE,
- /* PIN_BY_NAME: pin maps by name (in /sys/fs/bpf by default) */
+ /* PIN_BY_NAME: pin maps by name (in DEFAULT_BPFFS by default) */
LIBBPF_PIN_BY_NAME,
};