summaryrefslogtreecommitdiffstats
path: root/ui/ncurses
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-02-27 16:45:21 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-04-15 15:42:27 +0800
commitc62667e5c78ea212e5ac49244e9792954a1d8f71 (patch)
tree4206cfff1ddd26ad16e279b065fdf41c00664bb6 /ui/ncurses
parentb8122dc9340e2f208220f0c88b4d71f91b78774f (diff)
downloadtalos-petitboot-c62667e5c78ea212e5ac49244e9792954a1d8f71.tar.gz
talos-petitboot-c62667e5c78ea212e5ac49244e9792954a1d8f71.zip
Move boot to discover server
This change moves the boot-via-kexec functionality from the UIs to the discover server. On the UI side: rather than run kexec directly, we just send a message to the discover server. Because this is generic discover client functionality, we no longer need the boot callbacks in the twin- and ncurses-specific code. We also remove the kexec and URL-loading code from the UIs, and add it to the discover server code, in paths.c. We expose this to the server though a new function: load_path(void *, const char *, unsigned int *); On the server side, we simply move hook up the boot() function to use the load_file and kexec calls. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui/ncurses')
-rw-r--r--ui/ncurses/generic-main.c28
-rw-r--r--ui/ncurses/nc-cui.c12
-rw-r--r--ui/ncurses/nc-cui.h1
3 files changed, 5 insertions, 36 deletions
diff --git a/ui/ncurses/generic-main.c b/ui/ncurses/generic-main.c
index 8cb876f..ddf0de3 100644
--- a/ui/ncurses/generic-main.c
+++ b/ui/ncurses/generic-main.c
@@ -131,31 +131,6 @@ struct pb_cui {
struct cui *cui;
};
-static struct pb_cui *pb_from_cui(struct cui *cui)
-{
- struct pb_cui *pb;
-
- assert(cui->c_sig == pb_cui_sig);
- pb = cui->platform_info;
- assert(pb->cui->c_sig == pb_cui_sig);
- return pb;
-}
-
-/**
- * pb_boot_cb - The kexec callback.
- */
-
-static int pb_boot_cb(struct cui *cui, struct cui_opt_data *cod)
-{
- struct pb_cui *pb = pb_from_cui(cui);
-
- pb_log("%s: %s\n", __func__, cod->name);
-
- assert(pb->cui->current == &pb->cui->main->scr);
-
- return pb_boot(cod->bd, pb->cui->dry_run);
-}
-
/**
* pb_mm_init - Setup the main menu instance.
*/
@@ -285,8 +260,7 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
- pb.cui = cui_init(&pb, pb_boot_cb, NULL, opts.start_daemon,
- opts.dry_run);
+ pb.cui = cui_init(&pb, NULL, opts.start_daemon, opts.dry_run);
if (!pb.cui)
return EXIT_FAILURE;
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
index b3fe451..fafa293 100644
--- a/ui/ncurses/nc-cui.c
+++ b/ui/ncurses/nc-cui.c
@@ -135,14 +135,13 @@ static int cui_boot(struct pmenu_item *item)
struct cui_opt_data *cod = cod_from_item(item);
assert(cui->current == &cui->main->scr);
- assert(cui->on_boot);
pb_log("%s: %s\n", __func__, cod->name);
nc_scr_status_printf(cui->current, "Booting %s...", cod->name);
def_prog_mode();
- result = cui->on_boot(cui, cod);
+ result = discover_client_boot(cui->client, cod->dev, cod->opt, cod->bd);
reset_prog_mode();
redrawwin(cui->current->main_ncw);
@@ -151,12 +150,11 @@ static int cui_boot(struct pmenu_item *item)
clear();
mvaddstr(1, 0, "system is going down now...");
refresh();
- sleep(cui->dry_run ? 1 : 60);
+ } else {
+ nc_scr_status_printf(cui->current,
+ "Failed: boot %s", cod->bd->image);
}
- pb_log("%s: failed: %s\n", __func__, cod->bd->image);
- nc_scr_status_printf(cui->current, "Failed: kexec %s", cod->bd->image);
-
return 0;
}
@@ -522,7 +520,6 @@ static struct discover_client_ops cui_client_ops = {
*/
struct cui *cui_init(void* platform_info,
- int (*on_boot)(struct cui *, struct cui_opt_data *),
int (*js_map)(const struct js_event *e), int start_deamon, int dry_run)
{
struct cui *cui;
@@ -538,7 +535,6 @@ struct cui *cui_init(void* platform_info,
cui->c_sig = pb_cui_sig;
cui->platform_info = platform_info;
- cui->on_boot = on_boot;
cui->timer.handle_timeout = cui_handle_timeout;
cui->dry_run = dry_run;
cui->waitset = waitset_create(cui);
diff --git a/ui/ncurses/nc-cui.h b/ui/ncurses/nc-cui.h
index 14e4e06..33f2661 100644
--- a/ui/ncurses/nc-cui.h
+++ b/ui/ncurses/nc-cui.h
@@ -64,7 +64,6 @@ struct cui {
};
struct cui *cui_init(void* platform_info,
- int (*on_boot)(struct cui *, struct cui_opt_data *),
int (*js_map)(const struct js_event *e), int start_deamon, int dry_run);
struct nc_scr *cui_set_current(struct cui *cui, struct nc_scr *scr);
int cui_run(struct cui *cui, struct pmenu *main, unsigned int default_item);
OpenPOWER on IntegriCloud