[Suspend2][ 12/13] [Suspend2] Suspend2 common header.

Nigel Cunningham
2006-06-27T04:44:28Z

Declarations used by virtually all of the Suspend2 files, but which are not
needed externally. That is, debugging and result set/clear macros and the
enum for the result codes.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

kernel/power/suspend2_common.h | 45 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/kernel/power/suspend2_common.h b/kernel/power/suspend2_common.h
new file mode 100644
index 0000000..455250e
--- /dev/null
+++ b/kernel/power/suspend2_common.h
@@ -0,0 +1,45 @@
+/*
+ * kernel/power/suspend2_common.h
+ *
+ * Copyright (C) 2005-2006 Nigel Cunningham <nigel@suspend2.net>
+ *
+ * This file is released under the GPLv2.
+ *
+ * Routines for talking to a userspace program that manages storage.
+ *
+ * The kernel side:
+ * - starts the userspace program;
+ * - sends messages telling it when to open and close the connection;
+ * - tells it when to quit;
+ *
+ * The user space side:
+ * - passes messages regarding status;
+ *
+ */
+
+#ifdef CONFIG_PM_DEBUG
+#define set_debug_state(bit) (test_and_set_bit(bit, &suspend_debug_state))
+#define clear_debug_state(bit) (test_and_clear_bit(bit, &suspend_debug_state))
+#else
+#define set_debug_state(bit) (0)
+#define clear_debug_state(bit) (0)
+#endif
+
+#define set_result_state(bit) (test_and_set_bit(bit, &suspend_result))
+#define clear_result_state(bit) (test_and_clear_bit(bit, &suspend_result))
+
+enum {
+ SUSPEND_ABORT_REQUESTED = 1,
+ SUSPEND_NOSTORAGE_AVAILABLE,
+ SUSPEND_INSUFFICIENT_STORAGE,
+ SUSPEND_FREEZING_FAILED,
+ SUSPEND_UNEXPECTED_ALLOC,
+ SUSPEND_KEPT_IMAGE,
+ SUSPEND_WOULD_EAT_MEMORY,
+ SUSPEND_UNABLE_TO_FREE_ENOUGH_MEMORY,
+ SUSPEND_ENCRYPTION_SETUP_FAILED,
+ SUSPEND_PM_SEM,
+};
+
+extern unsigned int nr_suspends;
+extern char resume2_file[256];