From 9f42e56fc5968fcb34edfad017adb73960c2bb61 Mon Sep 17 00:00:00 2001 From: Samuel Mendoza-Jonas Date: Tue, 9 Aug 2016 16:01:49 +1000 Subject: Use 'consoles' instead of 'tty' to refer to interfaces 'Console' is more readily understandable and technically more correct than 'tty' for referring to the interfaces that Petitboot starts a UI on. Signed-off-by: Samuel Mendoza-Jonas --- discover/boot.c | 12 ++++++------ discover/boot.h | 2 +- discover/platform-powerpc.c | 28 ++++++++++++++-------------- discover/platform.c | 8 ++++---- 4 files changed, 25 insertions(+), 25 deletions(-) (limited to 'discover') diff --git a/discover/boot.c b/discover/boot.c index c25627d..0732a50 100644 --- a/discover/boot.c +++ b/discover/boot.c @@ -220,7 +220,7 @@ static void boot_hook_setenv(struct boot_task *task) unsetenv("boot_initrd"); unsetenv("boot_dtb"); unsetenv("boot_args"); - unsetenv("boot_tty"); + unsetenv("boot_console"); setenv("boot_image", task->local_image, 1); if (task->local_initrd) @@ -229,8 +229,8 @@ static void boot_hook_setenv(struct boot_task *task) setenv("boot_dtb", task->local_dtb, 1); if (task->args) setenv("boot_args", task->args, 1); - if (task->boot_tty) - setenv("boot_tty", task->boot_tty, 1); + if (task->boot_console) + setenv("boot_console", task->boot_console, 1); } static int hook_filter(const struct dirent *dirent) @@ -574,11 +574,11 @@ struct boot_task *boot(void *ctx, struct discover_boot_option *opt, boot_task->args = NULL; } - if (cmd && cmd->tty) - boot_task->boot_tty = talloc_strdup(boot_task, cmd->tty); + if (cmd && cmd->console) + boot_task->boot_console = talloc_strdup(boot_task, cmd->console); else { config = config_get(); - boot_task->boot_tty = config ? config->boot_tty : NULL; + boot_task->boot_console = config ? config->boot_console : NULL; } if (boot_task->verify_signature || boot_task->decrypt_files) { diff --git a/discover/boot.h b/discover/boot.h index 2d99b7f..0f27341 100644 --- a/discover/boot.h +++ b/discover/boot.h @@ -26,7 +26,7 @@ struct boot_task { char *local_initrd_override; char *local_dtb_override; const char *args; - const char *boot_tty; + const char *boot_console; boot_status_fn status_fn; void *status_arg; bool dry_run; diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c index 2b89121..57618c3 100644 --- a/discover/platform-powerpc.c +++ b/discover/platform-powerpc.c @@ -569,7 +569,7 @@ static void populate_config(struct platform_powerpc *platform, val = get_param(platform, "petitboot,tty"); if (val) - config->boot_tty = talloc_strdup(config, val); + config->boot_console = talloc_strdup(config, val); } static char *iface_config_str(void *ctx, struct interface_config *config) @@ -746,7 +746,7 @@ static int update_config(struct platform_powerpc *platform, val = config->allow_writes ? "true" : "false"; update_string_config(platform, "petitboot,write?", val); - val = config->boot_tty ?: ""; + val = config->boot_console ?: ""; update_string_config(platform, "petitboot,tty", val); update_network_config(platform, config); @@ -1239,32 +1239,32 @@ static void get_active_consoles(struct config *config) struct stat sbuf; char *fsp_prop = NULL; - config->n_tty = 2; - config->tty_list = talloc_array(config, char *, config->n_tty); - if (!config->tty_list) + config->n_consoles = 2; + config->consoles = talloc_array(config, char *, config->n_consoles); + if (!config->consoles) goto err; - config->tty_list[0] = talloc_asprintf(config->tty_list, + config->consoles[0] = talloc_asprintf(config->consoles, "/dev/hvc0 [IPMI / Serial]"); - config->tty_list[1] = talloc_asprintf(config->tty_list, + config->consoles[1] = talloc_asprintf(config->consoles, "/dev/tty1 [VGA]"); fsp_prop = talloc_asprintf(config, "%sfsps", devtree_dir); if (stat(fsp_prop, &sbuf) == 0) { /* FSP based machines also have a separate serial console */ - config->tty_list = talloc_realloc(config, config->tty_list, - char *, config->n_tty + 1); - if (!config->tty_list) + config->consoles = talloc_realloc(config, config->consoles, + char *, config->n_consoles + 1); + if (!config->consoles) goto err; - config->tty_list[config->n_tty++] = talloc_asprintf( - config->tty_list, + config->consoles[config->n_consoles++] = talloc_asprintf( + config->consoles, "/dev/hvc1 [Serial]"); } return; err: - config->n_tty = 0; - pb_log("Failed to allocate memory for tty_list\n"); + config->n_consoles = 0; + pb_log("Failed to allocate memory for consoles\n"); } static int load_config(struct platform *p, struct config *config) diff --git a/discover/platform.c b/discover/platform.c index 254da97..95a905d 100644 --- a/discover/platform.c +++ b/discover/platform.c @@ -83,7 +83,7 @@ static void dump_config(struct config *config) config->allow_writes ? "yes" : "no"); pb_log(" Default UI to boot on: %s\n", - config->boot_tty ?: "none set"); + config->boot_console ?: "none set"); pb_log(" language: %s\n", config->lang ?: ""); @@ -123,9 +123,9 @@ void config_set_defaults(struct config *config) config->allow_writes = true; config->disable_snapshots = false; - config->n_tty = 0; - config->tty_list = NULL; - config->boot_tty = NULL; + config->n_consoles = 0; + config->consoles = NULL; + config->boot_console = NULL; config->n_autoboot_opts = 2; config->autoboot_opts = talloc_array(config, struct autoboot_option, -- cgit v1.2.1