Commit 67445f4e authored by Zbigniew Jędrzejewski-Szmek's avatar Zbigniew Jędrzejewski-Szmek
Browse files

core: move ManagerRunningAs to shared

Note: I did s/MANAGER/SYSTEMD/ everywhere, even though it makes the
patch quite verbose. Nevertheless, keeping MANAGER prefix in some
places, and SYSTEMD prefix in others would just lead to confusion down
the road. Better to rip off the band-aid now.
parent e872b43c
......@@ -19,9 +19,6 @@ Bugfixes:
* properly handle .mount unit state tracking when two mount points are stacked one on top of another on the exact same mount point.
* we pull src/core/manager.h into src/shared/src/shared/path-lookup.c which is the wrong direction
rename enum "ManagerRunningAs" to "SystemdRunningAs" and move it to shared/
F18:
* https://bugzilla.gnome.org/show_bug.cgi?id=680689
......
......@@ -156,7 +156,7 @@ static int automount_add_default_dependencies(Automount *a) {
assert(a);
if (UNIT(a)->manager->running_as != MANAGER_SYSTEM)
if (UNIT(a)->manager->running_as != SYSTEMD_SYSTEM)
return 0;
r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true);
......
......@@ -313,7 +313,7 @@ int manager_setup_cgroup(Manager *m) {
goto finish;
}
if (m->running_as == MANAGER_SYSTEM)
if (m->running_as == SYSTEMD_SYSTEM)
strcpy(suffix, "/system");
else {
snprintf(suffix, sizeof(suffix), "/systemd-%lu", (unsigned long) getpid());
......
......@@ -1100,7 +1100,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
} else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "Exit")) {
if (m->running_as == MANAGER_SYSTEM) {
if (m->running_as == SYSTEMD_SYSTEM) {
dbus_set_error(&error, BUS_ERROR_NOT_SUPPORTED, "Exit is only supported for user service managers.");
return bus_send_error_reply(connection, message, &error, -ENOTSUP);
}
......@@ -1112,7 +1112,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
} else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "Reboot")) {
if (m->running_as != MANAGER_SYSTEM) {
if (m->running_as != SYSTEMD_SYSTEM) {
dbus_set_error(&error, BUS_ERROR_NOT_SUPPORTED, "Reboot is only supported for system managers.");
return bus_send_error_reply(connection, message, &error, -ENOTSUP);
}
......@@ -1124,7 +1124,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
} else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "PowerOff")) {
if (m->running_as != MANAGER_SYSTEM) {
if (m->running_as != SYSTEMD_SYSTEM) {
dbus_set_error(&error, BUS_ERROR_NOT_SUPPORTED, "Powering off is only supported for system managers.");
return bus_send_error_reply(connection, message, &error, -ENOTSUP);
}
......@@ -1136,7 +1136,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
} else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "Halt")) {
if (m->running_as != MANAGER_SYSTEM) {
if (m->running_as != SYSTEMD_SYSTEM) {
dbus_set_error(&error, BUS_ERROR_NOT_SUPPORTED, "Halting is only supported for system managers.");
return bus_send_error_reply(connection, message, &error, -ENOTSUP);
}
......@@ -1148,7 +1148,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
} else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "KExec")) {
if (m->running_as != MANAGER_SYSTEM) {
if (m->running_as != SYSTEMD_SYSTEM) {
dbus_set_error(&error, BUS_ERROR_NOT_SUPPORTED, "kexec is only supported for system managers.");
return bus_send_error_reply(connection, message, &error, -ENOTSUP);
}
......@@ -1177,7 +1177,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
if (!isempty(switch_root_init) && !path_is_absolute(switch_root_init))
return bus_send_error_reply(connection, message, NULL, -EINVAL);
if (m->running_as != MANAGER_SYSTEM) {
if (m->running_as != SYSTEMD_SYSTEM) {
dbus_set_error(&error, BUS_ERROR_NOT_SUPPORTED, "Switching root is only supported for system managers.");
return bus_send_error_reply(connection, message, &error, -ENOTSUP);
}
......@@ -1335,7 +1335,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
if (!h)
goto oom;
r = unit_file_get_list(m->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, NULL, h);
r = unit_file_get_list(m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, NULL, h);
if (r < 0) {
unit_file_list_free(h);
dbus_message_unref(reply);
......@@ -1381,7 +1381,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
DBUS_TYPE_INVALID))
return bus_send_error_reply(connection, message, &error, -EINVAL);
state = unit_file_get_state(m->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, NULL, name);
state = unit_file_get_state(m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, NULL, name);
if (state < 0)
return bus_send_error_reply(connection, message, NULL, state);
......@@ -1405,7 +1405,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
char **l = NULL;
DBusMessageIter iter;
UnitFileScope scope = m->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
UnitFileScope scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
UnitFileChange *changes = NULL;
unsigned n_changes = 0;
dbus_bool_t runtime, force;
......@@ -1464,7 +1464,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
char **l = NULL;
DBusMessageIter iter;
UnitFileScope scope = m->running_as == MANAGER_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
UnitFileScope scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
UnitFileChange *changes = NULL;
unsigned n_changes = 0;
dbus_bool_t runtime;
......
......@@ -445,7 +445,7 @@ static DBusHandlerResult system_bus_message_filter(DBusConnection *connection, D
log_debug("System D-Bus connection terminated.");
bus_done_system(m);
} else if (m->running_as != MANAGER_SYSTEM &&
} else if (m->running_as != SYSTEMD_SYSTEM &&
dbus_message_is_signal(message, "org.freedesktop.systemd1.Agent", "Released")) {
const char *cgroup;
......@@ -481,7 +481,7 @@ static DBusHandlerResult private_bus_message_filter(DBusConnection *connection,
if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected"))
shutdown_connection(m, connection);
else if (m->running_as == MANAGER_SYSTEM &&
else if (m->running_as == SYSTEMD_SYSTEM &&
dbus_message_is_signal(message, "org.freedesktop.systemd1.Agent", "Released")) {
const char *cgroup;
......@@ -776,7 +776,7 @@ static int init_registered_system_bus(Manager *m) {
if (!dbus_connection_add_filter(m->system_bus, system_bus_message_filter, m, NULL))
return log_oom();
if (m->running_as != MANAGER_SYSTEM) {
if (m->running_as != SYSTEMD_SYSTEM) {
DBusError error;
dbus_error_init(&error);
......@@ -838,7 +838,7 @@ static int init_registered_api_bus(Manager *m) {
if (r < 0)
return r;
if (m->running_as == MANAGER_USER) {
if (m->running_as == SYSTEMD_USER) {
char *id;
log_debug("Successfully connected to API D-Bus bus %s as %s",
strnull((id = dbus_connection_get_server_id(m->api_bus))),
......@@ -889,7 +889,7 @@ static void bus_register_cb(DBusPendingCall *pending, void *userdata) {
if (conn == &m->system_bus) {
r = init_registered_system_bus(m);
if (r == 0 && m->running_as == MANAGER_SYSTEM)
if (r == 0 && m->running_as == SYSTEMD_SYSTEM)
r = init_registered_api_bus(m);
} else
r = init_registered_api_bus(m);
......@@ -1019,7 +1019,7 @@ static int bus_init_api(Manager *m) {
if (m->api_bus)
return 0;
if (m->running_as == MANAGER_SYSTEM) {
if (m->running_as == SYSTEMD_SYSTEM) {
m->api_bus = m->system_bus;
/* In this mode there is no distinct connection to the API bus,
* the API is published on the system bus.
......@@ -1066,7 +1066,7 @@ static int bus_init_private(Manager *m) {
if (m->private_bus)
return 0;
if (m->running_as == MANAGER_SYSTEM) {
if (m->running_as == SYSTEMD_SYSTEM) {
/* We want the private bus only when running as init */
if (getpid() != 1)
......@@ -1190,7 +1190,7 @@ static void shutdown_connection(Manager *m, DBusConnection *c) {
dbus_connection_set_dispatch_status_function(c, NULL, NULL, NULL);
/* system manager cannot afford to block on DBus */
if (m->running_as != MANAGER_SYSTEM)
if (m->running_as != SYSTEMD_SYSTEM)
dbus_connection_flush(c);
dbus_connection_close(c);
dbus_connection_unref(c);
......@@ -1200,7 +1200,7 @@ static void bus_done_api(Manager *m) {
if (!m->api_bus)
return;
if (m->running_as == MANAGER_USER)
if (m->running_as == SYSTEMD_USER)
shutdown_connection(m, m->api_bus);
m->api_bus = NULL;
......@@ -1215,7 +1215,7 @@ static void bus_done_system(Manager *m) {
if (!m->system_bus)
return;
if (m->running_as == MANAGER_SYSTEM)
if (m->running_as == SYSTEMD_SYSTEM)
bus_done_api(m);
shutdown_connection(m, m->system_bus);
......@@ -1362,11 +1362,11 @@ int bus_broadcast(Manager *m, DBusMessage *message) {
assert(message);
SET_FOREACH(c, m->bus_connections_for_dispatch, i)
if (c != m->system_bus || m->running_as == MANAGER_SYSTEM)
if (c != m->system_bus || m->running_as == SYSTEMD_SYSTEM)
oom = !dbus_connection_send(c, message, NULL);
SET_FOREACH(c, m->bus_connections, i)
if (c != m->system_bus || m->running_as == MANAGER_SYSTEM)
if (c != m->system_bus || m->running_as == SYSTEMD_SYSTEM)
oom = !dbus_connection_send(c, message, NULL);
return oom ? -ENOMEM : 0;
......
......@@ -73,7 +73,7 @@ static enum {
} arg_action = ACTION_RUN;
static char *arg_default_unit = NULL;
static ManagerRunningAs arg_running_as = _MANAGER_RUNNING_AS_INVALID;
static SystemdRunningAs arg_running_as = _SYSTEMD_RUNNING_AS_INVALID;
static bool arg_dump_core = true;
static bool arg_crash_shell = false;
......@@ -684,7 +684,7 @@ static int parse_config_file(void) {
const char *fn;
int r;
fn = arg_running_as == MANAGER_SYSTEM ? SYSTEM_CONFIG_FILE : USER_CONFIG_FILE;
fn = arg_running_as == SYSTEMD_SYSTEM ? SYSTEM_CONFIG_FILE : USER_CONFIG_FILE;
f = fopen(fn, "re");
if (!f) {
if (errno == ENOENT)
......@@ -872,11 +872,11 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_SYSTEM:
arg_running_as = MANAGER_SYSTEM;
arg_running_as = SYSTEMD_SYSTEM;
break;
case ARG_USER:
arg_running_as = MANAGER_USER;
arg_running_as = SYSTEMD_USER;
break;
case ARG_TEST:
......@@ -1289,7 +1289,7 @@ int main(int argc, char *argv[]) {
if (getpid() == 1 && detect_container(NULL) <= 0) {
/* Running outside of a container as PID 1 */
arg_running_as = MANAGER_SYSTEM;
arg_running_as = SYSTEMD_SYSTEM;
make_null_stdio();
log_set_target(LOG_TARGET_KMSG);
log_open();
......@@ -1349,7 +1349,7 @@ int main(int argc, char *argv[]) {
} else if (getpid() == 1) {
/* Running inside a container, as PID 1 */
arg_running_as = MANAGER_SYSTEM;
arg_running_as = SYSTEMD_SYSTEM;
log_set_target(LOG_TARGET_CONSOLE);
log_open();
......@@ -1359,7 +1359,7 @@ int main(int argc, char *argv[]) {
} else {
/* Running as user instance */
arg_running_as = MANAGER_USER;
arg_running_as = SYSTEMD_USER;
log_set_target(LOG_TARGET_AUTO);
log_open();
}
......@@ -1400,7 +1400,7 @@ int main(int argc, char *argv[]) {
if (parse_config_file() < 0)
goto finish;
if (arg_running_as == MANAGER_SYSTEM)
if (arg_running_as == SYSTEMD_SYSTEM)
if (parse_proc_cmdline() < 0)
goto finish;
......@@ -1414,7 +1414,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
if (arg_running_as == MANAGER_SYSTEM &&
if (arg_running_as == SYSTEMD_SYSTEM &&
arg_action == ACTION_RUN &&
running_in_chroot() > 0) {
log_error("Cannot be run in a chroot() environment.");
......@@ -1460,9 +1460,9 @@ int main(int argc, char *argv[]) {
#else
"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin",
#endif
arg_running_as == MANAGER_SYSTEM);
arg_running_as == SYSTEMD_SYSTEM);
if (arg_running_as == MANAGER_SYSTEM) {
if (arg_running_as == SYSTEMD_SYSTEM) {
/* Parse the data passed to us. We leave this
* variables set, but the manager later on will not
* pass them on to our children. */
......@@ -1493,7 +1493,7 @@ int main(int argc, char *argv[]) {
/* Move out of the way, so that we won't block unmounts */
assert_se(chdir("/") == 0);
if (arg_running_as == MANAGER_SYSTEM) {
if (arg_running_as == SYSTEMD_SYSTEM) {
/* Become a session leader if we aren't one yet. */
setsid();
......@@ -1506,7 +1506,7 @@ int main(int argc, char *argv[]) {
/* Reset the console, but only if this is really init and we
* are freshly booted */
if (arg_running_as == MANAGER_SYSTEM && arg_action == ACTION_RUN)
if (arg_running_as == SYSTEMD_SYSTEM && arg_action == ACTION_RUN)
console_setup(getpid() == 1 && !skip_setup);
/* Open the logging devices, if possible and necessary */
......@@ -1523,7 +1523,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
if (arg_running_as == MANAGER_SYSTEM) {
if (arg_running_as == SYSTEMD_SYSTEM) {
const char *virtualization = NULL;
log_info(PACKAGE_STRING " running in system mode. (" SYSTEMD_FEATURES "; " DISTRIBUTION ")");
......@@ -1538,7 +1538,7 @@ int main(int argc, char *argv[]) {
} else
log_debug(PACKAGE_STRING " running in user mode. (" SYSTEMD_FEATURES "; " DISTRIBUTION ")");
if (arg_running_as == MANAGER_SYSTEM && !skip_setup) {
if (arg_running_as == SYSTEMD_SYSTEM && !skip_setup) {
locale_setup();
if (arg_show_status || plymouth_running())
......@@ -1554,7 +1554,7 @@ int main(int argc, char *argv[]) {
test_cgroups();
}
if (arg_running_as == MANAGER_SYSTEM && arg_runtime_watchdog > 0)
if (arg_running_as == SYSTEMD_SYSTEM && arg_runtime_watchdog > 0)
watchdog_set_timeout(&arg_runtime_watchdog);
if (arg_timer_slack_nsec != (nsec_t) -1)
......@@ -1574,7 +1574,7 @@ int main(int argc, char *argv[]) {
}
}
if (arg_running_as == MANAGER_USER) {
if (arg_running_as == SYSTEMD_USER) {
/* Become reaper of our children */
if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0) {
log_warning("Failed to make us a subreaper: %m");
......@@ -1583,7 +1583,7 @@ int main(int argc, char *argv[]) {
}
}
if (arg_running_as == MANAGER_SYSTEM)
if (arg_running_as == SYSTEMD_SYSTEM)
bump_rlimit_nofile(&saved_rlimit_nofile);
r = manager_new(arg_running_as, &m);
......@@ -1822,7 +1822,7 @@ finish:
args[i++] = SYSTEMD_BINARY_PATH;
if (switch_root_dir)
args[i++] = "--switched-root";
args[i++] = arg_running_as == MANAGER_SYSTEM ? "--system" : "--user";
args[i++] = arg_running_as == SYSTEMD_SYSTEM ? "--system" : "--user";
args[i++] = "--deserialize";
args[i++] = sfd;
args[i++] = NULL;
......
......@@ -216,7 +216,7 @@ static int manager_setup_signals(Manager *m) {
if (epoll_ctl(m->epoll_fd, EPOLL_CTL_ADD, m->signal_watch.fd, &ev) < 0)
return -errno;
if (m->running_as == MANAGER_SYSTEM)
if (m->running_as == SYSTEMD_SYSTEM)
return enable_special_signals(m);
return 0;
......@@ -237,13 +237,13 @@ static void manager_strip_environment(Manager *m) {
strv_remove_prefix(m->environment, "RD_");
}
int manager_new(ManagerRunningAs running_as, Manager **_m) {
int manager_new(SystemdRunningAs running_as, Manager **_m) {
Manager *m;
int r = -ENOMEM;
assert(_m);
assert(running_as >= 0);
assert(running_as < _MANAGER_RUNNING_AS_MAX);
assert(running_as < _SYSTEMD_RUNNING_AS_MAX);
m = new0(Manager, 1);
if (!m)
......@@ -270,7 +270,7 @@ int manager_new(ManagerRunningAs running_as, Manager **_m) {
manager_strip_environment(m);
if (running_as == MANAGER_SYSTEM) {
if (running_as == SYSTEMD_SYSTEM) {
m->default_controllers = strv_new("cpu", NULL);
if (!m->default_controllers)
goto fail;
......@@ -304,7 +304,7 @@ int manager_new(ManagerRunningAs running_as, Manager **_m) {
goto fail;
/* Try to connect to the busses, if possible. */
if ((r = bus_init(m, running_as != MANAGER_SYSTEM)) < 0)
if ((r = bus_init(m, running_as != SYSTEMD_SYSTEM)) < 0)
goto fail;
#ifdef HAVE_AUDIT
......@@ -1145,7 +1145,7 @@ static int manager_process_signal_fd(Manager *m) {
break;
case SIGTERM:
if (m->running_as == MANAGER_SYSTEM) {
if (m->running_as == SYSTEMD_SYSTEM) {
/* This is for compatibility with the
* original sysvinit */
m->exit_code = MANAGER_REEXECUTE;
......@@ -1155,7 +1155,7 @@ static int manager_process_signal_fd(Manager *m) {
/* Fall through */
case SIGINT:
if (m->running_as == MANAGER_SYSTEM) {
if (m->running_as == SYSTEMD_SYSTEM) {
manager_start_target(m, SPECIAL_CTRL_ALT_DEL_TARGET, JOB_REPLACE);
break;
}
......@@ -1169,14 +1169,14 @@ static int manager_process_signal_fd(Manager *m) {
break;
case SIGWINCH:
if (m->running_as == MANAGER_SYSTEM)
if (m->running_as == SYSTEMD_SYSTEM)
manager_start_target(m, SPECIAL_KBREQUEST_TARGET, JOB_REPLACE);
/* This is a nop on non-init */
break;
case SIGPWR:
if (m->running_as == MANAGER_SYSTEM)
if (m->running_as == SYSTEMD_SYSTEM)
manager_start_target(m, SPECIAL_SIGPWR_TARGET, JOB_REPLACE);
/* This is a nop on non-init */
......@@ -1440,7 +1440,7 @@ int manager_loop(Manager *m) {
int n;
int wait_msec = -1;
if (m->runtime_watchdog > 0 && m->running_as == MANAGER_SYSTEM)
if (m->runtime_watchdog > 0 && m->running_as == SYSTEMD_SYSTEM)
watchdog_ping();
if (!ratelimit_test(&rl)) {
......@@ -1472,7 +1472,7 @@ int manager_loop(Manager *m) {
continue;
/* Sleep for half the watchdog time */
if (m->runtime_watchdog > 0 && m->running_as == MANAGER_SYSTEM) {
if (m->runtime_watchdog > 0 && m->running_as == SYSTEMD_SYSTEM) {
wait_msec = (int) (m->runtime_watchdog / 2 / USEC_PER_MSEC);
if (wait_msec <= 0)
wait_msec = 1;
......@@ -1562,7 +1562,7 @@ void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success) {
if (m->n_reloading > 0)
return;
if (m->running_as != MANAGER_SYSTEM)
if (m->running_as != SYSTEMD_SYSTEM)
return;
if (u->type != UNIT_SERVICE)
......@@ -1599,7 +1599,7 @@ void manager_send_unit_plymouth(Manager *m, Unit *u) {
if (m->n_reloading > 0)
return;
if (m->running_as != MANAGER_SYSTEM)
if (m->running_as != SYSTEMD_SYSTEM)
return;
if (u->type != UNIT_SERVICE &&
......@@ -1698,7 +1698,7 @@ int manager_open_serialization(Manager *m, FILE **_f) {
assert(_f);
if (m->running_as == MANAGER_SYSTEM)
if (m->running_as == SYSTEMD_SYSTEM)
asprintf(&path, "/run/systemd/dump-%lu-XXXXXX", (unsigned long) getpid());
else
asprintf(&path, "/tmp/systemd-dump-%lu-XXXXXX", (unsigned long) getpid());
......@@ -2035,7 +2035,7 @@ void manager_check_finished(Manager *m) {
dual_timestamp_get(&m->finish_timestamp);
if (m->running_as == MANAGER_SYSTEM && detect_container(NULL) <= 0) {
if (m->running_as == SYSTEMD_SYSTEM && detect_container(NULL) <= 0) {
/* Note that m->kernel_usec.monotonic is always at 0,
* and m->firmware_usec.monotonic and
......@@ -2110,7 +2110,7 @@ static int create_generator_dir(Manager *m, char **generator, const char *name)
if (*generator)
return 0;
if (m->running_as == MANAGER_SYSTEM && getpid() == 1) {
if (m->running_as == SYSTEMD_SYSTEM && getpid() == 1) {
p = strappend("/run/systemd/", name);
if (!p)
......@@ -2162,7 +2162,7 @@ void manager_run_generators(Manager *m) {
assert(m);
generator_path = m->running_as == MANAGER_SYSTEM ? SYSTEM_GENERATOR_PATH : USER_GENERATOR_PATH;
generator_path = m->running_as == SYSTEMD_SYSTEM ? SYSTEM_GENERATOR_PATH : USER_GENERATOR_PATH;
d = opendir(generator_path);
if (!d) {
if (errno == ENOENT)
......@@ -2264,7 +2264,7 @@ void manager_recheck_journal(Manager *m) {
assert(m);
if (m->running_as != MANAGER_SYSTEM)
if (m->running_as != SYSTEMD_SYSTEM)
return;
u = manager_get_unit(m, SPECIAL_JOURNALD_SOCKET);
......@@ -2287,7 +2287,7 @@ void manager_recheck_journal(Manager *m) {
void manager_set_show_status(Manager *m, bool b) {
assert(m);
if (m->running_as != MANAGER_SYSTEM)
if (m->running_as != SYSTEMD_SYSTEM)
return;
m->show_status = b;
......@@ -2301,7 +2301,7 @@ void manager_set_show_status(Manager *m, bool b) {
bool manager_get_show_status(Manager *m) {
assert(m);
if (m->running_as != MANAGER_SYSTEM)
if (m->running_as != SYSTEMD_SYSTEM)
return false;
if (m->show_status)
......@@ -2312,10 +2312,3 @@ bool manager_get_show_status(Manager *m) {
return plymouth_running();
}
static const char* const manager_running_as_table[_MANAGER_RUNNING_AS_MAX] = {
[MANAGER_SYSTEM] = "system",
[MANAGER_USER] = "user"
};
DEFINE_STRING_TABLE_LOOKUP(manager_running_as, ManagerRunningAs);
......@@ -49,13 +49,6 @@ typedef enum ManagerExitCode {
_MANAGER_EXIT_CODE_INVALID = -1
} ManagerExitCode;
typedef enum ManagerRunningAs {
MANAGER_SYSTEM,
MANAGER_USER,
_MANAGER_RUNNING_AS_MAX,
_MANAGER_RUNNING_AS_INVALID = -1
} ManagerRunningAs;
enum WatchType {
WATCH_INVALID,
WATCH_SIGNAL,
......@@ -213,7 +206,7 @@ struct Manager {
#endif
/* Flags */
ManagerRunningAs running_as;
SystemdRunningAs running_as;
ManagerExitCode exit_code:5;
bool dispatching_load_queue:1;
......@@ -242,7 +235,7 @@ struct Manager {
char *switch_root_init;
};
int manager_new(ManagerRunningAs running_as, Manager **m);
int manager_new(SystemdRunningAs running_as, Manager **m);
void manager_free(Manager *m);
int manager_enumerate(Manager *m);
......@@ -303,6 +296,3 @@ void manager_recheck_journal(Manager *m);
void manager_set_show_status(Manager *m, bool b);
bool manager_get_show_status(Manager *m);
const char *manager_running_as_to_string(ManagerRunningAs i);
ManagerRunningAs manager_running_as_from_string(const char *s);
......@@ -362,7 +362,7 @@ static int mount_add_device_links(Mount *m) {
if (p->passno > 0 &&
!mount_is_bind(p) &&
!path_equal(m->where, "/") &&
UNIT(m)->manager->running_as == MANAGER_SYSTEM) {
UNIT(m)->manager->running_as == SYSTEMD_SYSTEM) {
char *name;
Unit *fsck;
/* Let's add in the fsck service */
......@@ -396,7 +396,7 @@ static int mount_add_quota_links(Mount *m) {
assert(m);
if (UNIT(m)->manager->running_as != MANAGER_SYSTEM)
if (UNIT(m)->manager->running_as != SYSTEMD_SYSTEM)
return 0;
p = get_mount_parameters_fragment(m);
......@@ -424,7 +424,7 @@ static int mount_add_default_dependencies(Mount *m) {
assert(m);
if (UNIT(m)->manager->running_as != MANAGER_SYSTEM)
if (UNIT(m)->manager->running_as != SYSTEMD_SYSTEM)
return 0;
p = get_mount_parameters_fragment(m);
......
......@@ -316,7 +316,7 @@ static int path_add_default_dependencies(Path *p) {
assert(p);
if (UNIT(p)->manager->running_as == MANAGER_SYSTEM) {
if (UNIT(p)->manager->running_as == SYSTEMD_SYSTEM) {
if ((r = unit_add_dependency_by_name(UNIT(p), UNIT_BEFORE, SPECIAL_BASIC_TARGET, NULL, true)) < 0)
return r;
......