From 69ab80881552d5f79ca95f6b3be48ad122ab1ec2 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Fri, 13 Sep 2013 19:41:52 -0400 Subject: Advertise hibernation only if there's enough free swap Condition that is checked is taken from upower: active(anon) < free swap * 0.98 This is really stupid, because the kernel knows the situation better, e.g. there could be two swap files, and then hibernation would be impossible despite passing this check, or the kernel could start supporting compressed swap and/or compressed hibernation images, and then this this check would be too stringent. Nevertheless, until we have something better, this should at least return a true negative if there's no swap. Logging of capabilities in the journal is changed to not strip leading zeros. I consider this more readable anyway. http://cgit.freedesktop.org/upower/tree/src/up-daemon.c#n613 https://bugzilla.redhat.com/show_bug.cgi?id=1007059 --- src/test/test-sleep.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/test/test-sleep.c') diff --git a/src/test/test-sleep.c b/src/test/test-sleep.c index c3cb9c531d..545dfab92c 100644 --- a/src/test/test-sleep.c +++ b/src/test/test-sleep.c @@ -40,14 +40,14 @@ int main(int argc, char* argv[]) { **shutdown = strv_new("shutdown", NULL), **freez = strv_new("freeze", NULL); - log_info("Can Standby: %s", yes_no(can_sleep_state(standby) > 0)); - log_info("Can Suspend: %s", yes_no(can_sleep_state(mem) > 0)); - log_info("Can Hibernate: %s", yes_no(can_sleep_state(disk) > 0)); - log_info("Can Hibernate+Suspend (Hybrid-Sleep): %s", yes_no(can_sleep_disk(suspend) > 0)); - log_info("Can Hibernate+Reboot: %s", yes_no(can_sleep_disk(reboot) > 0)); - log_info("Can Hibernate+Platform: %s", yes_no(can_sleep_disk(platform) > 0)); - log_info("Can Hibernate+Shutdown: %s", yes_no(can_sleep_disk(shutdown) > 0)); - log_info("Can Freeze: %s", yes_no(can_sleep_disk(freez) > 0)); + log_info("Standby configured: %s", yes_no(can_sleep_state(standby) > 0)); + log_info("Suspend configured: %s", yes_no(can_sleep_state(mem) > 0)); + log_info("Hibernate configured: %s", yes_no(can_sleep_state(disk) > 0)); + log_info("Hibernate+Suspend (Hybrid-Sleep) configured: %s", yes_no(can_sleep_disk(suspend) > 0)); + log_info("Hibernate+Reboot configured: %s", yes_no(can_sleep_disk(reboot) > 0)); + log_info("Hibernate+Platform configured: %s", yes_no(can_sleep_disk(platform) > 0)); + log_info("Hibernate+Shutdown configured: %s", yes_no(can_sleep_disk(shutdown) > 0)); + log_info("Freeze configured: %s", yes_no(can_sleep_state(freez) > 0)); log_info("Suspend configured and possible: %s", yes_no(can_sleep("suspend") > 0)); log_info("Hibernation configured and possible: %s", yes_no(can_sleep("hibernate") > 0)); -- cgit v1.2.3-54-g00ecf