summaryrefslogtreecommitdiff
path: root/core/fs/fs.c
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-07-27 10:41:30 +0100
committerMatt Fleming <matt.fleming@intel.com>2012-07-30 09:51:36 +0100
commit0d6f330878173c7ba45b884f3e41ce40b917c73c (patch)
tree0a887066d35d8b01914330d6ab6818fe015a5a9d /core/fs/fs.c
parent0fcd9a48603497dcc2727570a50a4401bb0fd085 (diff)
parentf0bbf9dd40f37f8c4870a33784996efd56955a75 (diff)
downloadsyslinux-0d6f330878173c7ba45b884f3e41ce40b917c73c.tar.gz
Merge remote-tracking branch 'mfleming/elflink' into for-hpa/elflink/firmware
Conflicts: Makefile com32/elflink/ldlinux/adv.c com32/elflink/ldlinux/kernel.c com32/elflink/ldlinux/ldlinux.c com32/include/bitsize/stddef.h com32/include/bitsize/stdint.h com32/include/stdint.h com32/include/sys/module.h com32/include/sys/x86_64/bitops.h com32/include/syslinux/linux.h com32/lib/Makefile com32/lib/sys/ansicon_write.c com32/lib/sys/module/elfutils.h com32/lib/sys/vesa/efi/fill.h com32/lib/syslinux/load_linux.c com32/lib/syslinux/serial.c com32/lib/syslinux/shuffle.c core/conio.c core/elflink/config.c core/elflink/load_env32.c core/graphics.c core/include/graphics.h core/init.c core/pxelinux.asm mk/elf.mk mk/lib.mk
Diffstat (limited to 'core/fs/fs.c')
-rw-r--r--core/fs/fs.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/core/fs/fs.c b/core/fs/fs.c
index e6f35370..d8abaa69 100644
--- a/core/fs/fs.c
+++ b/core/fs/fs.c
@@ -2,13 +2,14 @@
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
+#include <unistd.h>
#include <dprintf.h>
#include "core.h"
#include "dev.h"
#include "fs.h"
#include "cache.h"
-char *PATH = ".:/bin/";
+char *PATH;
/* The currently mounted filesystem */
struct fs_info *this_fs = NULL; /* Root filesystem */
@@ -42,6 +43,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);
}
}
@@ -223,6 +226,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;
@@ -321,6 +327,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;
@@ -365,6 +374,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);
@@ -392,6 +403,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) {
@@ -479,6 +492,7 @@ void fs_init(const struct fs_ops **ops, struct disk_private *priv)
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);
}
if (fs.fs_ops->chdir_start) {