[Suspend2][ 08/13] [Suspend2] Userspace is ready!

From: Nigel Cunningham
Date: Tue Jun 27 2006 - 00:54:59 EST


Routine called when we are waiting for a userspace helper to start, and
receive a netlink message from it, saying it's ready to go. We check the
version for compatability, and if all looks good, call the completion
handler on the waiting code. If not, we complain bitterly and try to
continue without it.

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

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

diff --git a/kernel/power/netlink.c b/kernel/power/netlink.c
index 7f06f7c..9094c92 100644
--- a/kernel/power/netlink.c
+++ b/kernel/power/netlink.c
@@ -152,3 +152,22 @@ static int nl_set_nofreeze(struct user_h
return 0;
}

+/*
+ * Called when the userspace process has informed us that it's ready to roll.
+ */
+static int nl_ready(struct user_helper_data *uhd, int version)
+{
+ if (version != uhd->interface_version) {
+ printk("%s userspace process using invalid interface version."
+ " Trying to continue without it.\n",
+ uhd->name);
+ if (uhd->not_ready)
+ uhd->not_ready();
+ return 1;
+ }
+
+ complete(&uhd->wait_for_process);
+
+ return 0;
+}
+

--
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/