diff options
Diffstat (limited to 'discover/grub2/grub2.h')
-rw-r--r-- | discover/grub2/grub2.h | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/discover/grub2/grub2.h b/discover/grub2/grub2.h index 68176fb..75f6aa0 100644 --- a/discover/grub2/grub2.h +++ b/discover/grub2/grub2.h @@ -91,6 +91,7 @@ struct grub2_statement_for { }; struct grub2_script { + struct grub2_parser *parser; struct grub2_statements *statements; struct list environment; struct list symtab; @@ -99,6 +100,7 @@ struct grub2_script { const char *filename; unsigned int n_options; struct list options; + int include_depth; }; struct grub2_parser { @@ -107,6 +109,14 @@ struct grub2_parser { bool inter_word; }; +/* References to files in grub2 consist of an optional device and a path + * (specified here by UUID). If the dev is unspecified, we fall back to a + * default - usually the 'root' environment variable. */ +struct grub2_file { + char *dev; + char *path; +}; + /* type for builtin functions */ typedef int (*grub2_function)(struct grub2_script *script, void *data, int argc, char *argv[]); @@ -156,6 +166,9 @@ void word_append(struct grub2_word *w1, struct grub2_word *w2); /* script interface */ void script_execute(struct grub2_script *script); +int statements_execute(struct grub2_script *script, + struct grub2_statements *stmts); + int statement_simple_execute(struct grub2_script *script, struct grub2_statement *statement); int statement_block_execute(struct grub2_script *script, @@ -183,16 +196,25 @@ void script_register_function(struct grub2_script *script, void register_builtins(struct grub2_script *script); /* resources */ -struct resource *create_grub2_resource(struct discover_boot_option *opt, - struct discover_device *orig_device, - const char *root, const char *path); +struct resource *create_grub2_resource(struct grub2_script *script, + struct discover_boot_option *opt, const char *path); bool resolve_grub2_resource(struct device_handler *handler, struct resource *res); +/* grub-style device+path parsing */ +struct grub2_file *grub2_parse_file(struct grub2_script *script, + const char *str); +struct discover_device *grub2_lookup_device(struct device_handler *handler, + const char *desc); + +/* internal parse api */ +int grub2_parser_parse(struct grub2_parser *parser, const char *filename, + char *buf, int len); + /* external parser api */ struct grub2_parser *grub2_parser_create(struct discover_context *ctx); -void grub2_parser_parse(struct grub2_parser *parser, const char *filename, - char *buf, int len); +void grub2_parser_parse_and_execute(struct grub2_parser *parser, + const char *filename, char *buf, int len); #endif /* GRUB2_H */ |