summaryrefslogtreecommitdiffstats
path: root/discover/discover-server.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-05-21 14:16:35 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-06-24 12:52:50 +0800
commit2723662cabd4d34d4155ab5d6668c591a20a086b (patch)
tree66b5fe222d9dd30d7713923b6693b842b4d56d0d /discover/discover-server.c
parent4a78c9a5327cad94a2c23b9bff8edcd77fb54fa9 (diff)
downloadtalos-petitboot-2723662cabd4d34d4155ab5d6668c591a20a086b.tar.gz
talos-petitboot-2723662cabd4d34d4155ab5d6668c591a20a086b.zip
discover: Add "cancel default boot" messages
Allow the default boot process to be cancelled, via a message with action PB_PROTOCOL_ACTION_CANCEL_DEFAULT. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/discover-server.c')
-rw-r--r--discover/discover-server.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/discover/discover-server.c b/discover/discover-server.c
index 67ce266..29816ee 100644
--- a/discover/discover-server.c
+++ b/discover/discover-server.c
@@ -182,20 +182,30 @@ static int discover_server_process_message(void *arg)
}
- if (message->action != PB_PROTOCOL_ACTION_BOOT) {
- pb_log("%s: invalid action %d\n", __func__, message->action);
- return 0;
- }
+ switch (message->action) {
+ case PB_PROTOCOL_ACTION_BOOT:
+ boot_command = talloc(client, struct boot_command);
+
+ rc = pb_protocol_deserialise_boot_command(boot_command,
+ message);
+ if (rc) {
+ pb_log("%s: no boot command?", __func__);
+ return 0;
+ }
+
+ device_handler_boot(client->server->device_handler,
+ boot_command);
+ break;
- boot_command = talloc(client, struct boot_command);
+ case PB_PROTOCOL_ACTION_CANCEL_DEFAULT:
+ device_handler_cancel_default(client->server->device_handler);
+ break;
- rc = pb_protocol_deserialise_boot_command(boot_command, message);
- if (rc) {
- pb_log("%s: no boot command?", __func__);
+ default:
+ pb_log("%s: invalid action %d\n", __func__, message->action);
return 0;
}
- device_handler_boot(client->server->device_handler, boot_command);
return 0;
}
OpenPOWER on IntegriCloud