diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-03-06 17:14:58 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-04-15 15:42:27 +0800 |
commit | b8122dc9340e2f208220f0c88b4d71f91b78774f (patch) | |
tree | 9eaf0ab4357ef2153ec62b7cda241356037188e2 /discover/device-handler.c | |
parent | ceefe00bf8c1498dfc2118d2b3666f67f91bb956 (diff) | |
download | talos-petitboot-b8122dc9340e2f208220f0c88b4d71f91b78774f.tar.gz talos-petitboot-b8122dc9340e2f208220f0c88b4d71f91b78774f.zip |
discover: Implement device handler boot path
This change adds a funtion, device_handler_boot, which processes the
boot command message from the discover server.
We add a new file, discover/boot.c (and a corresponding header) with a
skeleton for the final kexec code.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/device-handler.c')
-rw-r--r-- | discover/device-handler.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/discover/device-handler.c b/discover/device-handler.c index 0d43496..6a27f15 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -19,6 +19,7 @@ #include "parser.h" #include "udev.h" #include "paths.h" +#include "boot.h" struct device_handler { struct discover_server *server; @@ -429,3 +430,30 @@ void device_handler_destroy(struct device_handler *handler) { talloc_free(handler); } + +static struct boot_option *find_boot_option_by_id( + struct device_handler *handler, const char *id) +{ + unsigned int i; + + for (i = 0; i < handler->n_devices; i++) { + struct device *dev = handler->devices[i]; + struct boot_option *opt; + + list_for_each_entry(&dev->boot_options, opt, list) + if (!strcmp(opt->id, id)) + return opt; + } + + return NULL; +} + +void device_handler_boot(struct device_handler *handler, + struct boot_command *cmd) +{ + struct boot_option *opt; + + opt = find_boot_option_by_id(handler, cmd->option_id); + + boot(handler, opt, cmd, 0); +} |