[syslinux] [PATCH 07/12] elflink: Move config data into config.h

Matt Fleming matt at console-pimps.org
Wed Mar 9 08:00:18 PST 2011


From: Matt Fleming <matt.fleming at linux.intel.com>

Move some definitions that other compilation units need to know about
into config.h. In subsequent patches ldlinux.c will use the global
options set by readconfig.c to decide which kernel to boot.

Signed-off-by: Matt Fleming <matt.fleming at linux.intel.com>
---
 com32/elflink/ldlinux/config.h     |   29 +++++++++++++++++++++++++++++
 com32/elflink/ldlinux/ldlinux.c    |    4 ++++
 com32/elflink/ldlinux/readconfig.c |   17 +++++++++--------
 3 files changed, 42 insertions(+), 8 deletions(-)
 create mode 100644 com32/elflink/ldlinux/config.h

diff --git a/com32/elflink/ldlinux/config.h b/com32/elflink/ldlinux/config.h
new file mode 100644
index 0000000..3125b27
--- /dev/null
+++ b/com32/elflink/ldlinux/config.h
@@ -0,0 +1,29 @@
+/*
+ *   Copyright 2011 Intel Corporation - All Rights Reserved
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ *   Boston MA 02110-1301, USA; either version 2 of the License, or
+ *   (at your option) any later version; incorporated herein by reference.
+ *
+ */
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+extern short uappendlen;	//bytes in append= command
+extern short ontimeoutlen;	//bytes in ontimeout command
+extern short onerrorlen;	//bytes in onerror command
+extern short forceprompt;	//force prompt
+extern short noescape;		//no escape
+extern short nocomplete;	//no label completion on TAB key
+extern short allowimplicit;	//allow implicit kernels
+extern short allowoptions;	//user-specified options allowed
+extern short includelevel;	//nesting level
+extern short defaultlevel;	//the current level of default
+extern short vkernel;		//have we seen any "label" statements?
+extern short displaycon;	//conio.inc
+extern short nohalt;		//idle.inc
+
+#endif /* __CONFIG_H__ */
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index 967eebb..b348490 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -1,8 +1,12 @@
 #include <linux/list.h>
 #include <sys/times.h>
 #include <stdbool.h>
+#include <core-elf.h>
 #include "cli.h"
 #include "console.h"
+#include "com32.h"
+#include "menu.h"
+#include "config.h"
 
 #include <sys/module.h>
 
diff --git a/com32/elflink/ldlinux/readconfig.c b/com32/elflink/ldlinux/readconfig.c
index 18c1183..1fb9156 100644
--- a/com32/elflink/ldlinux/readconfig.c
+++ b/com32/elflink/ldlinux/readconfig.c
@@ -25,6 +25,7 @@
 #include <core-elf.h>
 
 #include "menu.h"
+#include "config.h"
 
 const struct menu_parameter mparm[NPARAMS] = {
     [P_WIDTH] = {"width", 0},
@@ -43,17 +44,17 @@ const struct menu_parameter mparm[NPARAMS] = {
     [P_HIDDEN_ROW] = {"hiddenrow", -2},
 };
 
-short uappendlen;		//bytes in append= command
-short ontimeoutlen;		//bytes in ontimeout command
-short onerrorlen;		//bytes in onerror command
-short forceprompt;		//force prompt
-short noescape;			//no escape
-short nocomplete;		//no label completion on TAB key
+short uappendlen = 0;		//bytes in append= command
+short ontimeoutlen = 0;		//bytes in ontimeout command
+short onerrorlen = 0;		//bytes in onerror command
+short forceprompt = 0;		//force prompt
+short noescape = 0;		//no escape
+short nocomplete = 0;		//no label completion on TAB key
 short allowimplicit = 1;	//allow implicit kernels
 short allowoptions = 1;		//user-specified options allowed
 short includelevel = 1;		//nesting level
-short defaultlevel;		//the current level of default
-short vkernel;			//have we seen any "label" statements?
+short defaultlevel = 0;		//the current level of default
+short vkernel = 0;		//have we seen any "label" statements?
 short displaycon = 1;		//conio.inc
 short nohalt = 1;		//idle.inc
 
-- 
1.7.4




More information about the Syslinux mailing list