diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-09-13 16:33:58 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-09-24 13:14:59 +0800 |
commit | 5c6c8ea8ca66fe70563143cb226852a10b1a98fb (patch) | |
tree | b14557b3f7914f0b762401a9c9bf8f3b30b188a2 /discover/grub2/grub2.h | |
parent | 0a47d0c3a25552e0661fd919c4f87f990b081245 (diff) | |
download | talos-petitboot-5c6c8ea8ca66fe70563143cb226852a10b1a98fb.tar.gz talos-petitboot-5c6c8ea8ca66fe70563143cb226852a10b1a98fb.zip |
discover/grub2: Add initial command execution
.. with a simple 'set' command to update the environment
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/grub2/grub2.h')
-rw-r--r-- | discover/grub2/grub2.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/discover/grub2/grub2.h b/discover/grub2/grub2.h index de74fa5..60a5734 100644 --- a/discover/grub2/grub2.h +++ b/discover/grub2/grub2.h @@ -25,6 +25,11 @@ struct grub2_word { struct grub2_argv { struct list words; + + /* postprocessing (with process_expansions) populates these to hand to + * the grub2_command callbacks */ + char **argv; + int argc; }; struct grub2_statements { @@ -66,9 +71,18 @@ struct grub2_statement_block { struct grub2_statements *statements; }; +struct grub2_command { + const char *name; + int (*exec)(struct grub2_script *script, + int argc, char *argv[]); + struct list_item list; +}; + struct grub2_script { struct grub2_statements *statements; struct list environment; + struct list commands; + struct list symtab; }; struct grub2_parser { @@ -119,5 +133,17 @@ int statement_menuentry_execute(struct grub2_script *script, struct grub2_script *create_script(void *ctx); +const char *script_env_get(struct grub2_script *script, const char *name); + +void script_env_set(struct grub2_script *script, + const char *name, const char *value); + +void script_register_command(struct grub2_script *script, + struct grub2_command *command); + +struct grub2_command *script_lookup_command(struct grub2_script *script, + const char *name); + +void register_builtins(struct grub2_script *script); #endif /* GRUB2_H */ |