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 --- lib/pb-config/pb-config.c | 18 +++++++++--------- lib/pb-protocol/pb-protocol.c | 34 +++++++++++++++++----------------- lib/types/types.h | 8 ++++---- 3 files changed, 30 insertions(+), 30 deletions(-) (limited to 'lib') diff --git a/lib/pb-config/pb-config.c b/lib/pb-config/pb-config.c index 581d70f..86f14c9 100644 --- a/lib/pb-config/pb-config.c +++ b/lib/pb-config/pb-config.c @@ -83,15 +83,15 @@ struct config *config_copy(void *ctx, const struct config *src) dest->allow_writes = src->allow_writes; - dest->n_tty = src->n_tty; - if (src->tty_list) - dest->tty_list = talloc_array(dest, char *, src->n_tty); - for (i = 0; i < src->n_tty && src->n_tty; i++) - dest->tty_list[i] = talloc_strdup(dest->tty_list, - src->tty_list[i]); - - if (src->boot_tty) - dest->boot_tty = talloc_strdup(dest, src->boot_tty); + dest->n_consoles = src->n_consoles; + if (src->consoles) + dest->consoles = talloc_array(dest, char *, src->n_consoles); + for (i = 0; i < src->n_consoles && src->n_consoles; i++) + dest->consoles[i] = talloc_strdup(dest->consoles, + src->consoles[i]); + + if (src->boot_console) + dest->boot_console = talloc_strdup(dest, src->boot_console); if (src->lang && strlen(src->lang)) dest->lang = talloc_strdup(dest, src->lang); diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c index 706aec9..0d83bde 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -212,7 +212,7 @@ int pb_protocol_boot_len(const struct boot_command *boot) 4 + optional_strlen(boot->dtb_file) + 4 + optional_strlen(boot->boot_args) + 4 + optional_strlen(boot->args_sig_file) + - 4 + optional_strlen(boot->tty); + 4 + optional_strlen(boot->console); } int pb_protocol_boot_status_len(const struct boot_status *status) @@ -318,11 +318,11 @@ int pb_protocol_config_len(const struct config *config) len += 4; /* allow_writes */ - len += 4; /* n_tty */ - for (i = 0; i < config->n_tty; i++) - len += 4 + optional_strlen(config->tty_list[i]); + len += 4; /* n_consoles */ + for (i = 0; i < config->n_consoles; i++) + len += 4 + optional_strlen(config->consoles[i]); - len += 4 + optional_strlen(config->boot_tty); + len += 4 + optional_strlen(config->boot_console); len += 4 + optional_strlen(config->lang); @@ -389,7 +389,7 @@ int pb_protocol_serialise_boot_command(const struct boot_command *boot, pos += pb_protocol_serialise_string(pos, boot->dtb_file); pos += pb_protocol_serialise_string(pos, boot->boot_args); pos += pb_protocol_serialise_string(pos, boot->args_sig_file); - pos += pb_protocol_serialise_string(pos, boot->tty); + pos += pb_protocol_serialise_string(pos, boot->console); assert(pos <= buf + buf_len); (void)buf_len; @@ -573,12 +573,12 @@ int pb_protocol_serialise_config(const struct config *config, *(uint32_t *)pos = config->allow_writes; pos += 4; - *(uint32_t *)pos = __cpu_to_be32(config->n_tty); + *(uint32_t *)pos = __cpu_to_be32(config->n_consoles); pos += 4; - for (i = 0; i < config->n_tty; i++) - pos += pb_protocol_serialise_string(pos, config->tty_list[i]); + for (i = 0; i < config->n_consoles; i++) + pos += pb_protocol_serialise_string(pos, config->consoles[i]); - pos += pb_protocol_serialise_string(pos, config->boot_tty); + pos += pb_protocol_serialise_string(pos, config->boot_console); pos += pb_protocol_serialise_string(pos, config->lang); @@ -803,7 +803,7 @@ int pb_protocol_deserialise_boot_command(struct boot_command *cmd, if (read_string(cmd, &pos, &len, &cmd->args_sig_file)) goto out; - if (read_string(cmd, &pos, &len, &cmd->tty)) + if (read_string(cmd, &pos, &len, &cmd->console)) goto out; rc = 0; @@ -1109,20 +1109,20 @@ int pb_protocol_deserialise_config(struct config *config, goto out; config->allow_writes = !!tmp; - if (read_u32(&pos, &len, &config->n_tty)) + if (read_u32(&pos, &len, &config->n_consoles)) goto out; - config->tty_list = talloc_array(config, char *, config->n_tty); - for (i = 0; i < config->n_tty; i++) { - if (read_string(config->tty_list, &pos, &len, &str)) + config->consoles = talloc_array(config, char *, config->n_consoles); + for (i = 0; i < config->n_consoles; i++) { + if (read_string(config->consoles, &pos, &len, &str)) goto out; - config->tty_list[i] = str; + config->consoles[i] = str; } if (read_string(config, &pos, &len, &str)) goto out; - config->boot_tty = str; + config->boot_console = str; if (read_string(config, &pos, &len, &str)) goto out; diff --git a/lib/types/types.h b/lib/types/types.h index 7b9269b..b7430f4 100644 --- a/lib/types/types.h +++ b/lib/types/types.h @@ -67,7 +67,7 @@ struct boot_command { char *dtb_file; char *boot_args; char *args_sig_file; - char *tty; + char *console; }; struct boot_status { @@ -163,12 +163,12 @@ struct config { bool allow_writes; - char *boot_tty; + char *boot_console; char *lang; /* not user-settable */ - unsigned int n_tty; - char **tty_list; + unsigned int n_consoles; + char **consoles; bool disable_snapshots; bool safe_mode; bool debug; -- cgit v1.2.1