[systemd-commits] 2 commits - man/systemd.unit.xml src/core src/shared

Zbigniew Jędrzejewski-Szmek zbyszek at kemper.freedesktop.org
Thu Oct 2 08:12:19 PDT 2014


 man/systemd.unit.xml     |    5 +++++
 src/core/unit.c          |    4 ++--
 src/shared/install.c     |    2 +-
 src/shared/path-lookup.c |   20 ++++++++++----------
 src/shared/path-lookup.h |    2 +-
 5 files changed, 19 insertions(+), 14 deletions(-)

New commits:
commit aa08982d62cf45b59ea6a06c915391f5db1fb86e
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Oct 2 08:11:21 2014 -0400

    Fix order and document user unit dirs
    
    Fixup for 718880ba0d 'add a transient user unit directory'.

diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
index 67d46ed..ec7ca56 100644
--- a/man/systemd.unit.xml
+++ b/man/systemd.unit.xml
@@ -73,6 +73,7 @@
                 <para><literallayout><filename>$XDG_CONFIG_HOME/systemd/user/*</filename>
 <filename>$HOME/.config/systemd/user/*</filename>
 <filename>/etc/systemd/user/*</filename>
+<filename>$XDG_RUNTIME_DIR/systemd/user/*</filename>
 <filename>/run/systemd/user/*</filename>
 <filename>$XDG_DATA_HOME/systemd/user/*</filename>
 <filename>$HOME/.local/share/systemd/user/*</filename>
@@ -344,6 +345,10 @@
                         <entry>Local configuration</entry>
                       </row>
                       <row>
+                        <entry><filename>$XDG_RUNTIME_DIR/systemd/user</filename></entry>
+                        <entry>Runtime units (only used when $XDG_RUNTIME_DIR is set)</entry>
+                      </row>
+                      <row>
                         <entry><filename>/run/systemd/user</filename></entry>
                         <entry>Runtime units</entry>
                       </row>
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index d7ed6e9..8f75a8e 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -162,18 +162,18 @@ static char** user_dirs(
                 if (strv_extend(&r, config_home) < 0)
                         goto fail;
 
-        if (runtime_dir)
-                if (strv_extend(&r, runtime_dir) < 0)
+        if (!strv_isempty(config_dirs))
+                if (strv_extend_strv_concat(&r, config_dirs, "/systemd/user") < 0)
                         goto fail;
 
-        if (strv_extend(&r, runtime_unit_path) < 0)
+        if (strv_extend_strv(&r, (char**) config_unit_paths) < 0)
                 goto fail;
 
-        if (!strv_isempty(config_dirs))
-                if (strv_extend_strv_concat(&r, config_dirs, "/systemd/user") < 0)
+        if (runtime_dir)
+                if (strv_extend(&r, runtime_dir) < 0)
                         goto fail;
 
-        if (strv_extend_strv(&r, (char**) config_unit_paths) < 0)
+        if (strv_extend(&r, runtime_unit_path) < 0)
                 goto fail;
 
         if (generator)

commit 4d5dec2389d8e6ce78b45d3058220888f4a93db7
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Oct 2 08:01:00 2014 -0400

    Rename user_runtime to user_runtime_dir
    
    This makes this function name similar to user_config_home() and makes
    it match the name of the environment variable.

diff --git a/src/core/unit.c b/src/core/unit.c
index 8a7df01..399d202 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -3083,7 +3083,7 @@ static int unit_drop_in_dir(Unit *u, UnitSetPropertiesMode mode, bool transient,
                 if (mode == UNIT_PERSISTENT && !transient)
                         r = user_config_home(dir);
                 else
-                        r = user_runtime(dir);
+                        r = user_runtime_dir(dir);
 
                 if (r == 0)
                         return -ENOENT;
@@ -3232,7 +3232,7 @@ int unit_make_transient(Unit *u) {
         if (u->manager->running_as == SYSTEMD_USER) {
                 _cleanup_free_ char *c = NULL;
 
-                r = user_runtime(&c);
+                r = user_runtime_dir(&c);
                 if (r < 0)
                         return r;
                 if (r == 0)
diff --git a/src/shared/install.c b/src/shared/install.c
index 302b523..fa064c2 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -109,7 +109,7 @@ static int get_config_path(UnitFileScope scope, bool runtime, const char *root_d
                         return -EINVAL;
 
                 if (runtime)
-                        r = user_runtime(&p);
+                        r = user_runtime_dir(&p);
                 else
                         r = user_config_home(&p);
 
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index 3a6e117..d7ed6e9 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -61,7 +61,7 @@ int user_config_home(char **config_home) {
         return 0;
 }
 
-int user_runtime(char **user_runtime_path) {
+int user_runtime_dir(char **runtime_dir) {
         const char *e;
         char *r;
 
@@ -71,7 +71,7 @@ int user_runtime(char **user_runtime_path) {
                 if (!r)
                         return -ENOMEM;
 
-                *user_runtime_path = r;
+                *runtime_dir = r;
                 return 1;
         }
 
@@ -101,7 +101,7 @@ static char** user_dirs(
         };
 
         const char *home, *e;
-        _cleanup_free_ char *config_home = NULL, *user_runtime_dir = NULL, *data_home = NULL;
+        _cleanup_free_ char *config_home = NULL, *runtime_dir = NULL, *data_home = NULL;
         _cleanup_strv_free_ char **config_dirs = NULL, **data_dirs = NULL;
         char **r = NULL;
 
@@ -117,7 +117,7 @@ static char** user_dirs(
         if (user_config_home(&config_home) < 0)
                 goto fail;
 
-        if (user_runtime(&user_runtime_dir) < 0)
+        if (user_runtime_dir(&runtime_dir) < 0)
                 goto fail;
 
         home = getenv("HOME");
@@ -162,8 +162,8 @@ static char** user_dirs(
                 if (strv_extend(&r, config_home) < 0)
                         goto fail;
 
-        if (user_runtime_dir)
-                if (strv_extend(&r, user_runtime_dir) < 0)
+        if (runtime_dir)
+                if (strv_extend(&r, runtime_dir) < 0)
                         goto fail;
 
         if (strv_extend(&r, runtime_unit_path) < 0)
diff --git a/src/shared/path-lookup.h b/src/shared/path-lookup.h
index 8da076a..b8a0aac 100644
--- a/src/shared/path-lookup.h
+++ b/src/shared/path-lookup.h
@@ -39,7 +39,7 @@ typedef enum SystemdRunningAs {
 } SystemdRunningAs;
 
 int user_config_home(char **config_home);
-int user_runtime(char **user_runtime_path);
+int user_runtime_dir(char **runtime_dir);
 
 int lookup_paths_init(LookupPaths *p,
                       SystemdRunningAs running_as,



More information about the systemd-commits mailing list