summaryrefslogtreecommitdiffstats
path: root/discover
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-09-12 16:08:18 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-09-24 13:14:59 +0800
commit59747ee01e0158f97bdf8c182305e757d90a8d7a (patch)
treec47f117ec01be2dd4e849980cc39623814583410 /discover
parentc0b2be44ee953f9f50737b959e0def6e2df24629 (diff)
downloadtalos-petitboot-59747ee01e0158f97bdf8c182305e757d90a8d7a.tar.gz
talos-petitboot-59747ee01e0158f97bdf8c182305e757d90a8d7a.zip
discover/grub2: Add initial script infrastructure
Now that we can parse scripts, we want some infrastructure for execution. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover')
-rw-r--r--discover/grub2/grub2.h10
-rw-r--r--discover/grub2/parser.y2
-rw-r--r--discover/grub2/script.c12
3 files changed, 22 insertions, 2 deletions
diff --git a/discover/grub2/grub2.h b/discover/grub2/grub2.h
index 0643a72..f3ad2e5 100644
--- a/discover/grub2/grub2.h
+++ b/discover/grub2/grub2.h
@@ -55,9 +55,13 @@ struct grub2_statement_block {
struct grub2_statements *statements;
};
+struct grub2_script {
+ struct grub2_statements *statements;
+};
+
struct grub2_parser {
void *scanner;
- struct grub2_statements *statements;
+ struct grub2_script *script;
};
struct grub2_statements *create_statements(struct grub2_parser *parser);
@@ -88,5 +92,9 @@ void argv_append(struct grub2_argv *argv, struct grub2_word *word);
void word_append(struct grub2_word *w1, struct grub2_word *w2);
+/* script interface */
+
+struct grub2_script *create_script(void *ctx);
+
#endif /* GRUB2_H */
diff --git a/discover/grub2/parser.y b/discover/grub2/parser.y
index d57c732..6461801 100644
--- a/discover/grub2/parser.y
+++ b/discover/grub2/parser.y
@@ -56,7 +56,7 @@ static void yyerror(struct grub2_parser *, char const *s);
%%
script: statements {
- parser->statements = $1;
+ parser->script->statements = $1;
}
statements: statement {
diff --git a/discover/grub2/script.c b/discover/grub2/script.c
new file mode 100644
index 0000000..71d6cba
--- /dev/null
+++ b/discover/grub2/script.c
@@ -0,0 +1,12 @@
+
+#include <talloc/talloc.h>
+
+#include "grub2.h"
+
+struct grub2_script *create_script(void *ctx)
+{
+ struct grub2_script *script;
+ script = talloc(ctx, struct grub2_script);
+ return script;
+}
+
OpenPOWER on IntegriCloud