aboutsummaryrefslogtreecommitdiffstats
path: root/core/fs/fs.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2012-06-28 19:33:16 -0700
committerH. Peter Anvin <hpa@zytor.com>2012-06-28 19:33:16 -0700
commit15cbfdfd390402057d237664ac087140608bf80b (patch)
treebe6d0d99b2c360d400c4d664c37a28a7254b21ba /core/fs/fs.c
parent255fd8e592d2fb014e4a13a98655aed0bf9d6121 (diff)
downloadsyslinux-15cbfdfd390402057d237664ac087140608bf80b.tar.gz
syslinux-15cbfdfd390402057d237664ac087140608bf80b.tar.xz
syslinux-15cbfdfd390402057d237664ac087140608bf80b.zip
Actually keep track of the pathnames for all elementssyslinux-4.06-pre9
Actually keep track of the pathnames for all elements for on-disk filesystems. This makes sure we can always reconstruct the correct path. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'core/fs/fs.c')
-rw-r--r--core/fs/fs.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/fs/fs.c b/core/fs/fs.c
index ad2fb370..21f5dba0 100644
--- a/core/fs/fs.c
+++ b/core/fs/fs.c
@@ -37,6 +37,8 @@ void put_inode(struct inode *inode)
while (inode && --inode->refcnt == 0) {
struct inode *dead = inode;
inode = inode->parent;
+ if (dead->name)
+ free((char *)dead->name);
free(dead);
}
}
@@ -207,6 +209,9 @@ int searchdir(const char *name)
char *part, *p, echar;
int symlink_count = MAX_SYMLINK_CNT;
+ dprintf("searchdir: %s root: %p cwd: %p\n",
+ name, this_fs->root, this_fs->cwd);
+
if (!(file = alloc_file()))
goto err_no_close;
file->fs = this_fs;
@@ -305,6 +310,9 @@ int searchdir(const char *name)
goto got_link;
}
+ inode->name = strdup(part);
+ dprintf("path component: %s\n", inode->name);
+
inode->parent = parent;
parent = NULL;
@@ -349,6 +357,8 @@ int open_file(const char *name, struct com32_filedata *filedata)
struct file *file;
char mangled_name[FILENAME_MAX];
+ dprintf("open_file %s\n", name);
+
mangle_name(mangled_name, name);
rv = searchdir(mangled_name);
@@ -376,6 +386,8 @@ void pm_open_file(com32sys_t *regs)
const char *name = MK_PTR(regs->es, regs->esi.w[0]);
char mangled_name[FILENAME_MAX];
+ dprintf("pm_open_file %s\n", name);
+
mangle_name(mangled_name, name);
rv = searchdir(mangled_name);
if (rv < 0) {
@@ -470,6 +482,7 @@ void fs_init(com32sys_t *regs)
if (fs.fs_ops->iget_root) {
fs.root = fs.fs_ops->iget_root(&fs);
fs.cwd = get_inode(fs.root);
+ dprintf("init: root inode %p, cwd inode %p\n", fs.root, fs.cwd);
}
SectorShift = fs.sector_shift;