[syslinux:pathbased] opendir: use internal protected-mode interfaces

syslinux-bot for H. Peter Anvin hpa at zytor.com
Wed Feb 24 21:45:03 PST 2010


Commit-ID:  3cb6c7eae77c3b18182ed3b5ef32613623197000
Gitweb:     http://syslinux.zytor.com/commit/3cb6c7eae77c3b18182ed3b5ef32613623197000
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Wed, 24 Feb 2010 21:31:02 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Wed, 24 Feb 2010 21:31:02 -0800

opendir: use internal protected-mode interfaces

No need to do yet another bounce through lowmem for no good reason.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 core/fs/readdir.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/core/fs/readdir.c b/core/fs/readdir.c
index 7a58eda..33a67c8 100644
--- a/core/fs/readdir.c
+++ b/core/fs/readdir.c
@@ -9,11 +9,18 @@
  */
 void opendir(com32sys_t *regs)
 {
-    char *src = MK_PTR(regs->es, regs->esi.w[0]);
-    char *dst = MK_PTR(regs->ds, regs->edi.w[0]);
-    strcpy(dst, src);
-    pm_searchdir(regs);
-    regs->eax.l = (uint32_t)handle_to_file(regs->esi.w[0]);	
+    const char *src = MK_PTR(regs->es, regs->esi.w[0]);
+    struct file *file;
+    int rv;
+
+    rv = searchdir(src);
+    if (rv < 0) {
+	regs->eax.l = 0;
+	regs->eflags.l |= EFLAGS_ZF;
+    } else {
+	regs->eax.l = (uint32_t)handle_to_file(rv);
+	regs->eflags.l &= ~EFLAGS_ZF;
+    }
 }
 
 /*



More information about the Syslinux-commits mailing list