linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [cbootimage PATCH 1/3] Allow users to specify the handler to process special configuration
@ 2014-01-28  7:24 Vince Hsu
       [not found] ` <1390893857-18716-1-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Vince Hsu @ 2014-01-28  7:24 UTC (permalink / raw)
  To: swarren-DDmLM1+adcrQT0dZR+AlfA
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, Vince Hsu

Signed-off-by: Vince Hsu <vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 src/cbootimage.c |  4 ++--
 src/parse.c      | 13 +++++++++----
 src/parse.h      |  3 ++-
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/cbootimage.c b/src/cbootimage.c
index 1332c5f118b5..0fe164fa5421 100644
--- a/src/cbootimage.c
+++ b/src/cbootimage.c
@@ -200,14 +200,14 @@ main(int argc, char *argv[])
 
 	/* first, if we aren't generating the bct, read in config file */
 	if (context.generate_bct == 0) {
-		process_config_file(&context, 1);
+		process_config_file(&context, 1, NULL);
 	}
 	/* Generate the new bct file */
 	else {
 		/* Initialize the bct memory */
 		init_bct(&context);
 		/* Parse & process the contents of the config file. */
-		process_config_file(&context, 0);
+		process_config_file(&context, 0, NULL);
 		/* Update the BCT */
 		begin_update(&context);
 		/* Signing the bct. */
diff --git a/src/parse.c b/src/parse.c
index 464ee8ff40e4..92490b8c5768 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -698,7 +698,8 @@ process_statement(build_image_context *context,
  * @param context     	The main context pointer
  * @param simple_parse	Simple parse flag
  */
-void process_config_file(build_image_context *context, u_int8_t simple_parse)
+void process_config_file(build_image_context *context, u_int8_t simple_parse,
+		int (*special_handler)(build_image_context *context, char *buffer))
 {
 	char buffer[MAX_BUFFER];
 	int  space = 0;
@@ -707,6 +708,7 @@ void process_config_file(build_image_context *context, u_int8_t simple_parse)
 	u_int8_t comment = 0;
 	u_int8_t string = 0;
 	u_int8_t equal_encounter = 0;
+	int e;
 
 	assert(context != NULL);
 	assert(context->config_file != NULL);
@@ -737,11 +739,14 @@ void process_config_file(build_image_context *context, u_int8_t simple_parse)
 		case ';':
 			if (!string && !comment) {
 				buffer[space++] = '\0';
+				if (special_handler)
+					e = special_handler(context, buffer);
+				else
+					e = process_statement(context, buffer, simple_parse);
 
-				if (process_statement(context,
-							buffer,
-							simple_parse))
+				if (e)
 					goto error;
+
 				space = 0;
 				equal_encounter = 0;
 			} else if (string)
diff --git a/src/parse.h b/src/parse.h
index 80f42c4269b1..239946c7fa7a 100644
--- a/src/parse.h
+++ b/src/parse.h
@@ -763,7 +763,8 @@ typedef struct cbootimage_soc_config_rec {
 	parse_subfield_item *device_type_table;
 } cbootimage_soc_config;
 
-void process_config_file(build_image_context *context, u_int8_t simple_parse);
+void process_config_file(build_image_context *context, u_int8_t simple_parse,
+		int (*special_handler)(build_image_context *context, char *buffer));
 
 void t124_get_soc_config(build_image_context *context,
 	cbootimage_soc_config **soc_config);
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-28 17:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-28  7:24 [cbootimage PATCH 1/3] Allow users to specify the handler to process special configuration Vince Hsu
     [not found] ` <1390893857-18716-1-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-01-28  7:24   ` [cbootimage PATCH 2/3] Export several parsing functions for external use Vince Hsu
2014-01-28  7:24   ` [cbootimage PATCH 3/3] Implement the utility gen_sdram_array Vince Hsu
     [not found]     ` <1390893857-18716-3-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-01-28 17:04       ` Stephen Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).