aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
authorLiu Aleaxander <Aleaxander@gmail.com>2009-08-28 18:27:51 +0800
committerLiu Aleaxander <Aleaxander@gmail.com>2009-08-28 18:27:51 +0800
commitc29a8049d462815774bbce8f80a8471a985bafcd (patch)
tree38420b5b946d76a7c44629cbd54da0a5c646d0f7 /com32
parent6fcebf4ed2be8de96ff106c3755c7776f1c66804 (diff)
downloadsyslinux-c29a8049d462815774bbce8f80a8471a985bafcd.tar.gz
syslinux-c29a8049d462815774bbce8f80a8471a985bafcd.tar.xz
syslinux-c29a8049d462815774bbce8f80a8471a985bafcd.zip
Core: vfs-dir stuff re-implemented
We fist make it simple, as told by hpa. Here're the changes: 1, The DIR structure changed, just a file pointer included. 2. So, the open/close/read-dir stuff in com32/lib/ changed again. 3. We read one stuff from every readdir call. Signed-off-by: Liu Aleaxander <Aleaxander@gmail.com>
Diffstat (limited to 'com32')
-rw-r--r--com32/include/dirent.h7
-rw-r--r--com32/lib/closedir.c16
-rw-r--r--com32/lib/opendir.c7
-rw-r--r--com32/lib/readdir.c4
-rw-r--r--com32/modules/dir.c1
-rw-r--r--com32/rosh/rosh.c3
6 files changed, 15 insertions, 23 deletions
diff --git a/com32/include/dirent.h b/com32/include/dirent.h
index 0fc2e135..d2bfd627 100644
--- a/com32/include/dirent.h
+++ b/com32/include/dirent.h
@@ -22,11 +22,10 @@ struct dirent {
char d_name[NAME_MAX + 1];
};
+struct file;
+
typedef struct {
- uint16_t dd_stat;
- uint16_t dd_sect;
- uint64_t dd_offset;
- char dd_name[NAME_MAX + 1];
+ struct file *dd_dir;
} DIR;
__extern DIR *opendir(const char *);
diff --git a/com32/lib/closedir.c b/com32/lib/closedir.c
index dcf17049..9e43dd4d 100644
--- a/com32/lib/closedir.c
+++ b/com32/lib/closedir.c
@@ -16,15 +16,13 @@ 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 = OFFS_WRT(dir, 0);
- __com32.cs_intcall(0x22, &regs, &regs);
- */
- free(dir);
- rv = 0;
+ 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
index 669a04a2..70f74c15 100644
--- a/com32/lib/opendir.c
+++ b/com32/lib/opendir.c
@@ -27,12 +27,9 @@ DIR *opendir(const char *pathname)
if (!(regs.eflags.l & EFLAGS_CF)) {
/* Initialization: malloc() then zero */
newdir = calloc(1, sizeof(DIR));
- strcpy(newdir->dd_name, pathname);
- newdir->dd_sect = regs.eax.l;
- newdir->dd_offset = 0;
- newdir->dd_stat = 0;
+ newdir->dd_dir = (struct file *)regs.eax.l;
}
-
+
/* We're done */
return newdir;
}
diff --git a/com32/lib/readdir.c b/com32/lib/readdir.c
index 7fca4761..6c95bd6d 100644
--- a/com32/lib/readdir.c
+++ b/com32/lib/readdir.c
@@ -13,16 +13,14 @@
struct dirent *readdir(DIR * dir)
{
- struct dirent *newde = NULL;;
+ struct dirent *newde;
com32sys_t regs;
- if ((dir !=NULL) && (dir->dd_sect != 0) && (dir->dd_stat != 0xffff)) {
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/modules/dir.c b/com32/modules/dir.c
index a3c98151..badc37de 100644
--- a/com32/modules/dir.c
+++ b/com32/modules/dir.c
@@ -20,6 +20,7 @@ int main(int argc, char *argv[])
}
dir = opendir(argv[1]);
+ printf("back from in main ...? \n");
if (dir == NULL) {
printf("Unable to read dir: %s\n", argv[1]);
return 0;
diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c
index c634a940..862497be 100644
--- a/com32/rosh/rosh.c
+++ b/com32/rosh/rosh.c
@@ -428,8 +428,7 @@ void rosh_dir_arg(const char *ifilstr, const char *pwdstr)
filepos = 0;
d = opendir(filestr);
if (d != NULL) {
- printf("DIR:'%s' %08x %8d\n", d->dd_name, (int)d->dd_sect,
- d->dd_offset);
+ //printf("DIR:'%s' %08x %8d\n", d->dd_name, (int)d->dd_sect, d->dd_offset);
de = readdir(d);
while (de != NULL) {
filepos++;