[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 02/12] xen: use a structure to define parsing parameters



Instead of passing the start and end pointers of the parameter
definition array to the parsing function use a struct containing that
information. This will allow to add other parameters to control the
parsing later.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 xen/common/kernel.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 5766a0f784..a7e82453c2 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -18,6 +18,11 @@
 
 #ifndef COMPAT
 
+struct parse_data {
+    const struct kernel_param *start;
+    const struct kernel_param *end;
+};
+
 enum system_state system_state = SYS_STATE_early_boot;
 
 xen_commandline_t saved_cmdline;
@@ -52,8 +57,7 @@ static int assign_integer_param(const struct kernel_param 
*param, uint64_t val)
     return 0;
 }
 
-static int parse_params(const char *cmdline, const struct kernel_param *start,
-                        const struct kernel_param *end)
+static int parse_params(const char *cmdline, const struct parse_data *data)
 {
     char opt[128], *optval, *optkey, *q;
     const char *p = cmdline, *key;
@@ -100,7 +104,7 @@ static int parse_params(const char *cmdline, const struct 
kernel_param *start,
 
         rc = 0;
         found = false;
-        for ( param = start; param < end; param++ )
+        for ( param = data->start; param < data->end; param++ )
         {
             int rctmp;
             const char *s;
@@ -187,14 +191,24 @@ static int parse_params(const char *cmdline, const struct 
kernel_param *start,
     return final_rc;
 }
 
+static const struct parse_data boot_parse_data = {
+    .start  = __setup_start,
+    .end    = __setup_end,
+};
+
+static const struct parse_data runtime_parse_data = {
+    .start  = __param_start,
+    .end    = __param_end,
+};
+
 static void __init _cmdline_parse(const char *cmdline)
 {
-    parse_params(cmdline, __setup_start, __setup_end);
+    parse_params(cmdline, &boot_parse_data);
 }
 
 int runtime_parse(const char *line)
 {
-    return parse_params(line, __param_start, __param_end);
+    return parse_params(line, &runtime_parse_data);
 }
 
 /**
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.