diff options
author | Sven Eden <yamakuzure@gmx.net> | 2018-08-21 08:20:36 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-08-24 16:47:08 +0200 |
commit | fe9f813b914df4d0451f8e7b12eca0408db625bf (patch) | |
tree | 63a2281034efe71508dd12cdcaa5f70d3731c23a /src/shared | |
parent | cf380e653e9ff12805ef32041118fe3c1b9fbd55 (diff) |
Prep v239: Add support for the new 'suspend-then-hibernate' method.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/bus-util.c | 6 | ||||
-rw-r--r-- | src/shared/sleep-config.c | 12 | ||||
-rw-r--r-- | src/shared/sleep-config.h | 4 |
3 files changed, 16 insertions, 6 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index b33a7272d..c3be78769 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -1302,16 +1302,18 @@ int bus_connect_transport(BusTransport transport, const char *host, bool user, s #if 0 /// elogind does not support a user bus if (user) r = sd_bus_default_user(&bus); -#endif // 0 else { if (sd_booted() <= 0) { /* Print a friendly message when the local system is actually not running systemd as PID 1. */ - log_error("System has not been booted with elogind as init system (PID 1). Can't operate."); + log_error("System has not been booted with systemd as init system (PID 1). Can't operate."); return -EHOSTDOWN; } +#endif // 0 r = sd_bus_default_system(&bus); +#if 0 /// No closing bracket with elogind... Ain't we simple? ;-) } +#endif // 0 break; case BUS_TRANSPORT_REMOTE: diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index 3cb917358..1d7d46ac1 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -378,11 +378,19 @@ static bool can_s2h(Manager *m) { #if 0 /// elogind has to ask the manager for some stuff int can_sleep(const char *verb) { + _cleanup_strv_free_ char **modes = NULL, **states = NULL; + int r; #else int can_sleep(Manager *m, const char *verb) { + assert(m); + + char **modes = streq(verb, "suspend") ? m->suspend_mode : + streq(verb, "hibernate") ? m->hibernate_mode : + m->hybrid_sleep_mode; + char **states = streq(verb, "suspend") ? m->suspend_state : + streq(verb, "hibernate") ? m->hibernate_state : + m->hybrid_sleep_state; #endif // 0 - _cleanup_strv_free_ char **modes = NULL, **states = NULL; - int r; assert(STR_IN_SET(verb, "suspend", "hibernate", "hybrid-sleep", "suspend-then-hibernate")); diff --git a/src/shared/sleep-config.h b/src/shared/sleep-config.h index 026849cb8..b29165143 100644 --- a/src/shared/sleep-config.h +++ b/src/shared/sleep-config.h @@ -10,11 +10,11 @@ int parse_sleep_config(const char *verb, char ***modes, char ***states, usec_t * #endif // 0 int find_hibernate_location(char **device, char **type, size_t *size, size_t *used); -#if 0 /// UNNEEDED by elogind +#if 0 /// elogind has to transport its manager instance int can_sleep(const char *verb); int can_sleep_disk(char **types); int can_sleep_state(char **types); #else #include <logind.h> -int can_sleep(Manager* m, const char *verb); +int can_sleep(Manager *m, const char *verb); #endif // 0 |