summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* yaffs: Remove private list implementationSimon Glass2014-03-042-127/+1
| | | | | | | | | | | | | | | | | | U-Boot already has a list implementation, and files which include both that and the yaffs implementation will get errors: In file included from ydirectenv.h:80:0, from yportenv.h:81, from yaffs_guts.h:19, from yaffs_allocator.h:19, from yaffs_allocator.c:14: yaffs_list.h:32:8: error: redefinition of ‘struct list_head’ struct list_head { ^ Remove the yaffs implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge branch 'master' of git://git.denx.de/u-boot-armTom Rini2014-02-261-3/+0
|\ | | | | | | | | | | | | | | | | Conflicts: arch/arm/cpu/armv7/config.mk board/ti/am43xx/mux.c include/configs/am43xx_evm.h Signed-off-by: Tom Rini <trini@ti.com>
| * arm: Switch to -mno-unaligned-access when supported by the compilerTom Rini2014-02-261-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we tell the compiler to optimize for ARMv7 (and ARMv6 for that matter) it assumes a default of SCTRL.A being cleared and unaligned accesses being allowed and fast at the hardware level. We set this bit and must pass along -mno-unaligned-access so that the compiler will still breakdown accesses and not trigger a data abort. To better help understand the requirements of the project with respect to unaligned memory access, the Documentation/unaligned-memory-access.txt file has been added as doc/README.unaligned-memory-access.txt and is taken from the v3.14-rc1 tag of the kernel. Cc: Albert ARIBAUD <albert.u.boot@aribaud.net> Cc: Mans Rullgard <mans@mansr.com> Signed-off-by: Tom Rini <trini@ti.com>
* | Revert "ext4fs: Add ext4 extent cache for read operations"Tom Rini2014-02-263-130/+73
| | | | | | | | | | | | | | | | | | | | This reverts commit fc0fc50f38a4d7d0554558076a79dfe8b0d78cd5. The author has asked on the mailing list that we revert this for now as it breaks write support. Reported-by: Łukasz Majewski <l.majewski@samsung.com> Signed-off-by: Tom Rini <trini@ti.com>
* | ubifs: fix checkpatch warningKaricheri, Muralidharan2014-02-211-0/+7
| | | | | | | | | | | | | | | | Fix the following checkpatch warning:- WARNING: externs should be avoided in .c files Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
* | ext4fs: Add ext4 extent cache for read operationsIonut Nicu2014-02-213-73/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In an ext4 filesystem, the inode corresponding to a file has a 60-byte area which contains an extent header structure and up to 4 extent structures (5 x 12 bytes). For files that need more than 4 extents to be represented (either files larger than 4 x 128MB = 512MB or smaller files but very fragmented), ext4 creates extent index structures. Each extent index points to a 4KB physical block where one extent header and additional 340 extents could be stored. The current u-boot ext4 code is very inefficient when it tries to load a file which has extent indexes. For each logical file block the code will read over and over again the same blocks of 4096 bytes from the disk. Since the extent tree in a file is always the same, we can cache the extent structures in memory before actually starting to read the file. This patch creates a simple linked list of structures holding information about all the extents used to represent a file. The list is sorted by the logical block number (ee_block) so that we can easily find the proper extent information for any file block. Without this patch, a 69MB file which had just one extent index pointing to a block with another 6 extents was read in approximately 3 minutes. With this patch applied the same file can be read in almost 20 seconds. Signed-off-by: Ionut Nicu <ioan.nicu.ext@nsn.com>
* | fs/fdos: RemoveTom Rini2014-02-2110-1488/+0
|/ | | | | | We have an unused FAT implementation in fs/fdos, remove. Signed-off-by: Tom Rini <trini@ti.com>
* kbuild: use Linux Kernel build scriptsMasahiro Yamada2014-02-192-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Now we are ready to switch over to real Kbuild. This commit disables temporary scripts: scripts/{Makefile.build.tmp, Makefile.host.tmp} and enables real Kbuild scripts: scripts/{Makefile.build,Makefile.host,Makefile.lib}. This switch is triggered by the line in scripts/Kbuild.include -build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj +build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj We need to adjust some build scripts for U-Boot. But smaller amount of modification is preferable. Additionally, we need to fix compiler flags which are locally added or removed. In Kbuild, it is not allowed to change CFLAGS locally. Instead, ccflags-y, asflags-y, cppflags-y, CFLAGS_$(basetarget).o, CFLAGS_REMOVE_$(basetarget).o are prepared for that purpose. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Tested-by: Gerhard Sittig <gsi@denx.de>
* kbuild: change out-of-tree buildMasahiro Yamada2014-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the working directory where the build process occurs. Before this commit, build process occurred under the source tree for both in-tree and out-of-tree build. That's why we needed to add $(obj) prefix to all generated files in makefiles like follows: $(obj)u-boot.bin: $(obj)u-boot Here, $(obj) is empty for in-tree build, whereas it points to the output directory for out-of-tree build. And our old build system changes the current working directory with "make -C <sub-dir>" syntax when descending into the sub-directories. On the other hand, Kbuild uses a different idea to handle out-of-tree build and directory descending. The build process of Kbuild always occurs under the output tree. When "O=dir/to/store/output/files" is given, the build system changes the current working directory to that directory and restarts the make. Kbuild uses "make -f $(srctree)/scripts/Makefile.build obj=<sub-dir>" syntax for descending into sub-directories. (We can write it like "make $(obj)=<sub-dir>" with a shorthand.) This means the current working directory is always the top of the output directory. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Tested-by: Gerhard Sittig <gsi@denx.de>
* fat: implement exists() for FAT fsStephen Warren2014-02-192-5/+15
| | | | | | | | This hooks into the generic "file exists" support added in an earlier patch, and provides an implementation for the FAT filesystem. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
* ext4: implement exists() for ext4fsStephen Warren2014-02-192-1/+9
| | | | | | | | This hooks into the generic "file exists" support added in an earlier patch, and provides an implementation for the ext4 filesystem. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
* sandbox: implement exists() functionStephen Warren2014-02-192-1/+9
| | | | | | | | This hooks into the generic "file exists" support added in an earlier patch, and provides an implementation for the sandbox test environment. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
* fs: don't pass NULL dev_desc to most filesystemsStephen Warren2014-02-191-0/+16
| | | | | | | | | | FAT and ext4 expect that the passed in block device descriptor not be NULL. This causes problems on sandbox, where get_device_and_partition() succeeds for the "host" device, yet passes back a NULL device descriptor. Add special handling for this situation, so that the generic filesystem commands operate as expected on sandbox. Signed-off-by: Stephen Warren <swarren@nvidia.com>
* fs: implement infrastructure for an 'exists' functionStephen Warren2014-02-191-0/+32
| | | | | | | | | | | | | | | | | | | | | | | This could be used in scripts such as: if test -e mmc 0:1 /boot/boot.scr; then load mmc 0:1 ${scriptaddr} /boot/boot.scr source ${scriptaddr} fi rather than: if load mmc 0:1 ${scriptaddr} /boot/boot.scr; then source ${scriptaddr} fi This prevents errors being printed by attempts to load non-existent files, which can be important when checking for a large set of files, such as /boot/boot.scr.uimg, /boot/boot.scr, /boot/extlinux.conf, /boot.scr.uimg, /boot.scr, /extlinux.conf. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
* fs: fix generic save command implementationStephen Warren2014-02-191-6/+3
| | | | | | | | | | | | | | | | | | | | Fix a few issues with the generic "save" shell command, and fs_write() function. 1) fstypes[].write wasn't filled in for some file-systems, and isn't checked when used, which could cause crashes/... if executing save on e.g. fat/ext filesystems. 2) fs_write() requires the length argument to be non-zero, since it needs to know exactly how many bytes to write. Adjust the comments and code according to this. 3) fs_write() wasn't prototyped in <fs.h> like other generic functions; other code should be able to call this directly rather than invoking the "save" shell command. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
* yaffs2: Remove block number check from summary verificationCharles Manning2014-01-201-1/+0
| | | | | | | | | | The summary already has other verification. This one is not needed. The check caused summaries to be ignored if they were not on the numbered block. This caused problems when a summary was embedded in an image and the image is written to a flash with bad blocks. Signed-off-by: Charles Manning <cdhmanning@gmail.com>
* ext4fs: fix "invalid extent block" errorIonut Nicu2014-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | For files where we actually have extent indexes following an extent header (ext_block->eh_depth != 0), the do/while loop from ext4fs_get_extent_block() does not select the proper extent index structure. For example, if we have: ext_block->eh_depth = 1 ext_block->eh_entries = 1 fileblock = 0 index[0].ei_block = 0 the do/while loop will exit with i set to 0 and the ext4fs_get_extent_block() function will return 0, even if there was a valid extent index structure following the header. Signed-off-by: Ionut Nicu <ioan.nicu.ext@nsn.com> Signed-off-by: Mathias Rulf <mathias.rulf@nsn.com>
* ext4fs: use EXT2_BLOCK_SIZE instead of fs->blkszIonut Nicu2014-01-201-2/+2
| | | | | | | | | | Using fs->blksz in ext4fs_get_extent_block() is not correct since fs->blksz is not initialized on the read path. Use EXT2_BLOCK_SIZE() instead which will produce the desired output. Signed-off-by: Ionut Nicu <ioan.nicu.ext@nsn.com> Signed-off-by: Mathias Rulf <mathias.rulf@nsn.com>
* fs/ext4: fix calling put_ext4 with truncated offsetMa Haijun2014-01-203-28/+28
| | | | | | | | | | | | Curently, we are using 32 bit multiplication to calculate the offset, so the result will always be 32 bit. This can silently cause file system corruption when performing a write operation on partition larger than 4 GiB. This patch address the issue by simply promoting the terms to 64 bit, and let compilers decide how to do the multiplication efficiently. Signed-off-by: Ma Haijun <mahaijuns@gmail.com>
* fs/ext4: fix partition size get truncated in calculationMa Haijun2014-01-201-1/+1
| | | | | | | It may cause file system corruption when do a write operation. This issue only affects boards that use 32 bit lbaint_t. Signed-off-by: Ma Haijun <mahaijuns@gmail.com>
* yaffs2: Use lldiv for 64bit divisionTom Rini2013-12-132-3/+5
| | | | Signed-off-by: Tom Rini <trini@ti.com>
* JFFS2: Correct jffs2_1pass_build_lists to use lldivTom Rini2013-12-131-1/+3
| | | | | | Since part_info size became 64bit we need to use lldiv here. Signed-off-by: Tom Rini <trini@ti.com>
* fs: descend into sub directories when it is necessaryMasahiro Yamada2013-11-1711-25/+23
| | | | Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
* Makefile: move fs/fat/ entry to drivers/MakefileMasahiro Yamada2013-11-171-0/+5
| | | | | | Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* fs:fat: fix set file name functionPiotr Wilczek2013-11-081-1/+1
| | | | | | | | | | Curently memcpy copies string without null terminating char because function strlen returns only number of characters excluding null terminating character. Replace memcpy with strcpy. Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> CC: Tom Rini <trini@ti.com>
* fs: move some file system to fs/MakefileMasahiro Yamada2013-10-311-0/+11
| | | | | | | | | This commit moves some subdirectories of fs from the toplevel Makefile to fs/Makefile using Kbuild descending feature. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
* fs: convert makefiles to Kbuild styleMasahiro Yamada2013-10-3112-312/+24
| | | | Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
* mtd: fix warnings due to 64-bit partition supportScott Wood2013-10-151-2/+3
| | | | | | | | | | | | | | | commit 39ac34473f3c96e77cbe03a49141771ed1639486 ("cmd_mtdparts: use 64 bits for flash size, partition size & offset") introduced warnings in a couple places due to printf formats or pointer casting. This patch fixes the warnings pointed out here: http://lists.denx.de/pipermail/u-boot/2013-October/164981.html Signed-off-by: Scott Wood <scottwood@freescale.com> Cc: York Sun <yorksun@freescale.com> Cc: Stefan Roese <sr@denx.de> Cc: Paul Burton <paul.burton@imgtec.com> Cc: Tom Rini <trini@ti.com>
* Coding Style cleanup: replace leading SPACEs by TABsWolfgang Denk2013-10-141-1/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Drop changes for PEP 4 following python tools] Signed-off-by: Tom Rini <trini@ti.com>
* Fix number base handling of "load" commandWolfgang Denk2013-10-071-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As documented, almost all U-Boot commands expect numbers to be entered in hexadecimal input format. (Exception: for historical reasons, the "sleep" command takes its argument in decimal input format.) This rule was broken for the "load" command; for details please see especially commits 045fa1e "fs: add filesystem switch libary, implement ls and fsload commands" and 3f83c87 "fs: fix number base behaviour change in fatload/ext*load". In the result, the load command would always require an explicit "0x" prefix for regular (i. e. base 16 formatted) input. Change this to use the standard notation of base 16 input format. While strictly speaking this is a change of the user interface, we hope that it will not cause trouble. Stephen Warren comments (see [1]): I suppose you can change the behaviour if you want; anyone writing "0x..." for their values presumably won't be affected, and if people really do assume all values in U-Boot are in hex, presumably nobody currently relies upon using non-prefixed values with the generic load command, since it doesn't work like that right now. [1] http://article.gmane.org/gmane.comp.boot-loaders.u-boot/171172 Acked-by: Tom Rini <trini@ti.com> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Wolfgang Denk <wd@denx.de>
* fs: fat: don't call disk_write with zero sector numWu, Josh2013-09-061-3/+5
| | | | | | | | | | | | | | In the set_cluster() function, it will convert the buffer size to sector numbers. Then call disk_write() to write by sector. For remaining buffer, the size is less than a sector, call disk_write() again to write them in one sector. But if the total buffer size is less then one sector, the original code will call disk_write() with zero sector number. It is unnecessary. So this patch fix this. Now it will not call disk_write() if total buffer size is less than one sector. Signed-off-by: Josh Wu <josh.wu@atmel.com>
* SPDX-License-Identifier: convert BSD-3-Clause filesWolfgang Denk2013-08-191-23/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini Don't remove some copyrights by accident] Signed-off-by: Tom Rini <trini@ti.com>
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-2441-629/+41
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* ext4fs: le32_to_cpu() used on a 16-bit fieldRommel Custodio2013-07-221-6/+6
| | | | | | | | | | | | | | Fix reading ext4_extent_header struture on BE machines. Some 16 bit fields where converted to 32 bit fields, due to the byte swap on BE machines the containing value was corrupted. Therefore reading ext4 filesystems on BE machines where broken before. Signed-off-by: Rommel Custodio <sessyargc+uboot@gmail.com> [sent via git-send-email; rework commit message] Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Tested-by: Lukasz Majewski <l.majewski@samsung.com>
* Fix ext2/ext4 filesystem accesses beyond 2TiBFrederic Leroy2013-07-155-60/+80
| | | | | | | | | | | | | | | | | With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type, which is required to represent block numbers for storage devices that exceed 2TiB (the block size usually is 512B), e.g. recent hard drives We now use lbaint_t for partition offset to reflect the lbaint_t change, and access partitions beyond or crossing the 2.1TiB limit. This required changes to signature of ext4fs_devread(), and type of all variables relatives to block sector. ext2/ext4 fs uses logical block represented by a 32 bit value. Logical block is a multiple of device block sector. To avoid overflow problem when calling ext4fs_devread(), we need to cast the sector parameter. Signed-off-by: Frédéric Leroy <fredo@starox.org>
* cramfs: fix bug for wrong filename comparisonHolger Brunck2013-07-151-1/+2
| | | | | | | | | | | "cramfsload uImage_1" succeeds even though the actual file is named "uImage". Fix file name comparison when one name is the prefix of the other. Signed-off-by: Holger Brunck <holger.brunck@keymile.com> cc: Wolfgang Denk <wd@denx.de> cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
* Merge branch 'master' of git://git.denx.de/u-boot-nand-flashTom Rini2013-05-312-16/+16
|\
| * mtd: resync with Linux-3.7.1Sergey Lapin2013-05-312-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is essentially an update of u-boot MTD subsystem to the state of Linux-3.7.1 with exclusion of some bits: - the update is concentrated on NAND, no onenand or CFI/NOR/SPI flashes interfaces are updated EXCEPT for API changes. - new large NAND chips support is there, though some updates have got in Linux-3.8.-rc1, (which will follow on top of this patch). To produce this update I used tag v3.7.1 of linux-stable repository. The update was made using application of relevant patches, with changes relevant to U-Boot-only stuff sticked together to keep bisectability. Then all changes were grouped together to this patch. Signed-off-by: Sergey Lapin <slapin@ossfans.org> [scottwood@freescale.com: some eccstrength and build fixes] Signed-off-by: Scott Wood <scottwood@freescale.com>
* | ext4: assign get_fs()->dev_desc before using itStephen Warren2013-05-241-1/+1
|/ | | | | | | | | | | | Commit 50ce4c0 "fs/ext4: Support device block sizes != 512 bytes" modified ext4fs_set_blk_dev() to calculate total_sect based on get_fs()->dev_desc->log2blksz rather than SECTOR_SIZE. However, this value wasn't yet assigned. Move the assignment earlier so the code doesn't crash or hang. Cc: Egbert Eich <eich@suse.com> Tested-by: Tom Rini <trini@ti.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
* fs/ext4: Support device block sizes != 512 bytesEgbert Eich2013-05-106-67/+91
| | | | | | | | | The 512 byte block size was hard coded in the ext4 file systems. Large harddisks today support bigger block sizes typically 4096 bytes. This patch removes this limitation. Signed-off-by: Egbert Eich <eich@suse.com>
* fs/fat: Don't multiply fatsize with sector sizeEgbert Eich2013-05-011-1/+0
| | | | | | | | | Bugfix: Here at this place we need the fat size in sectors not bytes. This was found during code review when adding support for storage devices with blocksizes != 512. Signed-off-by: Egbert Eich <eich@suse.com>
* sandbox: fs: Add support for saving files to host filesystemSimon Glass2013-05-012-0/+34
| | | | | | | | | | | | This allows write of files from the host filesystem in sandbox. There is currently no concept of overwriting the file and removing its existing contents - all writing is done on top of what is there. This means that writing 10 bytes to the start of a 1KB file will only update those 10 bytes, not truncate the file to 10 byte slong. If the file does not exist it is created. Signed-off-by: Simon Glass <sjg@chromium.org>
* fs: Add support for saving data to filesystemsSimon Glass2013-05-011-0/+74
| | | | | | | Add a new method for saving that filesystems can implement. This mirrors the existing load method. Signed-off-by: Simon Glass <sjg@chromium.org>
* ubi: ubifs: Turn off verbose printsJoe Hershberger2013-04-111-0/+4
| | | | | | The prints are out of control. SILENCE! Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* Consolidate bool typeYork Sun2013-04-012-6/+4
| | | | | | | | | | | | | 'bool' is defined in random places. This patch consolidates them into a single header file include/linux/types.h, using stdbool.h introduced in C99. All other #define, typedef and enum are removed. They are all consistent with true = 1, false = 0. Replace FALSE, False with false. Replace TRUE, True with true. Skip *.py, *.php, lib/* files. Signed-off-by: York Sun <yorksun@freescale.com>
* ubifs: Allow ubifsmount volume reference by numberJoe Hershberger2013-03-041-3/+1
| | | | | | | | | | | | | | | | | | UBI can mount volumes by name or number The current code forces you to name the volume by prepending every name with "ubi:". >From fs/ubifs/super.c * There are several ways to specify UBI volumes when mounting UBIFS: * o ubiX_Y - UBI device number X, volume Y; * o ubiY - UBI device number 0, volume Y; * o ubiX:NAME - mount UBI device X, volume with name NAME; * o ubi:NAME - mount UBI device 0, volume with name NAME. Now any name passed in any of the above forms are allowed. Also update the configs that referenced ubifsmount. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* sandbox: Add host filesystemSimon Glass2013-03-043-0/+140
| | | | | | | This allows reading of files from the host filesystem in sandbox. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
* fs: Move ls and read methods into ext4, fatSimon Glass2013-03-043-110/+62
| | | | | | | | | It doesn't make a lot of sense to have these methods in fs.c. They are filesystem-specific, not generic code. Add each to the relevant filesystem and remove the associated #ifdefs in fs.c. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
* fs: Use map_sysmem() on readSimon Glass2013-03-041-8/+15
| | | | | | | | This allows us to use filesystems on sandbox. It has no effect on other architectures. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
* fs: Tell probe functions where to put their resultsSimon Glass2013-03-041-8/+12
| | | | | | | | | | Rather than rely on global variables for the probe functions, pass in the information that we need filled in. This allows us to potentially keep the variables private to fs.c in the future, and the meaning of the probe function is clearer. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
OpenPOWER on IntegriCloud