summaryrefslogtreecommitdiff
path: root/com32/lib
diff options
context:
space:
mode:
Diffstat (limited to 'com32/lib')
-rw-r--r--com32/lib/Makefile2
-rw-r--r--com32/lib/closedir.c30
-rw-r--r--com32/lib/opendir.c41
-rw-r--r--com32/lib/readdir.c27
-rw-r--r--com32/lib/sys/readdir.c30
5 files changed, 31 insertions, 99 deletions
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index 8aad4f8d..93643ce2 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -31,7 +31,7 @@ LIBOBJS = \
\
dprintf.o vdprintf.o \
\
- opendir.o readdir.o closedir.o getcwd.o chdir.o fdopendir.o \
+ sys/readdir.o getcwd.o chdir.o fdopendir.o \
\
libgcc/__ashldi3.o libgcc/__udivdi3.o \
libgcc/__negdi2.o libgcc/__ashrdi3.o libgcc/__lshrdi3.o \
diff --git a/com32/lib/closedir.c b/com32/lib/closedir.c
deleted file mode 100644
index f4de67ae..00000000
--- a/com32/lib/closedir.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * closedir.c
- */
-
-#include <dirent.h>
-#include <stdio.h>
-#include <errno.h>
-
-#include <com32.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-
-int closedir(DIR * dir)
-{
- int rv = -1;
-
- if (dir) {
- com32sys_t regs;
- memset(&regs, 0, sizeof regs);
- regs.eax.w[0] = 0x0022;
- regs.esi.l = (uint32_t)dir;
- __com32.cs_intcall(0x22, &regs, &regs);
- free(dir);
- rv = 0;
- }
-
- return rv;
-}
diff --git a/com32/lib/opendir.c b/com32/lib/opendir.c
deleted file mode 100644
index e3c35ce8..00000000
--- a/com32/lib/opendir.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * opendir.c
- */
-
-#include <dirent.h>
-#include <stdio.h>
-#include <errno.h>
-
-#include <com32.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-
-DIR *opendir(const char *pathname)
-{
- DIR *newdir = NULL;
- com32sys_t regs;
- char *lm_pathname;
-
- lm_pathname = lstrdup(pathname);
- if (!lm_pathname)
- return NULL;
-
- regs.eax.w[0] = 0x0020;
- regs.esi.w[0] = OFFS(lm_pathname);
- regs.es = SEG(lm_pathname);
-
- __com32.cs_intcall(0x22, &regs, &regs);
-
- if (!(regs.eflags.l & EFLAGS_CF)) {
- /* Initialization: malloc() then zero */
- newdir = zalloc(sizeof(DIR));
- newdir->dd_dir = (struct file *)regs.eax.l;
- }
-
- lfree(lm_pathname);
-
- /* We're done */
- return newdir;
-}
diff --git a/com32/lib/readdir.c b/com32/lib/readdir.c
deleted file mode 100644
index d59ad3a2..00000000
--- a/com32/lib/readdir.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * readdir.c
- */
-
-#include <dirent.h>
-#include <stdio.h>
-#include <errno.h>
-
-#include <com32.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-
-struct dirent *readdir(DIR * dir)
-{
- struct dirent *newde;
- com32sys_t regs;
-
- memset(&regs, 0, sizeof(regs));
- regs.eax.w[0] = 0x0021;
- regs.esi.l = (uint32_t)dir;
- __com32.cs_intcall(0x22, &regs, &regs);
- newde = (struct dirent *)(regs.eax.l);
-
- return newde;
-}
diff --git a/com32/lib/sys/readdir.c b/com32/lib/sys/readdir.c
new file mode 100644
index 00000000..d2a8c039
--- /dev/null
+++ b/com32/lib/sys/readdir.c
@@ -0,0 +1,30 @@
+/*
+ * readdir.c
+ */
+
+#include <dirent.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <com32.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+
+#include <syslinux/pmapi.h>
+
+DIR *opendir(const char *pathname)
+{
+ return __com32.cs_pm->opendir(pathname);
+}
+
+struct dirent *readdir(DIR *dir)
+{
+ return __com32.cs_pm->readdir(dir);
+}
+
+int closedir(DIR *dir)
+{
+ return __com32.cs_pm->closedir(dir);
+}