summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/install.c2
-rw-r--r--src/shared/path-lookup.c14
-rw-r--r--src/shared/path-lookup.h12
3 files changed, 22 insertions, 6 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index c6215fbb32..f30bf8317b 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -59,7 +59,7 @@ static int lookup_paths_init_from_scope(LookupPaths *paths, UnitFileScope scope)
zero(*paths);
return lookup_paths_init(paths,
- scope == UNIT_FILE_SYSTEM ? MANAGER_SYSTEM : MANAGER_USER,
+ scope == UNIT_FILE_SYSTEM ? SYSTEMD_SYSTEM : SYSTEMD_USER,
scope == UNIT_FILE_USER,
NULL, NULL, NULL);
}
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index a9c3e21d51..6e5529e0c7 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -22,6 +22,7 @@
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <unistd.h>
#include <errno.h>
@@ -31,6 +32,13 @@
#include "path-util.h"
#include "path-lookup.h"
+static const char* const systemd_running_as_table[_SYSTEMD_RUNNING_AS_MAX] = {
+ [SYSTEMD_SYSTEM] = "system",
+ [SYSTEMD_USER] = "user"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(systemd_running_as, SystemdRunningAs);
+
int user_config_home(char **config_home) {
const char *e;
@@ -224,7 +232,7 @@ fail:
int lookup_paths_init(
LookupPaths *p,
- ManagerRunningAs running_as,
+ SystemdRunningAs running_as,
bool personal,
const char *generator,
const char *generator_early,
@@ -256,7 +264,7 @@ int lookup_paths_init(
* for the system stuff but avoid it for user
* stuff. */
- if (running_as == MANAGER_USER) {
+ if (running_as == SYSTEMD_USER) {
if (personal)
p->unit_path = user_dirs(generator, generator_early, generator_late);
@@ -323,7 +331,7 @@ int lookup_paths_init(
p->unit_path = NULL;
}
- if (running_as == MANAGER_SYSTEM) {
+ if (running_as == SYSTEMD_SYSTEM) {
#ifdef HAVE_SYSV_COMPAT
/* /etc/init.d/ compatibility does not matter to users */
diff --git a/src/shared/path-lookup.h b/src/shared/path-lookup.h
index 0aab956f25..baef62228a 100644
--- a/src/shared/path-lookup.h
+++ b/src/shared/path-lookup.h
@@ -29,9 +29,17 @@ typedef struct LookupPaths {
#endif
} LookupPaths;
-#include "manager.h"
+typedef enum SystemdRunningAs {
+ SYSTEMD_SYSTEM,
+ SYSTEMD_USER,
+ _SYSTEMD_RUNNING_AS_MAX,
+ _SYSTEMD_RUNNING_AS_INVALID = -1
+} SystemdRunningAs;
+
+const char* systemd_running_as_to_string(SystemdRunningAs i);
+SystemdRunningAs systemd_running_as_from_string(const char *s);
int user_config_home(char **config_home);
-int lookup_paths_init(LookupPaths *p, ManagerRunningAs running_as, bool personal, const char *generator, const char *generator_early, const char *generator_late);
+int lookup_paths_init(LookupPaths *p, SystemdRunningAs running_as, bool personal, const char *generator, const char *generator_early, const char *generator_late);
void lookup_paths_free(LookupPaths *p);