diff options
author | Kay Sievers <kay@vrfy.org> | 2013-02-08 10:22:02 +0100 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2013-02-08 10:23:04 +0100 |
commit | 7850b3b83791ba0e2377ba40383c5abc258b839d (patch) | |
tree | 2d4630e93d854d4af19c4d0b1f3f6eee32fe0627 | |
parent | 0b9cc004a4dd20b32459615dd1ab98ba27202095 (diff) |
shared: conf-files - add root parameter
-rw-r--r-- | src/binfmt/binfmt.c | 2 | ||||
-rw-r--r-- | src/core/load-dropin.c | 2 | ||||
-rw-r--r-- | src/journal/catalog.c | 2 | ||||
-rw-r--r-- | src/modules-load/modules-load.c | 2 | ||||
-rw-r--r-- | src/shared/conf-files.c | 10 | ||||
-rw-r--r-- | src/shared/conf-files.h | 4 | ||||
-rw-r--r-- | src/shared/install.c | 4 | ||||
-rw-r--r-- | src/sysctl/sysctl.c | 2 | ||||
-rw-r--r-- | src/timedate/timedated.c | 2 | ||||
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 2 | ||||
-rw-r--r-- | src/udev/udev-rules.c | 2 | ||||
-rw-r--r-- | src/udev/udevadm-hwdb.c | 2 |
12 files changed, 18 insertions, 18 deletions
diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c index 788fd4b1a4..296607d6a2 100644 --- a/src/binfmt/binfmt.c +++ b/src/binfmt/binfmt.c @@ -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", diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c index 52ebfea6dc..95c9a386ca 100644 --- a/src/core/load-dropin.c +++ b/src/core/load-dropin.c @@ -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; diff --git a/src/journal/catalog.c b/src/journal/catalog.c index 3735ad9213..32256f6263 100644 --- a/src/journal/catalog.c +++ b/src/journal/catalog.c @@ -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; diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c index f6279e1975..936aaed8e4 100644 --- a/src/modules-load/modules-load.c +++ b/src/modules-load/modules-load.c @@ -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", diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c index 34b86293d3..368b7bf6bb 100644 --- a/src/shared/conf-files.c +++ b/src/shared/conf-files.c @@ -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); diff --git a/src/shared/conf-files.h b/src/shared/conf-files.h index f37ee1f3db..4d7941f4cb 100644 --- a/src/shared/conf-files.h +++ b/src/shared/conf-files.h @@ -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 diff --git a/src/shared/install.c b/src/shared/install.c index b82d1891dd..2555a36c0a 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -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", diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c index 035e0ec321..f5ef89b385 100644 --- a/src/sysctl/sysctl.c +++ b/src/sysctl/sysctl.c @@ -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", diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c index f5430e9f78..b8c6b36858 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c @@ -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", diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index c2023f5454..96adbff42e 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -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; diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index bb57d2af48..a86f8c365a 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -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); diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index 8e515b9f71..596a89b640 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -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; |