]> git.ozlabs.org Git - petitboot/blobdiff - discover/discover-server.c
discover: Add "cancel default boot" messages
[petitboot] / discover / discover-server.c
index 67ce266c4c433fced328f810360094cd8e60f10f..29816ee6a3614d4ad4500b2b7d31307e43fb19dd 100644 (file)
@@ -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;
 }