1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 08:26:52 +03:00

shared: conf-files - add root parameter

This commit is contained in:
Kay Sievers 2013-02-08 10:22:02 +01:00
parent 0b9cc004a4
commit 7850b3b837
12 changed files with 18 additions and 18 deletions

View File

@ -138,7 +138,7 @@ int main(int argc, char *argv[]) {
} else {
char **files, **f;
r = conf_files_list(&files, ".conf",
r = conf_files_list(&files, ".conf", NULL,
"/etc/binfmt.d",
"/run/binfmt.d",
"/usr/local/lib/binfmt.d",

View File

@ -171,7 +171,7 @@ int unit_load_dropin(Unit *u) {
_cleanup_strv_free_ char **files = NULL;
char **f;
r = conf_files_list_strv(&files, ".conf", (const char**) strv);
r = conf_files_list_strv(&files, ".conf", NULL, (const char**) strv);
if (r < 0) {
log_error("Failed to get list of configuration files: %s", strerror(-r));
return r;

View File

@ -296,7 +296,7 @@ int catalog_update(void) {
goto finish;
}
r = conf_files_list_strv(&files, ".catalog", (const char **) conf_file_dirs);
r = conf_files_list_strv(&files, ".catalog", NULL, (const char **) conf_file_dirs);
if (r < 0) {
log_error("Failed to get catalog files: %s", strerror(-r));
goto finish;

View File

@ -198,7 +198,7 @@ int main(int argc, char *argv[]) {
r = EXIT_FAILURE;
}
k = conf_files_list(&files, ".conf",
k = conf_files_list(&files, ".conf", NULL,
"/etc/modules-load.d",
"/run/modules-load.d",
"/usr/local/lib/modules-load.d",

View File

@ -37,7 +37,7 @@
#include "hashmap.h"
#include "conf-files.h"
static int files_add(Hashmap *h, const char *path, const char *suffix) {
static int files_add(Hashmap *h, const char *root, const char *path, const char *suffix) {
DIR *dir;
int r = 0;
@ -90,7 +90,7 @@ static int base_cmp(const void *a, const void *b) {
return strcmp(path_get_file_name(s1), path_get_file_name(s2));
}
int conf_files_list_strv(char ***strv, const char *suffix, const char **dirs) {
int conf_files_list_strv(char ***strv, const char *suffix, const char *root, const char **dirs) {
Hashmap *fh = NULL;
char **files = NULL;
const char **p;
@ -105,7 +105,7 @@ int conf_files_list_strv(char ***strv, const char *suffix, const char **dirs) {
}
STRV_FOREACH(p, dirs) {
r = files_add(fh, *p, suffix);
r = files_add(fh, root, *p, suffix);
if (r < 0)
log_warning("Failed to search for files in %s: %s",
*p, strerror(-r));
@ -126,7 +126,7 @@ finish:
return r;
}
int conf_files_list(char ***strv, const char *suffix, const char *dir, ...) {
int conf_files_list(char ***strv, const char *suffix, const char *root, const char *dir, ...) {
char **dirs = NULL;
va_list ap;
int r;
@ -145,7 +145,7 @@ int conf_files_list(char ***strv, const char *suffix, const char *dir, ...) {
}
strv_uniq(dirs);
r = conf_files_list_strv(strv, suffix, (const char **)dirs);
r = conf_files_list_strv(strv, suffix, root, (const char **)dirs);
finish:
strv_free(dirs);

View File

@ -25,7 +25,7 @@
#include "macro.h"
int conf_files_list(char ***strv, const char *suffix, const char *dir, ...);
int conf_files_list_strv(char ***strv, const char *suffix, const char **dirs);
int conf_files_list(char ***strv, const char *suffix, const char *root, const char *dir, ...);
int conf_files_list_strv(char ***strv, const char *suffix, const char *root, const char **dirs);
#endif

View File

@ -1658,7 +1658,7 @@ int unit_file_query_preset(UnitFileScope scope, const char *name) {
assert(name);
if (scope == UNIT_FILE_SYSTEM)
r = conf_files_list(&files, ".preset",
r = conf_files_list(&files, ".preset", NULL,
"/etc/systemd/system-preset",
"/usr/local/lib/systemd/system-preset",
"/usr/lib/systemd/system-preset",
@ -1667,7 +1667,7 @@ int unit_file_query_preset(UnitFileScope scope, const char *name) {
#endif
NULL);
else if (scope == UNIT_FILE_GLOBAL)
r = conf_files_list(&files, ".preset",
r = conf_files_list(&files, ".preset", NULL,
"/etc/systemd/user-preset",
"/usr/local/lib/systemd/user-preset",
"/usr/lib/systemd/user-preset",

View File

@ -289,7 +289,7 @@ int main(int argc, char *argv[]) {
} else {
char **files, **f;
r = conf_files_list(&files, ".conf",
r = conf_files_list(&files, ".conf", NULL,
"/etc/sysctl.d",
"/run/sysctl.d",
"/usr/local/lib/sysctl.d",

View File

@ -280,7 +280,7 @@ static char** get_ntp_services(void) {
char **r = NULL, **files, **i;
int k;
k = conf_files_list(&files, ".list",
k = conf_files_list(&files, ".list", NULL,
"/etc/systemd/ntp-units.d",
"/run/systemd/ntp-units.d",
"/usr/local/lib/systemd/ntp-units.d",

View File

@ -1435,7 +1435,7 @@ int main(int argc, char *argv[]) {
} else {
char **files, **f;
r = conf_files_list_strv(&files, ".conf", (const char **)conf_file_dirs);
r = conf_files_list_strv(&files, ".conf", NULL, (const char **)conf_file_dirs);
if (r < 0) {
log_error("Failed to enumerate tmpfiles.d files: %s", strerror(-r));
r = EXIT_FAILURE;

View File

@ -1619,7 +1619,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names)
return udev_rules_unref(rules);
udev_rules_check_timestamp(rules);
r = conf_files_list_strv(&files, ".rules", (const char **)rules->dirs);
r = conf_files_list_strv(&files, ".rules", NULL, (const char **)rules->dirs);
if (r < 0) {
log_error("failed to enumerate rules files: %s\n", strerror(-r));
return udev_rules_unref(rules);

View File

@ -537,7 +537,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
}
trie->nodes_count++;
err = conf_files_list_strv(&files, ".hwdb", (const char **)conf_file_dirs);
err = conf_files_list_strv(&files, ".hwdb", NULL, (const char **)conf_file_dirs);
if (err < 0) {
log_error("failed to enumerate hwdb files: %s\n", strerror(-err));
rc = EXIT_FAILURE;