[systemd-commits] src/binfmt src/core src/journal src/modules-load src/shared src/sysctl src/timedate src/tmpfiles src/udev

Kay Sievers kay at kemper.freedesktop.org
Fri Feb 8 01:32:07 PST 2013


 src/binfmt/binfmt.c             |    2 +-
 src/core/load-dropin.c          |    2 +-
 src/journal/catalog.c           |    2 +-
 src/modules-load/modules-load.c |    2 +-
 src/shared/conf-files.c         |   10 +++++-----
 src/shared/conf-files.h         |    4 ++--
 src/shared/install.c            |    4 ++--
 src/sysctl/sysctl.c             |    2 +-
 src/timedate/timedated.c        |    2 +-
 src/tmpfiles/tmpfiles.c         |    2 +-
 src/udev/udev-rules.c           |    2 +-
 src/udev/udevadm-hwdb.c         |    2 +-
 12 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 7850b3b83791ba0e2377ba40383c5abc258b839d
Author: Kay Sievers <kay at vrfy.org>
Date:   Fri Feb 8 10:22:02 2013 +0100

    shared: conf-files - add root parameter

diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
index 788fd4b..296607d 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 52ebfea..95c9a38 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 3735ad9..32256f6 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 f6279e1..936aaed 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 34b8629..368b7bf 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 f37ee1f..4d7941f 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 b82d189..2555a36 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 035e0ec..f5ef89b 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 f5430e9..b8c6b36 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 c2023f5..96adbff 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 bb57d2a..a86f8c3 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 8e515b9..596a89b 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;



More information about the systemd-commits mailing list