chiark / gitweb /
path-lookup, systemctl: export lookup_paths_init_from_scope() from shared/install...
authorIvan Shapovalov <intelfx100@gmail.com>
Fri, 19 Dec 2014 14:08:07 +0000 (17:08 +0300)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 5 Jan 2015 16:13:30 +0000 (11:13 -0500)
src/shared/install.c
src/shared/path-lookup.c
src/shared/path-lookup.h
src/systemctl/systemctl.c

index 3b065445b071c6c42017ae863ca462246b3f0458..37191a7c71ae3d181096829f384179fe137ede14 100644 (file)
@@ -58,22 +58,6 @@ static int in_search_path(const char *path, char **search) {
         return strv_contains(search, parent);
 }
 
         return strv_contains(search, parent);
 }
 
-static int lookup_paths_init_from_scope(LookupPaths *paths,
-                                        UnitFileScope scope,
-                                        const char *root_dir) {
-        assert(paths);
-        assert(scope >= 0);
-        assert(scope < _UNIT_FILE_SCOPE_MAX);
-
-        zero(*paths);
-
-        return lookup_paths_init(paths,
-                                 scope == UNIT_FILE_SYSTEM ? SYSTEMD_SYSTEM : SYSTEMD_USER,
-                                 scope == UNIT_FILE_USER,
-                                 root_dir,
-                                 NULL, NULL, NULL);
-}
-
 static int get_config_path(UnitFileScope scope, bool runtime, const char *root_dir, char **ret) {
         char *p = NULL;
         int r;
 static int get_config_path(UnitFileScope scope, bool runtime, const char *root_dir, char **ret) {
         char *p = NULL;
         int r;
index 8f75a8e83290db85540d544d82af45c4343e2852..051f1a4835c4ae99c90a0de6f34e62498f14306a 100644 (file)
@@ -398,3 +398,19 @@ void lookup_paths_free(LookupPaths *p) {
         p->sysvinit_path = p->sysvrcnd_path = NULL;
 #endif
 }
         p->sysvinit_path = p->sysvrcnd_path = NULL;
 #endif
 }
+
+int lookup_paths_init_from_scope(LookupPaths *paths,
+                                 UnitFileScope scope,
+                                 const char *root_dir) {
+        assert(paths);
+        assert(scope >= 0);
+        assert(scope < _UNIT_FILE_SCOPE_MAX);
+
+        zero(*paths);
+
+        return lookup_paths_init(paths,
+                                 scope == UNIT_FILE_SYSTEM ? SYSTEMD_SYSTEM : SYSTEMD_USER,
+                                 scope == UNIT_FILE_USER,
+                                 root_dir,
+                                 NULL, NULL, NULL);
+}
index b8a0aace83ad8c0a83e78a1c98233de9f5969d4b..655e4549ca9e5bb37b2fcb36ee5d0ba57c50e98d 100644 (file)
@@ -22,6 +22,7 @@
 ***/
 
 #include "macro.h"
 ***/
 
 #include "macro.h"
+#include "install.h"
 
 typedef struct LookupPaths {
         char **unit_path;
 
 typedef struct LookupPaths {
         char **unit_path;
@@ -49,5 +50,8 @@ int lookup_paths_init(LookupPaths *p,
                       const char *generator_early,
                       const char *generator_late);
 void lookup_paths_free(LookupPaths *p);
                       const char *generator_early,
                       const char *generator_late);
 void lookup_paths_free(LookupPaths *p);
+int lookup_paths_init_from_scope(LookupPaths *paths,
+                                 UnitFileScope scope,
+                                 const char *root_dir);
 
 #define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)
 
 #define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)
index 3d939f050b707722eb20a0017ec6a85522b9bba0..679541493a74abb5fd59d81b71d19bdbadf2cbbe 100644 (file)
@@ -4515,11 +4515,7 @@ static int init_home_and_lookup_paths(char **user_home, char **user_runtime, Loo
                         return log_error_errno(ENOTDIR, "Cannot find units: $XDG_RUNTIME_DIR is not set.");
         }
 
                         return log_error_errno(ENOTDIR, "Cannot find units: $XDG_RUNTIME_DIR is not set.");
         }
 
-        r = lookup_paths_init(lp,
-                              arg_scope == UNIT_FILE_SYSTEM ? SYSTEMD_SYSTEM : SYSTEMD_USER,
-                              arg_scope == UNIT_FILE_USER,
-                              arg_root,
-                              NULL, NULL, NULL);
+        r = lookup_paths_init_from_scope(lp, arg_scope, arg_root);
         if (r < 0)
                 return log_error_errno(r, "Failed to lookup unit lookup paths: %m");
 
         if (r < 0)
                 return log_error_errno(r, "Failed to lookup unit lookup paths: %m");