summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2024-01-25 20:29:14 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2024-01-27 19:02:52 +0100
commitbbd858935fad9a469b5b339948e1215b347b05c0 (patch)
tree3d6cff23ed9c13ea15f6fd37775dd3e9c8f8477a /lib
parentbabeld: remove bogus config path print (diff)
downloadfrr-bbd858935fad9a469b5b339948e1215b347b05c0.tar.xz
frr-bbd858935fad9a469b5b339948e1215b347b05c0.zip
build: homologize path handling
Use consistent `e_somepath` names for expanded versions of `somepath`. Also remove all paths from `config.h` and put them into `lib/config_paths.h` - this is to make more obvious when someone is doing something probably not quite properly structured. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/.gitignore1
-rw-r--r--lib/command.c2
-rw-r--r--lib/config_paths.h.in24
-rw-r--r--lib/libfrr.c2
-rw-r--r--lib/vty.c2
-rw-r--r--lib/yang.c2
6 files changed, 33 insertions, 0 deletions
diff --git a/lib/.gitignore b/lib/.gitignore
index 5d38469ca..1c9314bf0 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -1,3 +1,4 @@
+/config_paths.h
/version.c
/version.h
/gitversion.h
diff --git a/lib/command.c b/lib/command.c
index 244bf86e8..fa260721d 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -43,6 +43,8 @@
#include "frrscript.h"
+#include "lib/config_paths.h"
+
DEFINE_MTYPE_STATIC(LIB, HOST, "Host config");
DEFINE_MTYPE(LIB, COMPLETION, "Completion item");
diff --git a/lib/config_paths.h.in b/lib/config_paths.h.in
new file mode 100644
index 000000000..cc4090563
--- /dev/null
+++ b/lib/config_paths.h.in
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* autogenerated by configure / config.status */
+
+/* IF YOU ARE INCLUDING THIS FILE FROM A DAEMON OR ZEBRA, YOU ARE PROBABLY
+ * DOING SOMETHING WRONG. Check for / add a library function that retrieves
+ * the path you need.
+ *
+ * Only libfrr and watchfrr should be including this file.
+ */
+
+/* the replacements for these are emitted by AX_SUBST_EXPANDED, which also
+ * adds the e_ prefix
+ */
+#define FRR_RUNSTATE_PATH "@e_frr_runstatedir@"
+#define FRR_LIBSTATE_PATH "@e_frr_libstatedir@"
+#define YANG_MODELS_PATH "@e_yangmodelsdir@"
+#define MODULE_PATH "@e_moduledir@"
+#define SCRIPT_PATH "@e_scriptdir@"
+
+/* for extra footgunning, this one has a trailing slash */
+#define SYSCONFDIR "@e_frr_sysconfdir@/"
+
+#define VTYSH_BIN_PATH "@e_vtysh_bin@"
+#define WATCHFRR_SH_PATH "@e_watchfrr_sh@"
diff --git a/lib/libfrr.c b/lib/libfrr.c
index fe2c8fa82..d904f6f8b 100644
--- a/lib/libfrr.c
+++ b/lib/libfrr.c
@@ -37,6 +37,8 @@
#include "frrscript.h"
#include "systemd.h"
+#include "lib/config_paths.h"
+
DEFINE_HOOK(frr_early_init, (struct event_loop * tm), (tm));
DEFINE_HOOK(frr_late_init, (struct event_loop * tm), (tm));
DEFINE_HOOK(frr_config_pre, (struct event_loop * tm), (tm));
diff --git a/lib/vty.c b/lib/vty.c
index a8d90d901..a6b4de579 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -46,6 +46,8 @@
#include <arpa/telnet.h>
#include <termios.h>
+#include "lib/config_paths.h"
+
#include "lib/vty_clippy.c"
DEFINE_MTYPE_STATIC(LIB, VTY, "VTY");
diff --git a/lib/yang.c b/lib/yang.c
index ed855c849..b6884619d 100644
--- a/lib/yang.c
+++ b/lib/yang.c
@@ -13,6 +13,8 @@
#include "yang_translator.h"
#include "northbound.h"
+#include "lib/config_paths.h"
+
DEFINE_MTYPE_STATIC(LIB, YANG_MODULE, "YANG module");
DEFINE_MTYPE_STATIC(LIB, YANG_DATA, "YANG data structure");