diff options
author | Matt Fleming <matt.fleming@intel.com> | 2013-01-29 14:01:07 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2013-01-29 15:11:28 +0000 |
commit | bf20364b582c383b4927f898de213b1cc0981a80 (patch) | |
tree | 5412e0c14cf74df0d7ea29ff182e23d3281aac3e /core/fs/fs.c | |
parent | afd985f6eec18a0f66a8fc55f9c5e3431128310f (diff) | |
parent | a2d79191b501276026a0a16ec2fa664630a20476 (diff) | |
download | syslinux-bf20364b582c383b4927f898de213b1cc0981a80.tar.gz |
Merge tag 'syslinux-5.01' into firmwaresyslinux-6.00-pre4
Conflicts:
Makefile
NEWS
com32/cmenu/Makefile
com32/elflink/ldlinux/Makefile
com32/gfxboot/Makefile
com32/gpllib/Makefile
com32/include/sys/module.h
com32/lib/Makefile
com32/lib/sys/module/elf_module.c
com32/menu/Makefile
com32/rosh/Makefile
com32/samples/Makefile
core/init.c
mk/elf.mk
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'core/fs/fs.c')
-rw-r--r-- | core/fs/fs.c | 118 |
1 files changed, 6 insertions, 112 deletions
diff --git a/core/fs/fs.c b/core/fs/fs.c index 40f97d5e..adcee916 100644 --- a/core/fs/fs.c +++ b/core/fs/fs.c @@ -40,9 +40,13 @@ struct inode *alloc_inode(struct fs_info *fs, uint32_t ino, size_t data) */ void put_inode(struct inode *inode) { - while (inode && --inode->refcnt == 0) { + while (inode) { struct inode *dead = inode; - inode = inode->parent; + int refcnt = --(dead->refcnt); + dprintf("put_inode %p name %s refcnt %u\n", dead, dead->name, refcnt); + if (refcnt) + break; /* We still have references */ + inode = dead->parent; if (dead->name) free((char *)dead->name); free(dead); @@ -108,77 +112,11 @@ __export int open_config(void) return fd; } -void pm_mangle_name(com32sys_t *regs) -{ - const char *src = MK_PTR(regs->ds, regs->esi.w[0]); - char *dst = MK_PTR(regs->es, regs->edi.w[0]); - - mangle_name(dst, src); -} - __export void mangle_name(char *dst, const char *src) { this_fs->fs_ops->mangle_name(dst, src); } -void getfssec(com32sys_t *regs) -{ - int sectors; - bool have_more; - uint32_t bytes_read; - char *buf; - struct file *file; - uint16_t handle; - - sectors = regs->ecx.w[0]; - - handle = regs->esi.w[0]; - file = handle_to_file(handle); - - buf = MK_PTR(regs->es, regs->ebx.w[0]); - bytes_read = file->fs->fs_ops->getfssec(file, buf, sectors, &have_more); - - /* - * If we reach EOF, the filesystem driver will have already closed - * the underlying file... this really should be cleaner. - */ - if (!have_more) { - _close_file(file); - regs->esi.w[0] = 0; - } - - regs->ecx.l = bytes_read; -} - -void getfsbytes(com32sys_t *regs) -{ - int sectors; - bool have_more; - uint32_t bytes_read; - char *buf; - struct file *file; - uint16_t handle; - - handle = regs->esi.w[0]; - file = handle_to_file(handle); - - sectors = regs->ecx.w[0] >> SECTOR_SHIFT(file->fs); - - buf = MK_PTR(regs->es, regs->ebx.w[0]); - bytes_read = file->fs->fs_ops->getfssec(file, buf, sectors, &have_more); - - /* - * If we reach EOF, the filesystem driver will have already closed - * the underlying file... this really should be cleaner. - */ - if (!have_more) { - _close_file(file); - regs->esi.w[0] = 0; - } - - regs->ecx.l = bytes_read; -} - size_t pmapi_read_file(uint16_t *handle, void *buf, size_t sectors) { bool have_more; @@ -200,23 +138,6 @@ size_t pmapi_read_file(uint16_t *handle, void *buf, size_t sectors) return bytes_read; } -void pm_searchdir(com32sys_t *regs) -{ - char *name = MK_PTR(regs->ds, regs->edi.w[0]); - int rv; - - rv = searchdir(name); - if (rv < 0) { - regs->esi.w[0] = 0; - regs->eax.l = 0; - regs->eflags.l |= EFLAGS_ZF; - } else { - regs->esi.w[0] = rv; - regs->eax.l = handle_to_file(rv)->inode->size; - regs->eflags.l &= ~EFLAGS_ZF; - } -} - int searchdir(const char *name) { static char root_name[] = "/"; @@ -444,28 +365,6 @@ __export int open_file(const char *name, struct com32_filedata *filedata) return rv; } -void pm_open_file(com32sys_t *regs) -{ - int rv; - struct file *file; - 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) { - regs->eflags.l |= EFLAGS_CF; - } else { - file = handle_to_file(rv); - regs->eflags.l &= ~EFLAGS_CF; - regs->eax.l = file->inode->size; - regs->ecx.w[0] = SECTOR_SIZE(file->fs); - regs->esi.w[0] = rv; - } -} - __export void close_file(uint16_t handle) { struct file *file; @@ -476,11 +375,6 @@ __export void close_file(uint16_t handle) } } -void pm_close_file(com32sys_t *regs) -{ - close_file(regs->esi.w[0]); -} - /* * it will do: * initialize the memory management function; |