--- /dev/null
+
+#include "boot.h"
+
+int boot(void *ctx, struct boot_option *opt, struct boot_command *cmd,
+ int dry_run)
+{
+ /* todo: run kexec with options from opt & cmd */
+ (void)ctx;
+ (void)opt;
+ (void)cmd;
+ (void)dry_run;
+
+ return 0;
+}
--- /dev/null
+#ifndef _BOOT_H
+#define _BOOT_H
+
+struct boot_option;
+struct boot_command;
+
+int boot(void *ctx, struct boot_option *opt, struct boot_command *cmd,
+ int dry_run);
+
+#endif /* _BOOT_H */
#include "parser.h"
#include "udev.h"
#include "paths.h"
+#include "boot.h"
struct device_handler {
struct discover_server *server;
{
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);
+}
struct device_handler;
struct discover_server;
+struct boot_command;
struct event;
struct device;
int device_handler_event(struct device_handler *handler, struct event *event);
+void device_handler_boot(struct device_handler *handler,
+ struct boot_command *cmd);
+
#endif /* _DEVICE_HANDLER_H */