summaryrefslogtreecommitdiff
path: root/fs
Commit message (Collapse)AuthorAgeLines
...
* fs/fat: Improve error handlingKyle Moffett2012-01-05-4/+14
| | | | | | | | | | | | | | | | | | | | The FAT filesystem fails silently in inexplicable ways when given a filesystem with a block-size that does not match the device sector size. In theory this is not an unsupportable combination but requires a major rewrite of a lot of the filesystem. Until that occurs, the filesystem should detect that scenario and display a helpful error message. This scenario in particular occurred on a 512-byte blocksize FAT fs stored in an El-Torito boot volume on a CD-ROM (2048-byte sector size). Additionally, in many circumstances the ->block_read method will not return a negative number to indicate an error but instead return 0 to indicate the number of blocks successfully read (IE: None). The FAT filesystem should defensively check to ensure that it got all of the sectors that it asked for when reading. Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
* fs/fat: Fix FAT detection to support non-DOS partition tablesKyle Moffett2012-01-05-63/+52
| | | | | | | | | | | | | | | | | | | The FAT filesystem code currently ends up requiring that the partition table be a DOS MBR, as it checks for the DOS 0x55 0xAA signature on the partition table (which may be Mac, EFI, ISO9660, etc) before actually computing the partition offset. This fixes support for accessing a FAT filesystem in an ISO9660 boot volume (El-Torito format) by reordering the filesystem checks and reading the 0x55 0xAA "DOS boot signature" and FAT/FAT32 magic number from the first sector of the partition instead of from sector 0. Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com> Fix build warning: fat.c: In function 'fat_register_device': fat.c:66:15: warning: variable 'found_partition' set but not used [-Wunused-but-set-variable] Signed-off-by: Wolfgang Denk <wd@denx.de>
* ext2: Cache line align indirection buffersSimon Glass2012-01-05-6/+12
| | | | | | | | Make ext2 use cache line aligned buffers for reading from the filesystem. This is needed when caches are enabled because unaligned cache invalidates are not safe. Signed-off-by: Simon Glass <sjg@chromium.org>
* fat: reset VFAT short alias checksum on first matchSergei Shtylyov2012-01-05-0/+2
| | | | | | | | | | The VFAT short alias checksum read from a long file name is only overwritten when another long file name appears in a directory list. Until then it renders short file names invisible that have the same checksum. Reset the checksum on first match. Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Martin Mueller <martin.mueller5@de.bosch.com>
* Merge branch 'next' of ../nextWolfgang Denk2011-12-23-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'next' of ../next: mkenvimage: Add version info switch (-V) mkenvimage: Fix getopt() error handling mkenvimage: Fix some typos phy: add Micrel KS8721BL phy definition net: introduce per device index mvgbe: remove setting of ethaddr within the driver x86: Add support for specifying an initrd with the zboot command x86: Refactor the zboot innards so they can be reused with a vboot image x86: Add infrastructure to extract an e820 table from the coreboot tables x86: Add support for booting Linux using the 32 bit boot protocol x86: Clean up the x86 zimage code in preparation to extend it x86: Import code from coreboot's libpayload to parse the coreboot table x86: Initial commit for running as a coreboot payload CHECKPATCH: ./board/esd/hh405/logo_320_240_8bpp.c CHECKPATCH: ./board/esd/hh405/logo_1024_768_8bpp.c CHECKPATCH: ./board/esd/hh405/logo_320_240_4bpp.c CHECKPATCH: ./board/esd/hh405/logo_640_480_24bpp.c CHECKPATCH: ./board/esd/apc405/logo_640_480_24bpp.c CHECKPATCH: ./board/esd/voh405/logo_320_240_4bpp.c CHECKPATCH: ./board/esd/voh405/logo_640_480_24bpp.c CHECKPATCH: ./board/esd/hh405/fpgadata.c CHECKPATCH: ./board/esd/pci405/fpgadata.c CHECKPATCH: ./board/esd/tasreg/fpgadata.c CHECKPATCH: ./board/esd/apc405/fpgadata.c CHECKPATCH: ./board/esd/voh405/fpgadata.c CHECKPATCH: ./board/esd/ash405/fpgadata.c CHECKPATCH: ./board/esd/dasa_sim/fpgadata.c CHECKPATCH: ./board/esd/ar405/fpgadata_xl30.c CHECKPATCH: ./board/esd/ar405/fpgadata.c CHECKPATCH: ./board/esd/plu405/fpgadata.c CHECKPATCH: ./board/esd/wuh405/fpgadata.c CHECKPATCH: ./board/esd/cpci405/fpgadata_cpci405.c CHECKPATCH: ./board/esd/cpci405/fpgadata_cpci405ab.c CHECKPATCH: ./board/esd/cpci405/fpgadata_cpci4052.c CHECKPATCH: ./board/esd/canbt/fpgadata.c CHECKPATCH: ./board/esd/du405/fpgadata.c CHECKPATCH: ./board/esd/cpciiser4/fpgadata.c CHECKPATCH: ./board/dave/PPChameleonEVB/fpgadata.c avr32:mmu.c: fix printf() length modifier fat.c: fix printf() length modifier cmd_sf.c: fix printf() length modifier Make printf and vprintf safe from buffer overruns vsprintf: Move function documentation into header file Add safe vsnprintf and snprintf library functions Move vsprintf functions into their own header Conflicts: tools/mkenvimage.c Signed-off-by: Wolfgang Denk <wd@denx.de>
| * fat.c: fix printf() length modifierAndreas Bießmann2011-12-17-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The DIRENTSPERBLOCK utilizes sizeof() which will return a size_t which has no fixed size. Therefor use correct length modifer for printf() statement to prevent compiler warnings. This patch fixes following warning: ---8<--- fat.c: In function 'do_fat_read': fat.c:879: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int' --->8--- Signed-off-by: Andreas Bießmann <biessmann@corscience.de> cc: Mike Frysinger <vapier@gentoo.org> cc: Thomas Chou <thomas@wytron.com.tw> cc: rjones@nexus-tech.net cc: kharris@nexus-tech.net Acked-by: Mike Frysinger <vapier@gentoo.org>
* | FAT: fix some issues in FAT write support codeAnatolij Gustschin2011-12-20-5/+14
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Writing a file to the FAT partition didn't work while a test using a CF card. The test was done on mpc5200 based board (powerpc). There is a number of problems in FAT write code: Compiler warning: fat_write.c: In function 'file_fat_write': fat_write.c:326: warning: 'counter' may be used uninitialized in this function fat_write.c:326: note: 'counter' was declared here 'l_filename' string is not terminated, so a file name with garbage at the end is used as a file name as shown by debug code. Return value of set_contents() is not checked properly so actually a file won't be written at all (as checked using 'fatls' after a write attempt with 'fatwrite' command). do_fat_write() doesn't return the number of written bytes if no error happened. However the return value of this function is used to show the number of written bytes in do_fat_fswrite(). The patch adds some debug code and fixes above mentioned problems and also fixes a typo in error output. NOTE: after a successful write to the FAT partition (under U-Boot) the partition was checked under Linux using fsck. The partition needed fixing FATs: -bash-3.2# fsck -a /dev/sda1 fsck 1.39 (29-May-2006) dosfsck 2.11, 12 Mar 2005, FAT32, LFN FATs differ but appear to be intact. Using first FAT. Performing changes. Signed-off-by: Anatolij Gustschin <agust@denx.de> Cc: Donggeun Kim <dg77.kim@samsung.com> Cc: Aaron Williams <Aaron.Williams@cavium.com> Acked-by: Donggeun Kim <dg77.kim@samsung.com>
* fs/reiserfs/reiserfs.c: Fix compiler warningAnatolij Gustschin2011-12-12-1/+3
| | | | | | | | | Fix: reiserfs.c: In function 'reiserfs_mount': reiserfs.c:360:22: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] Signed-off-by: Anatolij Gustschin <agust@denx.de>
* fs/yaffs2/yaffs_guts.c: Fix GCC 4.6 compile warning (and bug)Wolfgang Denk2011-12-10-1/+1
| | | | | | | | | | | | | | | Fix: yaffs_guts.c: In function 'yaffs_GarbageCollectBlock': yaffs_guts.c:2761:6: warning: variable 'retVal' set but not used [-Wunused-but-set-variable] Here GCC actually detected a bug. The code was always returning OK instead of the previously set retrun code. Fix that. Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: William Juul <wiljuul@cisco.com> Cc: Scott Wood <scottwood@freescale.com> Acked-by: William Juul <wiljuul@cisco.com>
* Fix warnings in yaffsSimon Glass2011-11-16-8/+7
| | | | | | | | | | | | | | | | | | | Sorry if this is already fixed somewhere - I could not find it. This fixes the warnings show below. yaffs_tagscompat.c: In function 'yaffs_TagsCompatabilityReadChunkWithTagsFromNAND': yaffs_tagscompat.c:151: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:150: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:149: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:148: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:147: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:146: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:145: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:144: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:141: note: initialized from here Signed-off-by: Simon Glass <sjg@chromium.org>
* fs/yaffs2/yaffs_guts.c: Fix some GCC 4.6 warningsAnatolij Gustschin2011-11-16-23/+9
| | | | | | | | | | | | | | | | | | | | | | | Fix: yaffs_guts.c: In function 'yaffs_CheckChunkErased': yaffs_guts.c:854:6: warning: variable 'result' set but not used yaffs_guts.c: In function 'yaffs_UpdateObjectHeader': yaffs_guts.c:3463:6: warning: variable 'result' set but not used yaffs_guts.c: In function 'yaffs_GrabChunkCache': yaffs_guts.c:3774:6: warning: variable 'pushout' set but not used yaffs_guts.c: In function 'yaffs_Scan': yaffs_guts.c:5237:6: warning: variable 'result' set but not used yaffs_guts.c: In function 'yaffs_CheckObjectDetailsLoaded': yaffs_guts.c:5748:6: warning: variable 'alloc_failed' set but not used yaffs_guts.c:5747:6: warning: variable 'result' set but not used yaffs_guts.c: In function 'yaffs_ScanBackwards': yaffs_guts.c:5808:6: warning: variable 'deleted' set but not used yaffs_guts.c:5806:6: warning: variable 'result' set but not used yaffs_guts.c: In function 'yaffs_GetObjectName': yaffs_guts.c:6657:7: warning: variable 'result' set but not used [-Wunused-but-set-variable] Signed-off-by: Anatolij Gustschin <agust@denx.de>
* fs/fat/fat.c: Fix GCC 4.6 build warningWolfgang Denk2011-11-07-16/+19
| | | | | | | | | Fix: fat.c: In function 'fat_register_device': fat.c:74:19: warning: variable 'info' set but not used [-Wunused-but-set-variable] Signed-off-by: Wolfgang Denk <wd@denx.de>
* GCC4.6: Squash warnings in yaffs_guts.cMarek Vasut2011-10-27-6/+6
| | | | | | | | | | | | | | | | | | | | yaffs_guts.c: In function 'yaffs_ReadDataFromFile': yaffs_guts.c:4461:8: warning: 'chunk' may be used uninitialized in this function yaffs_guts.c:4462:8: warning: 'start' may be used uninitialized in this function yaffs_guts.c: In function 'yaffs_WriteDataToFile': yaffs_guts.c:4581:8: warning: 'chunk' may be used uninitialized in this function yaffs_guts.c:4582:8: warning: 'start' may be used uninitialized in this function yaffs_guts.c: In function 'yaffs_ResizeFile': yaffs_guts.c:4816:8: warning: 'newSizeOfPartialChunk' may be used uninitialized in this function yaffs_guts.c:4817:8: warning: 'newFullChunks' may be used uninitialized in this function Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Mike Frysinger <vapier@gentoo.org> Cc: William Juul <william.juul@tandberg.com>
* GCC4.6: Drop dead code from yaffs_guts.cMarek Vasut2011-10-27-149/+0
| | | | | | | | | | | | | Drop yaffs_DeleteWorker(): yaffs_guts.c:1556:12: warning: 'yaffs_DeleteWorker' defined but not used Drop yaffs_VerifyTnodeWorker(): yaffs_guts.c:600:12: warning: 'yaffs_VerifyTnodeWorker' defined but not used Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Mike Frysinger <vapier@gentoo.org>
* fat: correct ATTR_VFAT checkJ. Vijayanand2011-10-27-3/+3
| | | | | | | | | ATTR_VFAT condition requires multiple bits to be set but the present condition checking in do_fat_read() & get_dentfromdir() ends up passing on even a single bit being set. Signed-off-by: J. Vijayanand <vijayanand.jayaraman@in.bosch.com> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
* fs/fat/fat.c: fix warning: 'part_size' defined but not usedWolfgang Denk2011-10-27-2/+0
| | | | | | | | | Commit c30a15e "FAT: Add FAT write feature" introduced a compiler warning. Fix this. Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Donggeun Kim <dg77.kim@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com>
* FAT: Add FAT write featureDonggeun Kim2011-10-26-0/+1093
| | | | | | | | | | | | | | In some cases, saving data in RAM as a file with FAT format is required. This patch allows the file to be written in FAT formatted partition. The usage is similar with reading a file. First, fat_register_device function is called before file_fat_write function in order to set target partition. Then, file_fat_write function is invoked with desired file name, start ram address for writing data, and file size. Signed-off-by: Donggeun Kim <dg77.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
* ext2: Cache line aligned partial sector bounce bufferAnton staaf2011-10-25-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Currently, if a device read request is done that does not begin or end on a sector boundary a stack allocated bounce buffer is used to perform the read, and then just the part of the sector that is needed is copied into the users buffer. This stack allocation can mean that the bounce buffer will not be aligned to the dcache line size. This is a problem when caches are enabled because unaligned cache invalidates are not safe. This patch uses ALLOC_CACHE_ALIGN_BUFFER to create a stack allocated cache line size aligned bounce buffer. Signed-off-by: Anton Staaf <robotboy@chromium.org> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Dave Liu <r63238@freescale.com> Cc: Andy Fleming <afleming@gmail.com> Cc: Albert ARIBAUD <albert.u.boot@aribaud.net> Change-Id: I32e1594d90ef039137bb219b0f7ced55768744ff Acked-by: Mike Frysinger <vapier@gentoo.org>
* punt unused clean/distclean targetsMike Frysinger2011-10-15-7/+0
| | | | | | | | | | The top level Makefile does not do any recursion into subdirs when cleaning, so these clean/distclean targets in random arch/board dirs never get used. Punt them all. MAKEALL didn't report any errors related to this that I could see. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* ubifs bad superblock bugLars Poeschel2011-10-12-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | This patch fixes an issue when ubifs reads a bad superblock. Later it tries to free memory, that was not allocated, which freezes u-boot. This is fixed by looking for a non null pointer before free. The message I got before u-boot freezes: UBI: max/mean erase counter: 53/32 UBIFS: mounted UBI device 0, volume 1, name "rootfs" UBIFS: mounted read-only UBIFS: file system size: 49140 bytes (50319360 KiB, 0 MiB, 49140 LEBs) UBIFS: journal size: 49 bytes (6838272 KiB, 0 MiB, 6678 LEBs) UBIFS: media format: w4/r0 (latest is w4/r0) UBIFS: default compressor: LZO UBIFS: reserved for root: 0 bytes (0 KiB) UBIFS error (pid 0): ubifs_read_node: bad node type (255 but expected 9) UBIFS error (pid 0): ubifs_read_node: bad node at LEB 330:13104 UBIFS error (pid 0): ubifs_iget: failed to read inode 1, error -22 Error reading superblock on volume 'ubi:rootfs'! Signed-off-by: Lars Poeschel <larsi@wh2.tu-dresden.de> Cc: Kyungmin Park <kmpark@infradead.org> Signed-off-by: Stefan Roese <sr@denx.de>
* fs/jffs2/jffs2_1pass.c: fix warning: variable ... set but not usedWolfgang Denk2011-10-09-10/+4
| | | | | | | | | | Fix: jffs2_1pass.c: In function 'jffs2_1pass_read_inode': jffs2_1pass.c:699:7: warning: variable 'ret' set but not used [-Wunused-but-set-variable] jffs2_1pass.c: In function 'jffs2_1pass_build_lists': jffs2_1pass.c:1578:14: warning: variable 'empty_start' set but not used [-Wunused-but-set-variable] Signed-off-by: Wolfgang Denk <wd@denx.de>
* fat: replace LINEAR_PREFETCH_SIZE with PREFETCH_BLOCKSSergei Shtylyov2011-10-01-5/+4
| | | | | | | | | Currently in do_fat_read() when reading FAT sectors, we have to divide down LINEAR_PREFETCH_SIZE by the sector size, whereas it's defined as 2 sectors worth of bytes. In order to avoid redundant multiplication/division, introduce #define PREFETCH_BLOCKS instead of #define LINEAR_PREFETCH_SIZE. Signed-off-by: Sergei Shtylyov <sshtylyov@mvista.com>
* fat: root directory cluster only makes sense for FAT32Sergei Shtylyov2011-10-01-8/+6
| | | | | | | | | The root directory cluster field only exists in a FAT32 boot sector, so the 'root_cluster' variable in do_fat_read() contains garbage in case of FAT12/16. Make it contain 0 instead as this is what is passed to get_vfatname() in that case anyway. Signed-off-by: Sergei Shtylyov <sshtylyov@mvista.com>
* fat: cannot compare bytes and sectorsSergei Shtylyov2011-10-01-3/+4
| | | | | | | | | The code multiples the FAT size in sectors by the sector size and then tries to compare that to the number of sectors in the 'getsize' variable. While fixing this, also change the initial value of 'getsize' as the division of FATBUFSIZE by the sector size gets us FATBUFBLOCKS. Signed-off-by: Sergei Shtylyov <sshtylyov@mvista.com>
* fat: fix crash with big sector sizeSergei Shtylyov2011-10-01-37/+60
| | | | | | | | Apple iPod nanos have sector sizes of 2 or 4 KiB, which crashes U-Boot when it tries to read the boot sector into 512-byte buffer situated on stack. Make the FAT code indifferent to the sector size. Signed-off-by: Sergei Shtylyov <sshtylyov@mvista.com>
* UBIFS: fix warning: format '%lX' expects type 'long unsigned int'Wolfgang Denk2011-09-10-1/+1
| | | | | | | | | | | Commit 46d7274 "UBIFS: Change ubifsload to set the filesize variable" introduced the follwing compiler warning: ubifs.c: In function 'ubifs_load': ubifs.c:742: warning: format '%lX' expects type 'long unsigned int', but argument 3 has type 'u32' Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Bastian Ruppert <Bastian.Ruppert@Sewerin.de>
* UBIFS: Change ubifsload to set the filesize variableBastian Ruppert2011-09-10-1/+5
| | | | | | | | This is the same behaviour like tftp or fatload command. Signed-off-by: Bastian Ruppert <Bastian.Ruppert@Sewerin.de> CC: kmpark@infradead.org Acked-by: Detlev Zundel <dzu@denx.de>
* YAFFS2: fs/yaffs2/yaffs_guts.c - fix build warningsWolfgang Denk2011-09-10-9/+10
| | | | | | | | | | | | | | | | | | | | | Fix these: yaffs_guts.c: In function 'yaffs_ReadDataFromFile': yaffs_guts.c:4622: warning: pointer targets in passing argument 3 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c:4622: warning: pointer targets in passing argument 4 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c: In function 'yaffs_WriteDataToFile': yaffs_guts.c:4745: warning: pointer targets in passing argument 3 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c:4745: warning: pointer targets in passing argument 4 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c: In function 'yaffs_ResizeFile': yaffs_guts.c:4968: warning: pointer targets in passing argument 3 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c:4968: warning: pointer targets in passing argument 4 of 'yaffs_AddrToChunk' differ in signedness yaffs_guts.c: In function 'yaffs_GutsInitialise': yaffs_guts.c:7235: warning: assignment from incompatible pointer type yaffs_guts.c: In function 'yaffs_CreateNewObject': yaffs_guts.c:2143: warning: 'tn' may be used uninitialized in this function yaffs_guts.c: In function 'yaffs_MknodObject': yaffs_guts.c:2258: warning: 'str' may be used uninitialized in this function Signed-off-by: Wolfgang Denk <wd@denx.de>
* YAFFS2: fs/yaffs2/yaffs_guts.c - fix build warningsWolfgang Denk2011-09-10-3/+3
| | | | | | | | | | Fix these: yaffs_guts.c: At top level: yaffs_guts.c:400: warning: 'yaffs_SkipFullVerification' defined but not used Testing shows no changes of the image sizes. Signed-off-by: Wolfgang Denk <wd@denx.de>
* YAFFS2: fs/yaffs2/yaffs_nand.[hc] - fix build warningsWolfgang Denk2011-09-10-2/+2
| | | | | | | | | | | | | Fix these: yaffs_guts.c: In function 'yaffs_Scan': yaffs_guts.c:5436: warning: pointer targets in passing argument 4 of 'yaffs_QueryInitialBlockState' differ in signedness yaffs_guts.c: In function 'yaffs_ScanBackwards': yaffs_guts.c:6017: warning: pointer targets in passing argument 4 of 'yaffs_QueryInitialBlockState' differ in signedness yaffs_nand.c: In function 'yaffs_QueryInitialBlockState': yaffs_nand.c:109: warning: pointer targets in passing argument 4 of 'dev->queryNANDBlock' differ in signedness yaffs_nand.c:113: warning: pointer targets in passing argument 4 of 'yaffs_TagsCompatabilityQueryNANDBlock' differ in signedness Signed-off-by: Wolfgang Denk <wd@denx.de>
* YAFFS2: fs/yaffs2/Makefile - fix build warningsWolfgang Denk2011-09-10-1/+1
| | | | | | | | | | | Drop the "-DNO_Y_INLINE" setting to fix these: yaffs_guts.h:806: warning: 'yaffs_GetBlockInfo' defined but not used Impact on image size is negligible - for the VCMA9 board the text segment size grew from 496353 to 496357 bytes (i. e. 0.0008%); total image size even remained constant. Signed-off-by: Wolfgang Denk <wd@denx.de>
* YAFFS2: fs/yaffs2/yaffscfg.c - fix build warningsWolfgang Denk2011-09-10-2/+2
| | | | | | | | | Fix these: yaffscfg.c: In function 'cmd_yaffs_mread_file': yaffscfg.c:316: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'char *' yaffscfg.c: In function 'cmd_yaffs_ls': yaffscfg.c:371: warning: format '%7d' expects type 'int', but argument 3 has type 'off_t' Signed-off-by: Wolfgang Denk <wd@denx.de>
* ubifs: Fix bad free() sequence in ubifs_finddir()Wolfgang Denk2011-08-19-4/+2
| | | | | | | | | | | Free private_data member element before freeing file structure. This was causing malloc to crash. Also remove unnecessary variable assigments as file structure gets free'd as well. Signed-off-by: Rod Boyce <uboot@teamboyce.co.uk> Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Stefan Roese <sr@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
* Convert ISO-8859 files to UTF-8Albert ARIBAUD2011-08-04-9/+9
| | | | | | | | There was a mix of UTF-8 and ISO-8859 files in the U-Boot source tree, which could cause issues with the patchwork review system. This commit converts all ISO-8859 files to UTF-8. Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
* ext2: Simplify partial sector access logicAnton Staaf2011-07-28-27/+15
| | | | | | | | | | | | | Previously reading or writing zero full sectors (reading the end of one sector and the beginning of the next for example) was special cased and involved stack allocating a second sector buffer. This change uses the same code path for this case as well as when there are a non-zero number of full sectors to access. The result is easier to read and reduces the maximum stack used. Signed-off-by: Anton Staaf <robotboy@chromium.org> Cc: Andy Fleming <afleming@freescale.com> Acked-by: Detlev Zundel <dzu@denx.de>
* ext2: Fix checkpatch violationsAnton Staaf2011-07-28-39/+43
| | | | | | | | | | Fix all checkpatch violations in the low level Ext2 block device reading code. This is done in preparation for cleaning up the partial sector access code. Signed-off-by: Anton Staaf <robotboy@chromium.org> Cc: Andy Fleming <afleming@freescale.com> Acked-by: Detlev Zundel <dzu@denx.de>
* scaled down version of generic libraries for SPLAneesh V2011-07-26-1/+5
| | | | Signed-off-by: Aneesh V <aneesh@ti.com>
* cramfs: make cramfs usable without a NOR flashHeiko Schocher2011-05-10-0/+4
| | | | | | | | cc: Wolfgang Denk <wd@denx.de> cc: Detlev Zundel <dzu@denx.de> cc: Valentin Longchamp <valentin.longchamp@keymile.com> cc: Holger Brunck <holger.brunck@keymile.com> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
* Fix misc spelling errors found by lintianLoïc Minier2011-04-12-2/+2
| | | | Signed-off-by: Loïc Minier <loic.minier@linaro.org>
* fat32 root directory handlingErik Hansen2011-04-02-14/+23
| | | | | | | | | | | | | | | Fat directory handling didn't check reaching the end of the root directory. It relied on a stop condition based on a directory entry with a name starting with a '\0' character. This check in itself is wrong ('\0' indicates free entry, not end_of_directory) but outside the scope of this fix. For FAT32, the end of the rootdir is reached when the end of the cluster chain is reached. The code didn't check this condition and started to read an incorrect cluster. This caused a subsequent read request of a sector outside the range of the usb stick in use. On its turn, the usb stick protested with a stall handshake. Both FAT32 and non-FAT32 (FAT16/FAT12) end or rootdir checks have been put in. Signed-off-by: Erik Hansen <erik@makarta.com>
* UBIFS: Fix dereferencing type-punned pointer compiler warningDirk Behme2011-01-11-1/+2
| | | | | | | | | | | | | | | | | Fix compiler warning In file included from ubifs.h:2137:0, from ubifs.c:26: misc.h: In function 'ubifs_idx_key': misc.h:263:26: warning: dereferencing type-punned pointer will break strict-aliasing rules seen with gcc version 4.5.1 (Sourcery G++ Lite 2010.09-50). No functional change. CC: Stefan Roese <sr@denx.de> Signed-off-by: Dirk Behme <dirk.behme@googlemail.com> Signed-off-by: Stefan Roese <sr@denx.de>
* Merge branch 'master' of ../master into nextWolfgang Denk2010-12-16-15/+60
|\
| * ubifs.c: BUG: Error following linksRicardo Ribalda Delgado2010-12-03-1/+1
| | | | | | | | | | | | | | | | The link_name variable is declared inside the if block and it is used outside it through the name pointer. Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Stefan Roese <sr@denx.de>
| * UBIFS: Change ubifsload to not read beyond the requested sizeStefan Roese2010-12-03-13/+58
| | | | | | | | | | | | | | | | | | | | Until now ubifsload pads the destination with 0 up to a multiple of UBIFS_BLOCK_SIZE (4KiB) while reading a file to memory. This patch changes this behaviour to only read to the requested length. This is either the file length or the length/size provided as parameter to the ubifsload command. Signed-off-by: Stefan Roese <sr@denx.de>
| * UBIFS: Add ubifsumount command to unmount an active volumeStefan Roese2010-12-03-1/+1
| | | | | | | | | | | | | | This new ubifsumount command allows the user to unmount a previously mounted UBIFS volume. Signed-off-by: Stefan Roese <sr@denx.de>
* | ext2: constify file/dir namesMike Frysinger2010-11-28-2/+2
|/ | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Switch from archive libraries to partial linkingSebastien Carlier2010-11-17-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, weak symbols were not overridden by non-weak symbols found in archive libraries when linking with recent versions of binutils. As stated in the System V ABI, "the link editor does not extract archive members to resolve undefined weak symbols". This commit changes all Makefiles to use partial linking (ld -r) instead of creating library archives, which forces all symbols to participate in linking, allowing non-weak symbols to override weak symbols as intended. This approach is also used by Linux, from which the gmake function cmd_link_o_target (defined in config.mk and used in all Makefiles) is inspired. The name of each former library archive is preserved except for extensions which change from ".a" to ".o". This commit updates references accordingly where needed, in particular in some linker scripts. This commit reveals board configurations that exclude some features but include source files that depend these disabled features in the build, resulting in undefined symbols. Known such cases include: - disabling CMD_NET but not CMD_NFS; - enabling CONFIG_OF_LIBFDT but not CONFIG_QE. Signed-off-by: Sebastien Carlier <sebastien.carlier@gmail.com>
* Replace CONFIG_RELOC_FIXUP_WORKS by CONFIG_NEEDS_MANUAL_RELOCWolfgang Denk2010-10-29-1/+1
| | | | | | | | | | | By now, the majority of architectures have working relocation support, so the few remaining architectures have become exceptions. To make this more obvious, we make working relocation now the default case, and flag the remaining cases with CONFIG_NEEDS_MANUAL_RELOC. Signed-off-by: Wolfgang Denk <wd@denx.de> Tested-by: Heiko Schocher <hs@denx.de> Tested-by: Reinhard Meyer <u-boot@emk-elektronik.de>
* FAT: buffer overflow with FAT12/16Stefano Babic2010-10-20-1/+1
| | | | | | | | | | | | | Last commit 3831530dcb7b71329c272ccd6181f8038b6a6dd0a was intended "explicitly specify FAT12/16 root directory parsing buffer size, instead of relying on cluster size". Howver, the underlying function requires the size of the buffer in blocks, not in bytes, and instead of passing a double sector size a request for 1024 blocks is sent. This generates a buffer overflow with overwriting of other structure (in the case seen, USB structures were overwritten). Signed-off-by: Stefano Babic <sbabic@denx.de> CC: Mikhail Zolotaryov <lebon@lebon.org.ua>
* VFAT: fix processing of scattered long file name entriesMikhail Zolotaryov2010-10-12-12/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The U-Boot code has the following bugs related to the processing of Long File Name (LFN) entries scattered across several clusters/sectors : 1) get_vfatname() function is designed to gather scattered LFN entries by cluster chain processing - that doesn't work for FAT12/16 root directory. In other words, the function expects the following input data: 1.1) FAT32 directory (which is cluster chain based); OR 1.2) FAT12/16 non-root directory (which is also cluster chain based); OR 1.3) FAT12/16 root directory (allocated as contiguous sectors area), but all necessary information MUST be within the input buffer of filesystem cluster size (thus cluster-chain jump is never initiated). In order to accomplish the last condition, root directory parsing code in do_fat_read() uses the following trick: read-out cluster-size block, process only first sector (512 bytes), then shift 512 forward, read-out cluster-size block and so on. This works great unless cluster size is equal to 512 bytes (in a case you have a small partition), or long file name entries are scattered across three sectors, see 4) for details. 2) Despite of the fact that get_vfatname() supports FAT32 root directory browsing, do_fat_read() function doesn't send current cluster number correctly, so root directory look-up doesn't work correctly. 3) get_vfatname() doesn't gather scattered entries correctly also is the case when all LFN entries are located at the end of the source cluster, but real directory entry (which must be returned) is at the only beginning of the next one. No error detected, the resulting directory entry returned contains a semi-random information (wrong size, wrong start cluster number and so on) i.e. the entry is not accessible. 4) LFN (VFAT) allows up to 20 entries (slots) each containing 26 bytes (13 UTF-16 code units) to represent a single long file name i.e. up to 520 bytes. U-Boot allocates 256 bytes buffer instead, i.e. 10 or more LFN slots record may cause buffer overflow / memory corruption. Also, it's worth to mention that 20+1 slots occupy 672 bytes space which may take more than one cluster of 512 bytes (medium-size FAT32 or small FAT16 partition) - get_vfatname() function doesn't support such case as well. The patch attached fixes these problems in the following way: - keep using 256 bytes buffer for a long file name, but safely prevent a possible buffer overflow (skip LFN processing, if it contains 10 or more slots). - explicitly specify FAT12/16 root directory parsing buffer size, instead of relying on cluster size. The value used is a double sector size (to store current sector and the next one). This fixes the first problem and increases performance on big FAT12/16 partitions; - send current cluster number (FAT32) to get_vfatname() during root directory processing; - use LFN counter to seek the real directory entry in get_vfatname() - fixes the third problem; - skip deleted entries in the root directory (to prevent bogus buffer overflow detection and LFN counter steps). Note: it's not advised to split up the patch, because a separate part may operate incorrectly. Signed-off-by: Mikhail Zolotaryov <lebon@lebon.org.ua>