diff options
author | Rob Herring <rob.herring@calxeda.com> | 2012-05-02 18:57:48 -0500 |
---|---|---|
committer | John Rigby <john.rigby@linaro.org> | 2012-12-06 13:51:49 -0700 |
commit | df6be7e15f739a30bd685508f1a0a227bceb4da9 (patch) | |
tree | 4690c96aac1bb6768415a515ddc00f6ef9a1775c | |
parent | 0731b7baf241c2256e656e278cdf0046d060c729 (diff) |
pxe: add support for ontimeout token
ontimeout is similar to default, but is the selection on menu timeout.
This is how cobbler sets a default. The label default is supposed to be
the default selection when <enter> is pressed. If both default and
ontimeout are set, last one parsed wins.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
-rw-r--r-- | common/cmd_pxe.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c index acc6a9b00..77814693d 100644 --- a/common/cmd_pxe.c +++ b/common/cmd_pxe.c @@ -690,6 +690,7 @@ enum token_type { T_PROMPT, T_INCLUDE, T_FDT, + T_ONTIMEOUT, T_INVALID }; @@ -718,6 +719,7 @@ static const struct token keywords[] = { {"initrd", T_INITRD}, {"include", T_INCLUDE}, {"fdt", T_FDT}, + {"ontimeout", T_ONTIMEOUT,}, {NULL, T_INVALID} }; @@ -1016,10 +1018,8 @@ static int parse_label_menu(char **c, struct pxe_menu *cfg, switch (t.type) { case T_DEFAULT: - if (cfg->default_label) - free(cfg->default_label); - - cfg->default_label = strdup(label->name); + if (!cfg->default_label) + cfg->default_label = strdup(label->name); if (!cfg->default_label) return -ENOMEM; @@ -1179,6 +1179,7 @@ static int parse_pxefile_top(char *p, struct pxe_menu *cfg, int nest_level) break; case T_DEFAULT: + case T_ONTIMEOUT: err = parse_sliteral(&p, &label_name); if (label_name) { |