diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cramfs/Makefile | 4 | ||||
-rw-r--r-- | fs/ext2/Makefile | 4 | ||||
-rw-r--r-- | fs/fat/Makefile | 4 | ||||
-rw-r--r-- | fs/fdos/Makefile | 4 | ||||
-rw-r--r-- | fs/jffs2/Makefile | 4 | ||||
-rw-r--r-- | fs/reiserfs/Makefile | 4 | ||||
-rw-r--r-- | fs/ubifs/Makefile | 4 | ||||
-rw-r--r-- | fs/ubifs/super.c | 2 | ||||
-rw-r--r-- | fs/ubifs/ubifs.c | 73 | ||||
-rw-r--r-- | fs/yaffs2/Makefile | 4 |
10 files changed, 76 insertions, 31 deletions
diff --git a/fs/cramfs/Makefile b/fs/cramfs/Makefile index 7b6cc0a..5f41932 100644 --- a/fs/cramfs/Makefile +++ b/fs/cramfs/Makefile @@ -23,7 +23,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libcramfs.a +LIB = $(obj)libcramfs.o AOBJS = COBJS-$(CONFIG_CMD_CRAMFS) := cramfs.o @@ -37,7 +37,7 @@ OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS-y)) all: $(LIB) $(AOBJS) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/fs/ext2/Makefile b/fs/ext2/Makefile index 712e348..3c65d25 100644 --- a/fs/ext2/Makefile +++ b/fs/ext2/Makefile @@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libext2fs.a +LIB = $(obj)libext2fs.o AOBJS = COBJS-$(CONFIG_CMD_EXT2) := ext2fs.o dev.o @@ -40,7 +40,7 @@ OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS-y)) all: $(LIB) $(AOBJS) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/fs/fat/Makefile b/fs/fat/Makefile index b711460..bc45966 100644 --- a/fs/fat/Makefile +++ b/fs/fat/Makefile @@ -21,7 +21,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libfat.a +LIB = $(obj)libfat.o AOBJS = COBJS-$(CONFIG_CMD_FAT) := fat.o file.o @@ -32,7 +32,7 @@ OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS-y)) all: $(LIB) $(AOBJS) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/fs/fdos/Makefile b/fs/fdos/Makefile index fce2032..9cd4d91 100644 --- a/fs/fdos/Makefile +++ b/fs/fdos/Makefile @@ -28,7 +28,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libfdos.a +LIB = $(obj)libfdos.o AOBJS = COBJS-$(CONFIG_CMD_FDOS) := fat.o vfat.o dev.o fdos.o fs.o subdir.o @@ -41,7 +41,7 @@ OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS-y)) all: $(LIB) $(AOBJS) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/fs/jffs2/Makefile b/fs/jffs2/Makefile index 7c9fb41..6db6145 100644 --- a/fs/jffs2/Makefile +++ b/fs/jffs2/Makefile @@ -23,7 +23,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libjffs2.a +LIB = $(obj)libjffs2.o AOBJS = ifdef CONFIG_CMD_JFFS2 @@ -44,7 +44,7 @@ OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS)) all: $(LIB) $(AOBJS) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/fs/reiserfs/Makefile b/fs/reiserfs/Makefile index 9cef8ee..495759c 100644 --- a/fs/reiserfs/Makefile +++ b/fs/reiserfs/Makefile @@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libreiserfs.a +LIB = $(obj)libreiserfs.o AOBJS = COBJS-$(CONFIG_CMD_REISER) := reiserfs.o dev.o mode_string.o @@ -40,7 +40,7 @@ OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS-y)) all: $(LIB) $(AOBJS) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/fs/ubifs/Makefile b/fs/ubifs/Makefile index 8328843..ccffe85 100644 --- a/fs/ubifs/Makefile +++ b/fs/ubifs/Makefile @@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk -LIB = $(obj)libubifs.a +LIB = $(obj)libubifs.o COBJS-$(CONFIG_CMD_UBIFS) := ubifs.o io.o super.o sb.o master.o lpt.o COBJS-$(CONFIG_CMD_UBIFS) += lpt_commit.o scan.o lprops.o @@ -40,7 +40,7 @@ OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS-y)) all: $(LIB) $(AOBJS) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) ######################################################################### diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 39e3efe..63b2164 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -824,7 +824,7 @@ out_free: * through mounting (error path cleanup function). So it has to make sure the * resource was actually allocated before freeing it. */ -static void ubifs_umount(struct ubifs_info *c) +void ubifs_umount(struct ubifs_info *c) { dbg_gen("un-mounting UBI device %d, volume %d", c->vi.ubi_num, c->vi.vol_id); diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index 1cc31a9..5a5c739 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -3,7 +3,7 @@ * * Copyright (C) 2006-2008 Nokia Corporation. * - * (C) Copyright 2008-2009 + * (C) Copyright 2008-2010 * Stefan Roese, DENX Software Engineering, sr@denx.de. * * This program is free software; you can redistribute it and/or modify it @@ -384,6 +384,7 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename) unsigned long root_inum = 1; unsigned long inum; int symlink_count = 0; /* Don't allow symlink recursion */ + char link_name[64]; strcpy(fpath, filename); @@ -420,7 +421,6 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename) ui = ubifs_inode(inode); if ((inode->i_mode & S_IFMT) == S_IFLNK) { - char link_name[64]; char buf[128]; /* We have some sort of symlink recursion, bail out */ @@ -567,7 +567,8 @@ dump: return -EINVAL; } -static int do_readpage(struct ubifs_info *c, struct inode *inode, struct page *page) +static int do_readpage(struct ubifs_info *c, struct inode *inode, + struct page *page, int last_block_size) { void *addr; int err = 0, i; @@ -601,17 +602,54 @@ static int do_readpage(struct ubifs_info *c, struct inode *inode, struct page *p err = -ENOENT; memset(addr, 0, UBIFS_BLOCK_SIZE); } else { - ret = read_block(inode, addr, block, dn); - if (ret) { - err = ret; - if (err != -ENOENT) + /* + * Reading last block? Make sure to not write beyond + * the requested size in the destination buffer. + */ + if (((block + 1) == beyond) || last_block_size) { + void *buff; + int dlen; + + /* + * We need to buffer the data locally for the + * last block. This is to not pad the + * destination area to a multiple of + * UBIFS_BLOCK_SIZE. + */ + buff = malloc(UBIFS_BLOCK_SIZE); + if (!buff) { + printf("%s: Error, malloc fails!\n", + __func__); + err = -ENOMEM; break; - } else if (block + 1 == beyond) { - int dlen = le32_to_cpu(dn->size); - int ilen = i_size & (UBIFS_BLOCK_SIZE - 1); - - if (ilen && ilen < dlen) - memset(addr + ilen, 0, dlen - ilen); + } + + /* Read block-size into temp buffer */ + ret = read_block(inode, buff, block, dn); + if (ret) { + err = ret; + if (err != -ENOENT) { + free(buff); + break; + } + } + + if (last_block_size) + dlen = last_block_size; + else + dlen = le32_to_cpu(dn->size); + + /* Now copy required size back to dest */ + memcpy(addr, buff, dlen); + + free(buff); + } else { + ret = read_block(inode, addr, block, dn); + if (ret) { + err = ret; + if (err != -ENOENT) + break; + } } } if (++i >= UBIFS_BLOCKS_PER_PAGE) @@ -649,6 +687,7 @@ int ubifs_load(char *filename, u32 addr, u32 size) int err = 0; int i; int count; + int last_block_size = 0; c->ubi = ubi_open_volume(c->vi.ubi_num, c->vi.vol_id, UBI_READONLY); /* ubifs_findfile will resolve symlinks, so we know that we get @@ -684,7 +723,13 @@ int ubifs_load(char *filename, u32 addr, u32 size) page.index = 0; page.inode = inode; for (i = 0; i < count; i++) { - err = do_readpage(c, inode, &page); + /* + * Make sure to not read beyond the requested size + */ + if (((i + 1) == count) && (size < inode->i_size)) + last_block_size = size - (i * PAGE_SIZE); + + err = do_readpage(c, inode, &page, last_block_size); if (err) break; diff --git a/fs/yaffs2/Makefile b/fs/yaffs2/Makefile index a2ef5e2..7753cfc 100644 --- a/fs/yaffs2/Makefile +++ b/fs/yaffs2/Makefile @@ -19,7 +19,7 @@ #EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC include $(TOPDIR)/config.mk -LIB = $(obj)libyaffs2.a +LIB = $(obj)libyaffs2.o COBJS-$(CONFIG_YAFFS2) := \ yaffscfg.o yaffs_ecc.o yaffsfs.o yaffs_guts.o yaffs_packedtags1.o \ @@ -36,7 +36,7 @@ CFLAGS += -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YA all: $(LIB) $(LIB): $(obj).depend $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) + $(call cmd_link_o_target, $(OBJS)) .PHONY: clean distclean clean: |