sd-path: export "systemd-network-path"

Inspired by https://lists.freedesktop.org/archives/systemd-devel/2020-March/044169.html.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-03-24 17:12:45 +01:00
parent b0c8219260
commit f1bb691a5a
5 changed files with 14 additions and 1 deletions

View file

@ -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>

View file

@ -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")

View file

@ -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;
}

View file

@ -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) {

View file

@ -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,
};