summaryrefslogtreecommitdiffstats
path: root/ui/common/discover-client.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-05-01 09:09:39 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-05-06 09:02:12 +0800
commite793a9b5a07a677c1d9d33f4757b67c25dbf2eed (patch)
treefba1b35b801f7938dd1573b4f7a82dcb57e93a25 /ui/common/discover-client.c
parent6b87c9c7776796c766e3dcbdb32f5d292f7125d5 (diff)
downloadtalos-petitboot-e793a9b5a07a677c1d9d33f4757b67c25dbf2eed.tar.gz
talos-petitboot-e793a9b5a07a677c1d9d33f4757b67c25dbf2eed.zip
ui: Receive boot status messages
Add support in the discover client code to handle boot status messages, and pass them to the UI thorugh a new callback ("update_status") in the client_ops. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui/common/discover-client.c')
-rw-r--r--ui/common/discover-client.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ui/common/discover-client.c b/ui/common/discover-client.c
index 42aa9de..a40bfda 100644
--- a/ui/common/discover-client.c
+++ b/ui/common/discover-client.c
@@ -110,10 +110,19 @@ static void device_remove(struct discover_client *client, const char *id)
talloc_free(device);
}
+static void update_status(struct discover_client *client,
+ struct boot_status *status)
+{
+ if (client->ops.update_status)
+ client->ops.update_status(status, client->ops.cb_arg);
+ talloc_free(status);
+}
+
static int discover_client_process(void *arg)
{
struct discover_client *client = arg;
struct pb_protocol_message *message;
+ struct boot_status *status;
struct boot_option *opt;
struct device *dev;
char *dev_id;
@@ -156,6 +165,16 @@ static int discover_client_process(void *arg)
}
device_remove(client, dev_id);
break;
+ case PB_PROTOCOL_ACTION_STATUS:
+ status = talloc_zero(client, struct boot_status);
+
+ rc = pb_protocol_deserialise_boot_status(status, message);
+ if (rc) {
+ pb_log("%s: invalid status message?\n", __func__);
+ return 0;
+ }
+ update_status(client, status);
+ break;
default:
pb_log("%s: unknown action %d\n", __func__, message->action);
}
OpenPOWER on IntegriCloud