diff options
author | Andy Wingo <wingo@pobox.com> | 2015-08-29 11:20:59 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2015-08-29 11:25:06 +0200 |
commit | caa7531f137aeb260fbda53e89a22f516836e89b (patch) | |
tree | 221c1aab3b4fdd1aebfbcfe2c4802191a4fb6536 /src/login/logind-action.c | |
parent | d6e877564a5b7f2758291825fa7a2becb663a630 (diff) |
Incorporate sleep.conf into logind.conf
* src/login/logind-action.c (shutdown_or_sleep, do_sleep): Take modes
from the manager instead of parsing them ourselves.
* src/login/logind-dbus.c (execute_shutdown_or_sleep): Adapt to
shutdown_or_sleep prototype change.
* src/login/logind-gperf.gperf: Add config items from sleep.conf.
* src/login/logind.c (manager_new): Wire up defaults for new config
items.
(manager_free): Free new config items.
(manager_parse_config_file): Arrange to parse a single
elogind/logind.conf file, not grovelling all over the filesystem.
Take the file from the ELOGIND_CONF_FILE environment variable if
present.
Diffstat (limited to 'src/login/logind-action.c')
-rw-r--r-- | src/login/logind-action.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/login/logind-action.c b/src/login/logind-action.c index b0ff774df..d7b1538a3 100644 --- a/src/login/logind-action.c +++ b/src/login/logind-action.c @@ -223,8 +223,7 @@ static int write_state(FILE **f, char **states) { return r; } -static int do_sleep(const char *arg_verb) { - _cleanup_strv_free_ char **modes = NULL, **states = NULL; +static int do_sleep(const char *arg_verb, const char **modes, const char **states) { char *arguments[] = { NULL, (char*) "pre", @@ -235,10 +234,6 @@ static int do_sleep(const char *arg_verb) { int r; _cleanup_fclose_ FILE *f = NULL; - r = parse_sleep_config(arg_verb, &modes, &states); - if (r < 0) - return r; - /* This file is opened first, so that if we hit an error, * we can abort before modifying any state. */ f = fopen("/sys/power/state", "we"); @@ -274,7 +269,7 @@ static int do_sleep(const char *arg_verb) { return r; } -int shutdown_or_sleep(HandleAction action) { +int shutdown_or_sleep(Manager *m, HandleAction action) { switch (action) { case HANDLE_POWEROFF: return run_helper(HALT); @@ -285,11 +280,11 @@ int shutdown_or_sleep(HandleAction action) { case HANDLE_KEXEC: return run_helper(KEXEC); case HANDLE_SUSPEND: - return do_sleep("suspend"); + return do_sleep("suspend", m->suspend_mode, m->suspend_state); case HANDLE_HIBERNATE: - return do_sleep("hibernate"); + return do_sleep("hibernate", m->hibernate_mode, m->hibernate_state); case HANDLE_HYBRID_SLEEP: - return do_sleep("hybrid-sleep"); + return do_sleep("hybrid-sleep", m->hybrid_sleep_mode, m->hybrid_sleep_state); default: return -EINVAL; } |