From patchwork Tue Jul 24 22:15:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 948896 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41Zt7P1HLdz9s3q for ; Wed, 25 Jul 2018 08:19:13 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="hGaaJhRN"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41Zt7N6r3tzDrdg for ; Wed, 25 Jul 2018 08:19:12 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="hGaaJhRN"; dkim-atps=neutral X-Original-To: Petitboot@lists.ozlabs.org Delivered-To: Petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=geoff@infradead.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="hGaaJhRN"; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41Zt3R5rN5zDrVP for ; Wed, 25 Jul 2018 08:15:47 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Date:Cc:To:Subject:From:References: In-Reply-To:Message-Id:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=V8WTnAm5xTs8KSZf5dxdjmP7hwrX0ECzYhA1ujUirdk=; b=hGaaJhRNBt75PHUVCTfDfX3uC W8Y8SXQugZqMmOEpu25XED7dwfENm89H4/ri87cmL5IsYIZT9eNNNox60RVdaHEhfKZxr8EtPrHYX d6UpyolK7lsFpt1KuTo8LPeJ9B5RBNS52XjTHpTvgJz72xVKV0Sis11gypqOddDSVgn2UyY7ffnUE 7/suBBV/MQf26/+Jr150CJI41/3+ZTI707KJvRQEE2aSSKTa+cBuYi1j20BbkRNUurso0QymsP1Am k/WZ34boEZIDufnHn+qU3WTrmaot1Z+Eh66wp1CfMp9wipiV1L2zyPN52qI1CmcU9f6DkpGGd1iiY SmejLZW9g==; Received: from geoff by merlin.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fi5aq-0004li-4Z; Tue, 24 Jul 2018 22:15:44 +0000 Message-Id: <8c718a7a44bc07361925c722393767e077e28332.1532469861.git.geoff@infradead.org> In-Reply-To: References: From: Geoff Levand Patch-Date: Tue, 24 Jul 2018 15:03:16 -0700 Subject: [PATCH v1 23/30] discover: Move generic config routines to platform To: Samuel Mendoza-Jonas Date: Tue, 24 Jul 2018 22:15:44 +0000 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ge Song , Petitboot@lists.ozlabs.org MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" From: Ge Song Move the generic config routines from platform-powerpc to platform. Also, for clarity, add a config_ prefix to the names. Signed-off-by: Ge Song [Split from a larger patch and cleaned up] Signed-off-by: Geoff Levand --- discover/platform-powerpc.c | 315 ++------------------------------------------ discover/platform.c | 299 ++++++++++++++++++++++++++++++++++++++++- discover/platform.h | 6 +- 3 files changed, 311 insertions(+), 309 deletions(-) diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c index b5e4a8e..a96f5d5 100644 --- a/discover/platform-powerpc.c +++ b/discover/platform-powerpc.c @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include @@ -14,10 +13,7 @@ #include #include #include -#include #include -#include -#include #include "hostboot.h" #include "platform.h" @@ -174,301 +170,7 @@ static int write_nvram(struct platform_powerpc *platform) return rc; } -static int parse_hwaddr(struct interface_config *ifconf, char *str) -{ - int i; - - if (strlen(str) != strlen("00:00:00:00:00:00")) - return -1; - - for (i = 0; i < HWADDR_SIZE; i++) { - char byte[3], *endp; - unsigned long x; - - byte[0] = str[i * 3 + 0]; - byte[1] = str[i * 3 + 1]; - byte[2] = '\0'; - - x = strtoul(byte, &endp, 16); - if (endp != byte + 2) - return -1; - - ifconf->hwaddr[i] = x & 0xff; - } - - return 0; -} - -static int parse_one_interface_config(struct config *config, char *confstr) -{ - struct interface_config *ifconf; - char *tok, *tok_gw, *tok_url, *saveptr; - - ifconf = talloc_zero(config, struct interface_config); - - if (!confstr || !strlen(confstr)) - goto out_err; - - /* first token should be the mac address */ - tok = strtok_r(confstr, ",", &saveptr); - if (!tok) - goto out_err; - - if (parse_hwaddr(ifconf, tok)) - goto out_err; - - /* second token is the method */ - tok = strtok_r(NULL, ",", &saveptr); - if (!tok || !strlen(tok) || !strcmp(tok, "ignore")) { - ifconf->ignore = true; - - } else if (!strcmp(tok, "dhcp")) { - ifconf->method = CONFIG_METHOD_DHCP; - - } else if (!strcmp(tok, "static")) { - ifconf->method = CONFIG_METHOD_STATIC; - - /* ip/mask, [optional] gateway, [optional] url */ - tok = strtok_r(NULL, ",", &saveptr); - if (!tok) - goto out_err; - ifconf->static_config.address = - talloc_strdup(ifconf, tok); - - /* - * If a url is set but not a gateway, we can accidentally - * interpret the url as the gateway. To avoid changing the - * parameter format check if the "gateway" is actually a - * pb-url if it's the last token. - */ - tok_gw = strtok_r(NULL, ",", &saveptr); - tok_url = strtok_r(NULL, ",", &saveptr); - - if (tok_gw) { - if (tok_url || !is_url(tok_gw)) - ifconf->static_config.gateway = - talloc_strdup(ifconf, tok_gw); - else - tok_url = tok_gw; - } - - if (tok_url) - ifconf->static_config.url = - talloc_strdup(ifconf, tok_url); - } else { - pb_log("Unknown network configuration method %s\n", tok); - goto out_err; - } - - config->network.interfaces = talloc_realloc(config, - config->network.interfaces, - struct interface_config *, - ++config->network.n_interfaces); - - config->network.interfaces[config->network.n_interfaces - 1] = ifconf; - - return 0; -out_err: - talloc_free(ifconf); - return -1; -} - -static int parse_one_dns_config(struct config *config, char *confstr) -{ - char *tok, *saveptr = NULL; - - for (tok = strtok_r(confstr, ",", &saveptr); tok; - tok = strtok_r(NULL, ",", &saveptr)) { - - char *server = talloc_strdup(config, tok); - - config->network.dns_servers = talloc_realloc(config, - config->network.dns_servers, const char *, - ++config->network.n_dns_servers); - - config->network.dns_servers[config->network.n_dns_servers - 1] - = server; - } - - return 0; -} - -static void populate_network_config(struct config *config, const char *cval) -{ - char *val, *saveptr = NULL; - int i; - - if (!cval || !strlen(cval)) - return; - - val = talloc_strdup(config, cval); - - for (i = 0; ; i++) { - char *tok; - - tok = strtok_r(i == 0 ? val : NULL, " ", &saveptr); - if (!tok) - break; - - if (!strncasecmp(tok, "dns,", strlen("dns,"))) - parse_one_dns_config(config, tok + strlen("dns,")); - else - parse_one_interface_config(config, tok); - - } - - talloc_free(val); -} - -static int read_bootdev(void *ctx, char **pos, struct autoboot_option *opt) -{ - char *delim = strchr(*pos, ' '); - int len, prefix = 0, rc = -1; - enum device_type type; - - if (!strncmp(*pos, "uuid:", strlen("uuid:"))) { - prefix = strlen("uuid:"); - opt->boot_type = BOOT_DEVICE_UUID; - } else if (!strncmp(*pos, "mac:", strlen("mac:"))) { - prefix = strlen("mac:"); - opt->boot_type = BOOT_DEVICE_UUID; - } else { - type = find_device_type(*pos); - if (type != DEVICE_TYPE_UNKNOWN) { - opt->type = type; - opt->boot_type = BOOT_DEVICE_TYPE; - rc = 0; - } - } - - if (opt->boot_type == BOOT_DEVICE_UUID) { - if (delim) - len = (int)(delim - *pos) - prefix; - else - len = strlen(*pos) - prefix; - - if (len) { - opt->uuid = talloc_strndup(ctx, *pos + prefix, len); - rc = 0; - } - } - - /* Always advance pointer to next option or end */ - if (delim) - *pos = delim + 1; - else - *pos += strlen(*pos); - - return rc; -} - -static void populate_bootdev_config(struct config *config, - const struct param_list *pl) -{ - struct autoboot_option *opt, *new = NULL; - char *pos, *end; - unsigned int n_new = 0; - const char *val; - - /* Check for ordered bootdevs */ - val = param_list_get_value(pl, "petitboot,bootdevs"); - if (!val || !strlen(val)) { - pos = end = NULL; - } else { - pos = talloc_strdup(config, val); - end = strchr(pos, '\0'); - } - - while (pos && pos < end) { - opt = talloc(config, struct autoboot_option); - - if (read_bootdev(config, &pos, opt)) { - pb_log("bootdev config is in an unknown format " - "(expected uuid:... or mac:...)\n"); - talloc_free(opt); - continue; - } - - new = talloc_realloc(config, new, struct autoboot_option, - n_new + 1); - new[n_new] = *opt; - n_new++; - talloc_free(opt); - - } - - if (!n_new) { - /* If autoboot has been disabled, clear the default options */ - if (!config->autoboot_enabled) { - talloc_free(config->autoboot_opts); - config->n_autoboot_opts = 0; - } - return; - } - - talloc_free(config->autoboot_opts); - config->autoboot_opts = new; - config->n_autoboot_opts = n_new; -} - -static void populate_config(struct config *config, const struct param_list *pl) -{ - const char *val; - char *end; - unsigned long timeout; - - /* if the "auto-boot?' property is present and "false", disable auto - * boot */ - val = param_list_get_value(pl, "auto-boot?"); - config->autoboot_enabled = !val || strcmp(val, "false"); - - val = param_list_get_value(pl, "petitboot,timeout"); - if (val) { - timeout = strtoul(val, &end, 10); - if (end != val) { - if (timeout >= INT_MAX) - timeout = INT_MAX; - config->autoboot_timeout_sec = (int)timeout; - } - } - - val = param_list_get_value(pl, "petitboot,language"); - config->lang = val ? talloc_strdup(config, val) : NULL; - - val = param_list_get_value(pl, "petitboot,network"); - populate_network_config(config, val); - - populate_bootdev_config(config, pl); - - if (!config->debug) { - val = param_list_get_value(pl, "petitboot,debug?"); - config->debug = val && !strcmp(val, "true"); - } - - val = param_list_get_value(pl, "petitboot,write?"); - if (val) - config->allow_writes = !strcmp(val, "true"); - - val = param_list_get_value(pl, "petitboot,snapshots?"); - if (val) - config->disable_snapshots = !strcmp(val, "false"); - - val = param_list_get_value(pl, "petitboot,console"); - if (val) - config->boot_console = talloc_strdup(config, val); - /* If a full path is already set we don't want to override it */ - config->manual_console = config->boot_console && - !strchr(config->boot_console, '['); - - val = param_list_get_value(pl, "petitboot,http_proxy"); - if (val) - config->http_proxy = talloc_strdup(config, val); - val = param_list_get_value(pl, "petitboot,https_proxy"); - if (val) - config->https_proxy = talloc_strdup(config, val); -} - -static char *iface_config_str(void *ctx, struct interface_config *config) +static char *interface_config_str(void *ctx, struct interface_config *config) { char *str; @@ -529,7 +231,7 @@ static void update_network_config(struct param_list *pl, const char *param_name, val = talloc_strdup(pl, ""); for (i = 0; i < config->network.n_interfaces; i++) { - char *iface_str = iface_config_str(pl, + char *iface_str = interface_config_str(pl, config->network.interfaces[i]); val = talloc_asprintf_append(val, "%s%s", *val == '\0' ? "" : " ", iface_str); @@ -546,6 +248,7 @@ static void update_network_config(struct param_list *pl, const char *param_name, } param_list_set_non_empty(pl, param_name, val, true); + talloc_free(val); } @@ -577,6 +280,7 @@ static void update_bootdev_config(struct param_list *pl, const char *param_name, } param_list_set_non_empty(pl, param_name, val, true); + talloc_free(tmp); if (boot_str) talloc_free(boot_str); @@ -628,7 +332,7 @@ static void update_config(struct param_list *pl, struct config *config, update_bootdev_config(pl, "petitboot,bootdevs", config); } -static void set_ipmi_bootdev(struct config *config, enum ipmi_bootdev bootdev, +static void config_set_ipmi_bootdev(struct config *config, enum ipmi_bootdev bootdev, bool persistent) { config->ipmi_bootdev = bootdev; @@ -981,7 +685,7 @@ static void get_ipmi_network_override(struct platform_powerpc *platform, } } -static void get_active_consoles(struct config *config) +static void config_get_active_consoles(struct config *config) { struct stat sbuf; char *fsp_prop = NULL; @@ -1023,7 +727,7 @@ static int load_config(struct platform *p, struct config *config) if (rc) pb_log_fn("Failed to parse nvram\n"); - populate_config(config, &platform->params); + config_populate_all(config, &platform->params); if (platform->get_ipmi_bootdev) { bool bootdev_persistent; @@ -1031,14 +735,15 @@ static int load_config(struct platform *p, struct config *config) rc = platform->get_ipmi_bootdev(platform, &bootdev, &bootdev_persistent); if (!rc && ipmi_bootdev_is_valid(bootdev)) { - set_ipmi_bootdev(config, bootdev, bootdev_persistent); + config_set_ipmi_bootdev(config, bootdev, + bootdev_persistent); } } if (platform->ipmi) get_ipmi_network_override(platform, config); - get_active_consoles(config); + config_get_active_consoles(config); return 0; } diff --git a/discover/platform.c b/discover/platform.c index e69c6f6..2ac2de2 100644 --- a/discover/platform.c +++ b/discover/platform.c @@ -2,13 +2,16 @@ #define _GNU_SOURCE #include -#include +#include #include +#include +#include #include #include #include #include +#include #include "platform.h" @@ -263,3 +266,297 @@ int platform_fini(void) talloc_free(platform_ctx); return 0; } + +static int parse_hwaddr(struct interface_config *ifconf, const char *str) +{ + int i; + + if (strlen(str) != strlen("00:00:00:00:00:00")) + return -1; + + for (i = 0; i < HWADDR_SIZE; i++) { + char byte[3], *endp; + unsigned long x; + + byte[0] = str[i * 3 + 0]; + byte[1] = str[i * 3 + 1]; + byte[2] = '\0'; + + x = strtoul(byte, &endp, 16); + if (endp != byte + 2) + return -1; + + ifconf->hwaddr[i] = x & 0xff; + } + + return 0; +} + +static int config_parse_one_interface(struct config *config, char *confstr) +{ + struct interface_config *ifconf; + char *tok, *tok_gw, *tok_url, *saveptr; + + ifconf = talloc_zero(config, struct interface_config); + + if (!confstr || !strlen(confstr)) + goto out_err; + + /* first token should be the mac address */ + tok = strtok_r(confstr, ",", &saveptr); + if (!tok) + goto out_err; + + if (parse_hwaddr(ifconf, tok)) + goto out_err; + + /* second token is the method */ + tok = strtok_r(NULL, ",", &saveptr); + if (!tok || !strlen(tok) || !strcmp(tok, "ignore")) { + ifconf->ignore = true; + + } else if (!strcmp(tok, "dhcp")) { + ifconf->method = CONFIG_METHOD_DHCP; + + } else if (!strcmp(tok, "static")) { + ifconf->method = CONFIG_METHOD_STATIC; + + /* ip/mask, [optional] gateway, [optional] url */ + tok = strtok_r(NULL, ",", &saveptr); + if (!tok) + goto out_err; + ifconf->static_config.address = + talloc_strdup(ifconf, tok); + + /* + * If a url is set but not a gateway, we can accidentally + * interpret the url as the gateway. To avoid changing the + * parameter format check if the "gateway" is actually a + * pb-url if it's the last token. + */ + tok_gw = strtok_r(NULL, ",", &saveptr); + tok_url = strtok_r(NULL, ",", &saveptr); + + if (tok_gw) { + if (tok_url || !is_url(tok_gw)) + ifconf->static_config.gateway = + talloc_strdup(ifconf, tok_gw); + else + tok_url = tok_gw; + } + + if (tok_url) + ifconf->static_config.url = + talloc_strdup(ifconf, tok_url); + } else { + pb_log("Unknown network configuration method %s\n", tok); + goto out_err; + } + + config->network.interfaces = talloc_realloc(config, + config->network.interfaces, + struct interface_config *, + ++config->network.n_interfaces); + + config->network.interfaces[config->network.n_interfaces - 1] = ifconf; + + return 0; +out_err: + talloc_free(ifconf); + return -1; +} + +static int config_parse_one_dns(struct config *config, char *confstr) +{ + char *tok, *saveptr = NULL; + + for (tok = strtok_r(confstr, ",", &saveptr); tok; + tok = strtok_r(NULL, ",", &saveptr)) { + + char *server = talloc_strdup(config, tok); + + config->network.dns_servers = talloc_realloc(config, + config->network.dns_servers, const char *, + ++config->network.n_dns_servers); + + config->network.dns_servers[config->network.n_dns_servers - 1] + = server; + } + + return 0; +} + +static void config_populate_network(struct config *config, const char *cval) +{ + char *val, *saveptr = NULL; + int i; + + if (!cval || !strlen(cval)) + return; + + val = talloc_strdup(config, cval); + + for (i = 0; ; i++) { + char *tok; + + tok = strtok_r(i == 0 ? val : NULL, " ", &saveptr); + if (!tok) + break; + + if (!strncasecmp(tok, "dns,", strlen("dns,"))) + config_parse_one_dns(config, tok + strlen("dns,")); + else + config_parse_one_interface(config, tok); + + } + + talloc_free(val); +} + +static int read_bootdev(void *ctx, char **pos, struct autoboot_option *opt) +{ + char *delim = strchr(*pos, ' '); + int len, prefix = 0, rc = -1; + enum device_type type; + + if (!strncmp(*pos, "uuid:", strlen("uuid:"))) { + prefix = strlen("uuid:"); + opt->boot_type = BOOT_DEVICE_UUID; + } else if (!strncmp(*pos, "mac:", strlen("mac:"))) { + prefix = strlen("mac:"); + opt->boot_type = BOOT_DEVICE_UUID; + } else { + type = find_device_type(*pos); + if (type != DEVICE_TYPE_UNKNOWN) { + opt->type = type; + opt->boot_type = BOOT_DEVICE_TYPE; + rc = 0; + } + } + + if (opt->boot_type == BOOT_DEVICE_UUID) { + if (delim) + len = (int)(delim - *pos) - prefix; + else + len = strlen(*pos) - prefix; + + if (len) { + opt->uuid = talloc_strndup(ctx, *pos + prefix, len); + rc = 0; + } + } + + /* Always advance pointer to next option or end */ + if (delim) + *pos = delim + 1; + else + *pos += strlen(*pos); + + return rc; +} + +static void config_populate_bootdev(struct config *config, + const struct param_list *pl) +{ + struct autoboot_option *opt, *new = NULL; + char *pos, *end; + unsigned int n_new = 0; + const char *val; + + /* Check for ordered bootdevs */ + val = param_list_get_value(pl, "petitboot,bootdevs"); + if (!val || !strlen(val)) { + pos = end = NULL; + } else { + pos = talloc_strdup(config, val); + end = strchr(pos, '\0'); + } + + while (pos && pos < end) { + opt = talloc(config, struct autoboot_option); + + if (read_bootdev(config, &pos, opt)) { + pb_log("bootdev config is in an unknown format " + "(expected uuid:... or mac:...)\n"); + talloc_free(opt); + continue; + } + + new = talloc_realloc(config, new, struct autoboot_option, + n_new + 1); + new[n_new] = *opt; + n_new++; + talloc_free(opt); + + } + + if (!n_new) { + /* If autoboot has been disabled, clear the default options */ + if (!config->autoboot_enabled) { + talloc_free(config->autoboot_opts); + config->n_autoboot_opts = 0; + } + return; + } + + talloc_free(config->autoboot_opts); + config->autoboot_opts = new; + config->n_autoboot_opts = n_new; +} + +void config_populate_all(struct config *config, const struct param_list *pl) +{ + const char *val; + char *end; + unsigned long timeout; + + /* if the "auto-boot?' property is present and "false", disable auto + * boot */ + val = param_list_get_value(pl, "auto-boot?"); + config->autoboot_enabled = !val || strcmp(val, "false"); + + val = param_list_get_value(pl, "petitboot,timeout"); + if (val) { + timeout = strtoul(val, &end, 10); + if (end != val) { + if (timeout >= INT_MAX) + timeout = INT_MAX; + config->autoboot_timeout_sec = (int)timeout; + } + } + + val = param_list_get_value(pl, "petitboot,language"); + config->lang = val ? talloc_strdup(config, val) : NULL; + + val = param_list_get_value(pl, "petitboot,network"); + config_populate_network(config, val); + + config_populate_bootdev(config, pl); + + if (!config->debug) { + val = param_list_get_value(pl, "petitboot,debug?"); + config->debug = val && !strcmp(val, "true"); + } + + val = param_list_get_value(pl, "petitboot,write?"); + if (val) + config->allow_writes = !strcmp(val, "true"); + + val = param_list_get_value(pl, "petitboot,snapshots?"); + if (val) + config->disable_snapshots = !strcmp(val, "false"); + + val = param_list_get_value(pl, "petitboot,console"); + if (val) + config->boot_console = talloc_strdup(config, val); + /* If a full path is already set we don't want to override it */ + config->manual_console = config->boot_console && + !strchr(config->boot_console, '['); + + val = param_list_get_value(pl, "petitboot,http_proxy"); + if (val) + config->http_proxy = talloc_strdup(config, val); + val = param_list_get_value(pl, "petitboot,https_proxy"); + if (val) + config->https_proxy = talloc_strdup(config, val); +} diff --git a/discover/platform.h b/discover/platform.h index 5aa8e3f..a9ea79b 100644 --- a/discover/platform.h +++ b/discover/platform.h @@ -2,6 +2,7 @@ #define PLATFORM_H #include +#include struct platform { const char *name; @@ -24,10 +25,9 @@ void platform_pre_boot(void); /* configuration interface */ const struct config *config_get(void); int config_set(struct config *config); -void config_set_autoboot(bool autoboot_enabled); - -/* for use by the platform-specific storage code */ void config_set_defaults(struct config *config); +void config_set_autoboot(bool autoboot_enabled); +void config_populate_all(struct config *config, const struct param_list *pl); #define __platform_ptrname(_n) __platform_ ## _n #define _platform_ptrname(_n) __platform_ptrname(_n)