summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-07-02 16:19:59 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-07-02 16:19:59 -0700
commitd44d4b5df1e8496f0bb6a343ddba41c258e01cda (patch)
treefe9282ee176337c9ed035d011187d3f9650e5936
parent92371f2735d9dd82adfa6c16ef65a27f9263da7c (diff)
downloadsyslinux-d44d4b5df1e8496f0bb6a343ddba41c258e01cda.tar.gz
syslinux-d44d4b5df1e8496f0bb6a343ddba41c258e01cda.tar.xz
syslinux-d44d4b5df1e8496f0bb6a343ddba41c258e01cda.zip
core: split loadconfig.c into two files
Split loadconfig.c into two files. In particular, isolinux needs search_config() but not generic_load_config(). Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--core/fs/lib/loadconfig.c30
-rw-r--r--core/fs/lib/searchconfig.c40
2 files changed, 41 insertions, 29 deletions
diff --git a/core/fs/lib/loadconfig.c b/core/fs/lib/loadconfig.c
index c2fd9721..c9652b6c 100644
--- a/core/fs/lib/loadconfig.c
+++ b/core/fs/lib/loadconfig.c
@@ -4,34 +4,6 @@
#include <core.h>
#include <fs.h>
-int search_config(const char *search_directories[], const char *filenames[])
-{
- char confignamebuf[FILENAME_MAX];
- com32sys_t regs;
- const char *sd, **sdp;
- const char *sf, **sfp;
-
- for (sdp = search_directories; (sd = *sdp); sdp++) {
- for (sfp = filenames; (sf = *sfp); sfp++) {
- memset(&regs, 0, sizeof regs);
- snprintf(confignamebuf, sizeof confignamebuf,
- "%s%s%s",
- sd, (*sd && sd[strlen(sd)-1] == '/') ? "" : "/",
- sf);
- realpath(ConfigName, confignamebuf, FILENAME_MAX);
- regs.edi.w[0] = OFFS_WRT(ConfigName, 0);
- dprintf("Config search: %s\n", ConfigName);
- call16(core_open, &regs, &regs);
- if (!(regs.eflags.l & EFLAGS_ZF)) {
- chdir(sd);
- return 0; /* Got it */
- }
- }
- }
-
- return -1;
-}
-
/*
* Standard version of load_config for extlinux/syslinux filesystems.
*
@@ -43,7 +15,7 @@ int generic_load_config(void)
{
static const char *search_directories[] = {
NULL, /* CurrentDirName */
- "/boot/syslinux",
+ "/boot/syslinux",
"/syslinux",
"/",
NULL
diff --git a/core/fs/lib/searchconfig.c b/core/fs/lib/searchconfig.c
new file mode 100644
index 00000000..24bfde31
--- /dev/null
+++ b/core/fs/lib/searchconfig.c
@@ -0,0 +1,40 @@
+#include <dprintf.h>
+#include <stdio.h>
+#include <string.h>
+#include <core.h>
+#include <fs.h>
+
+/*
+ * Common implementation of load_config
+ *
+ * This searches for a specified set of filenames in a specified set
+ * of directories. If found, set the current working directory to
+ * match.
+ */
+int search_config(const char *search_directories[], const char *filenames[])
+{
+ char confignamebuf[FILENAME_MAX];
+ com32sys_t regs;
+ const char *sd, **sdp;
+ const char *sf, **sfp;
+
+ for (sdp = search_directories; (sd = *sdp); sdp++) {
+ for (sfp = filenames; (sf = *sfp); sfp++) {
+ memset(&regs, 0, sizeof regs);
+ snprintf(confignamebuf, sizeof confignamebuf,
+ "%s%s%s",
+ sd, (*sd && sd[strlen(sd)-1] == '/') ? "" : "/",
+ sf);
+ realpath(ConfigName, confignamebuf, FILENAME_MAX);
+ regs.edi.w[0] = OFFS_WRT(ConfigName, 0);
+ dprintf("Config search: %s\n", ConfigName);
+ call16(core_open, &regs, &regs);
+ if (!(regs.eflags.l & EFLAGS_ZF)) {
+ chdir(sd);
+ return 0; /* Got it */
+ }
+ }
+ }
+
+ return -1;
+}