[Suspend2][ 02/21] [Suspend2] Modify action state.

From: Nigel Cunningham
Date: Tue Jun 27 2006 - 00:52:53 EST


Modify the suspend_action state in response to a userspace message. This
variable is an unsigned long treated as bitflags tell us whether to reboot
instead of powering down, pause between step, log everything and so on.

Signed-off-by: Nigel Cunningham <nigel@xxxxxxxxxxxx>

kernel/power/ui.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/kernel/power/ui.c b/kernel/power/ui.c
index 1ef8957..b952bf7 100644
--- a/kernel/power/ui.c
+++ b/kernel/power/ui.c
@@ -67,3 +67,19 @@ static int progress_granularity = 30;

DECLARE_WAIT_QUEUE_HEAD(userui_wait_for_key);

+static void ui_nl_set_state(int n)
+{
+ /* Only let them change certain settings */
+ static const int suspend_action_mask =
+ (1 << SUSPEND_REBOOT) | (1 << SUSPEND_PAUSE) | (1 << SUSPEND_SLOW) |
+ (1 << SUSPEND_LOGALL) | (1 << SUSPEND_SINGLESTEP) |
+ (1 << SUSPEND_PAUSE_NEAR_PAGESET_END);
+
+ suspend_action = (suspend_action & (~suspend_action_mask)) |
+ (n & suspend_action_mask);
+
+ if (!test_action_state(SUSPEND_PAUSE) &&
+ !test_action_state(SUSPEND_SINGLESTEP))
+ wake_up_interruptible(&userui_wait_for_key);
+}
+

--
Nigel Cunningham nigel at suspend2 dot net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/