summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-03-24 17:12:45 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-03-27 20:12:45 +0100
commitf1bb691a5aaf9ab67236c5a801381a022a00dde9 (patch)
treedb562d241347db8c1c58d1865b8e75cd81df45a4
parentb0c82192604c2e21e7d1beab23855111a8213b60 (diff)
downloadsystemd-f1bb691a5aaf9ab67236c5a801381a022a00dde9.tar.gz
sd-path: export "systemd-network-path"
Inspired by https://lists.freedesktop.org/archives/systemd-devel/2020-March/044169.html.
-rw-r--r--man/sd_path_lookup.xml2
-rw-r--r--src/basic/path-lookup.h1
-rw-r--r--src/libsystemd/sd-path/sd-path.c7
-rw-r--r--src/path/path.c2
-rw-r--r--src/systemd/sd-path.h3
5 files changed, 14 insertions, 1 deletions
diff --git a/man/sd_path_lookup.xml b/man/sd_path_lookup.xml
index 81812bc003..35a1109af3 100644
--- a/man/sd_path_lookup.xml
+++ b/man/sd_path_lookup.xml
@@ -98,6 +98,8 @@
<constant>SD_PATH_BINFMT_DIR</constant>,
<constant>SD_PATH_MODULES_LOAD_DIR</constant>,
<constant>SD_PATH_CATALOG_DIR</constant>,
+
+ <constant>SD_PATH_SYSTEMD_NETWORK_PATH</constant>,
};</funcsynopsisinfo>
<funcprototype>
diff --git a/src/basic/path-lookup.h b/src/basic/path-lookup.h
index f67b8d416a..ae37f9feb9 100644
--- a/src/basic/path-lookup.h
+++ b/src/basic/path-lookup.h
@@ -71,3 +71,4 @@ char **generator_binary_paths(UnitFileScope scope);
char **env_generator_binary_paths(bool is_system);
#define NETWORK_DIRS ((const char* const*) CONF_PATHS_STRV("systemd/network"))
+#define NETWORK_DIRS_NULSTR CONF_PATHS_NULSTR("systemd/network")
diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c
index 4fd96fb5a2..2a9c04a84d 100644
--- a/src/libsystemd/sd-path/sd-path.c
+++ b/src/libsystemd/sd-path/sd-path.c
@@ -633,7 +633,12 @@ static int get_search(uint64_t type, char ***list) {
*list = t;
return 0;
- }}
+ }
+
+ case SD_PATH_SYSTEMD_NETWORK_PATH:
+ return strv_from_nulstr(list, NETWORK_DIRS_NULSTR);
+
+ }
return -EOPNOTSUPP;
}
diff --git a/src/path/path.c b/src/path/path.c
index aefdae1d51..20892fe1f2 100644
--- a/src/path/path.c
+++ b/src/path/path.c
@@ -81,6 +81,8 @@ static const char* const path_table[_SD_PATH_MAX] = {
[SD_PATH_BINFMT_DIR] = "binfmt-dir",
[SD_PATH_MODULES_LOAD_DIR] = "modules-load-dir",
[SD_PATH_CATALOG_DIR] = "catalog-dir",
+
+ [SD_PATH_SYSTEMD_NETWORK_PATH] = "systemd-network-path",
};
static int list_homes(void) {
diff --git a/src/systemd/sd-path.h b/src/systemd/sd-path.h
index 203f01dd90..7da7a9f814 100644
--- a/src/systemd/sd-path.h
+++ b/src/systemd/sd-path.h
@@ -102,6 +102,9 @@ enum {
SD_PATH_MODULES_LOAD_DIR,
SD_PATH_CATALOG_DIR,
+ /* systemd-networkd search paths */
+ SD_PATH_SYSTEMD_NETWORK_PATH,
+
_SD_PATH_MAX,
};