aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/cache.c2
-rw-r--r--core/fs.c17
-rw-r--r--core/fs/fat/fat.c35
-rw-r--r--core/include/fs.h10
4 files changed, 26 insertions, 38 deletions
diff --git a/core/cache.c b/core/cache.c
index 4307b78a..415becff 100644
--- a/core/cache.c
+++ b/core/cache.c
@@ -127,7 +127,7 @@ void print_cache(struct device *dev)
struct cache_struct *cs = dev->cache_head;
for (; i < dev->cache_entries; i++) {
cs = cs->next;
- printf("%d(%p) ", cs->block, cs->data);
+ printf("%d(%p)\n", cs->block, cs->data);
}
printf("\n");
diff --git a/core/fs.c b/core/fs.c
index a821f953..31b54658 100644
--- a/core/fs.c
+++ b/core/fs.c
@@ -127,12 +127,12 @@ void searchdir(com32sys_t *regs)
char *p;
int symlink_count = 6;
-#if 1
+#if 0
printf("filename: %s\n", name);
#endif
if (!(file = alloc_file()))
- goto err;
+ goto err_no_close;
file->fs = this_fs;
/* if we have ->searchdir method, call it */
@@ -177,6 +177,15 @@ void searchdir(com32sys_t *regs)
free_inode(inode);
continue;
}
+
+ /*
+ * For the relative path searching used in FAT and ISO fs.
+ */
+ if ((this_fs->fs_ops->fs_flags & FS_THISIND) && (this_inode != parent)){
+ if (this_inode)
+ free_inode(this_inode);
+ this_inode = parent;
+ }
if (parent != this_inode)
free_inode(parent);
@@ -196,6 +205,8 @@ void searchdir(com32sys_t *regs)
return;
err:
+ _close_file(file);
+err_no_close:
regs->esi.w[0] = 0;
regs->eax.l = 0;
regs->eflags.l |= EFLAGS_ZF;
@@ -254,4 +265,6 @@ void fs_init(com32sys_t *regs)
if (fs.fs_ops->iget_current)
this_inode = fs.fs_ops->iget_current();
+
+ print_cache(fs.fs_dev);
}
diff --git a/core/fs/fat/fat.c b/core/fs/fat/fat.c
index cc9b48b3..b272da7d 100644
--- a/core/fs/fat/fat.c
+++ b/core/fs/fat/fat.c
@@ -524,21 +524,6 @@ static struct inode *vfat_iget(char *dname, struct inode *parent)
return vfat_find_entry(dname, parent);
}
-static char current_dir_name[32];
-static struct inode *vfat_iget_current(void)
-{
- com32sys_t regs;
- /*
- * Use ConfigName again.
- */
- memset(&regs, 0, sizeof regs);
- regs.edi.w[0] = OFFS_WRT(ConfigName, 0);
- strcpy((void *)regs.edi.w[0], current_dir_name);
- call16(core_open, &regs, &regs);
-
- return handle_to_file(regs.esi.w[0])->inode;
-}
-
/*
* The open dir function, just call the searchdir function directly.
* I don't think we need call the mangle_name function first
@@ -583,22 +568,6 @@ static int vfat_load_config(void)
return 1; /* no config file */
}
- /* Build the Current inode */
- strcpy(current_dir_name, syslinux_cfg[i]);
- current_dir_name[strlen(syslinux_cfg[i]) - strlen(config_name)] = '\0';
- this_inode = vfat_iget_current();
-
- memset(&regs, 0, sizeof regs);
- regs.edi.w[0] = OFFS_WRT(ConfigName, 0);
- for (; i < 3; i++) {
- strcpy(ConfigName, syslinux_cfg[i]);
- call16(core_open, &regs, &regs);
-
- /* if zf flag set, then failed; try another */
- if (! (regs.eflags.l & EFLAGS_ZF))
- break;
- }
-
strcpy(ConfigName, config_name);
return 0;
}
@@ -655,7 +624,7 @@ static int vfat_fs_init(struct fs_info *fs)
const struct fs_ops vfat_fs_ops = {
.fs_name = "vfat",
- .fs_flags = FS_USEMEM,
+ .fs_flags = FS_USEMEM | FS_THISIND,
.fs_init = vfat_fs_init,
.searchdir = NULL,
.getfssec = vfat_getfssec,
@@ -666,6 +635,6 @@ const struct fs_ops vfat_fs_ops = {
.opendir = vfat_opendir,
.readdir = NULL,
.iget_root = vfat_iget_root,
- .iget_current = vfat_iget_current,
+ .iget_current = NULL,
.iget = vfat_iget,
};
diff --git a/core/include/fs.h b/core/include/fs.h
index 31d68854..bee63188 100644
--- a/core/include/fs.h
+++ b/core/include/fs.h
@@ -32,8 +32,14 @@ extern struct fs_info *this_fs;
struct dirent; /* Directory entry structure */
struct file;
enum fs_flags {
- FS_NODEV = 1 << 0,
- FS_USEMEM = 1 << 1, /* If we need a malloc routine, set it */
+ FS_NODEV = 1 << 0,
+ FS_USEMEM = 1 << 1, /* If we need a malloc routine, set it */
+
+ /*
+ * Update the this_inode pointer at each part of path searching. This
+ * flag is just used for FAT and ISO fs for now.
+ */
+ FS_THISIND = 1 << 2,
};
struct fs_ops {