summaryrefslogtreecommitdiff
path: root/fs
AgeCommit message (Collapse)Author
2013-11-17fs: descend into sub directories when it is necessaryMasahiro Yamada
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2013-11-17Makefile: move fs/fat/ entry to drivers/MakefileMasahiro Yamada
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
2013-11-08fs:fat: fix set file name functionPiotr Wilczek
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>
2013-10-31fs: move some file system to fs/MakefileMasahiro Yamada
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>
2013-10-31fs: convert makefiles to Kbuild styleMasahiro Yamada
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2013-10-15mtd: fix warnings due to 64-bit partition supportScott Wood
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>
2013-10-14Coding Style cleanup: replace leading SPACEs by TABsWolfgang Denk
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>
2013-10-07Fix number base handling of "load" commandWolfgang Denk
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>
2013-09-06fs: fat: don't call disk_write with zero sector numWu, Josh
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>
2013-08-19SPDX-License-Identifier: convert BSD-3-Clause filesWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini Don't remove some copyrights by accident] Signed-off-by: Tom Rini <trini@ti.com>
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2013-07-22ext4fs: le32_to_cpu() used on a 16-bit fieldRommel Custodio
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>
2013-07-15Fix ext2/ext4 filesystem accesses beyond 2TiBFrederic Leroy
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>
2013-07-15cramfs: fix bug for wrong filename comparisonHolger Brunck
"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>
2013-05-31Merge branch 'master' of git://git.denx.de/u-boot-nand-flashTom Rini
2013-05-31mtd: resync with Linux-3.7.1Sergey Lapin
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>
2013-05-24ext4: assign get_fs()->dev_desc before using itStephen Warren
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>
2013-05-10fs/ext4: Support device block sizes != 512 bytesEgbert Eich
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>
2013-05-01fs/fat: Don't multiply fatsize with sector sizeEgbert Eich
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>
2013-05-01sandbox: fs: Add support for saving files to host filesystemSimon Glass
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>
2013-05-01fs: Add support for saving data to filesystemsSimon Glass
Add a new method for saving that filesystems can implement. This mirrors the existing load method. Signed-off-by: Simon Glass <sjg@chromium.org>
2013-04-11ubi: ubifs: Turn off verbose printsJoe Hershberger
The prints are out of control. SILENCE! Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2013-04-01Consolidate bool typeYork Sun
'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>
2013-03-04ubifs: Allow ubifsmount volume reference by numberJoe Hershberger
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>
2013-03-04sandbox: Add host filesystemSimon Glass
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>
2013-03-04fs: Move ls and read methods into ext4, fatSimon Glass
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>
2013-03-04fs: Use map_sysmem() on readSimon Glass
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>
2013-03-04fs: Tell probe functions where to put their resultsSimon Glass
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>
2013-03-04fs: Use filesystem methods instead of switch()Simon Glass
We can use the available methods and avoid using switch(). When the filesystem is not supported, we fall through to the 'unsupported' methods: fs_probe_unsupported() prints an error, so the others do not need to. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
2013-03-04fs: Fully populate the filesystem method structSimon Glass
There is a structure in fs.c with just a probe method. By adding methods for other operations, we can avoid lots of #ifdefs and switch()s. As a first step, create the structure ready for use. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
2013-03-04ext4: Split write support into its own fileSimon Glass
This code seems to be entirely othogonal, so remove the #ifdef and put the condition in the Makefile instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2013-02-28fs: Use new numeric setenv functionsSimon Glass
Use setenv_ulong(), setenv_hex() and setenv_addr() in fs/ Signed-off-by: Simon Glass <sjg@chromium.org>
2013-02-04FAT: remove ifdefs to make the code more readableRichard Genoud
ifdefs in the code are making it harder to read. The use of simple if(vfat_enabled) makes no more code and is cleaner. (the code is discarded by the compiler instead of the preprocessor.) NB: if -O0 is used, the code won't be discarded and bonus, now the code compiles even if CONFIG_SUPPORT_VFAT is not defined. Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
2013-02-04FAT: use toupper/tolower instead of recoding themRichard Genoud
toupper/tolower function are already declared, so use them. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Stefano Babic <sbabic@denx.de>
2013-01-31vfat: Fix mkcksum argument sizesMarek Vasut
In case a function argument is known/fixed size array in C, the argument is still decoyed as pointer instead ( T f(U n[k]) ~= T fn(U *n) ) and therefore calling sizeof on the function argument will result in the size of the pointer, not the size of the array. The VFAT code contains such a bug, this patch fixes it. Reported-by: Aaron Williams <Aaron.Williams@cavium.com> Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <tom.rini@gmail.com> Cc: Aaron Williams <Aaron.Williams@cavium.com> Tested-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2012-12-07fs:ext4:write: Initialize cache aligned filename bufferŁukasz Majewski
The filename buffer is allocated dynamically. It must be cache aligned. Moreover, it is necessary to erase its content before we use it for file name operations. This prevents from corruption of written file names. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-12-07fs:ext4:fix: Code refactoring to suppress compiler warningsŁukasz Majewski
Several fixes to suppress compiler's (eldk-5.[12].x gcc 4.6) warning [-Wunused-but-set-variable] Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-12-07fs:ext4:write: Store block device descriptor in file system structureŁukasz Majewski
The device block descriptor (block_dev_desc_t) )shall be stored at ext4 early code (at ext4fs_set_blk_dev in this case) to be available for latter use (like put_ext4()). Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-12-07fs:ext4:write: Add lldiv and do_div to perform 64-32 bits divisionŁukasz Majewski
The ext4write code has been using direct calls to 64-32 division (/ and %). Officially supported u-boot toolchains (eldk-5.[12].x) generate calls to __aeabi_uldivmod(), which is niether defined in the toolchain libs nor u-boot source tree. Due to that, when the ext4write command has been executed, "undefined instruction" execption was generated (since the __aeabi_uldivmod() is not provided). To fix this error, lldiv() for division and do_div() for modulo have been used. Those two functions are recommended for performing 64-32 bit number division in u-boot. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-12-06cbfs: Remove mention of CREDITS filesSimon Glass
As requested by Wolfgang, remove references to CREDITS in the CBFS files. Signed-off-by: Simon Glass <sjg@chromium.org>
2012-11-14fs/fs.c: do_fsload: measure throughputAndreas Bießmann
This patch adds time measurement and throughput calculation for all supported load commands. The output of ext2load changes from ---8<--- 1830666 bytes read --->8--- to ---8<--- 1830666 bytes read in 237 ms (7.4 MiB/s) --->8--- Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> [agust: rebased and revised commit log] Signed-off-by: Anatolij Gustschin <agust@denx.de>
2012-11-14fs: zfs: fix illegal use of fpAlejandro Mery
the upcoming sunxi (allwinner a10/a13) platform enables zfs by default, and using linaro's hf -msoft-float makes the build fail because this u64 division. Signed-off-by: Alejandro Mery <amery@geeks.cl> Acked-by: Stefan Roese <sr@denx.de>
2012-11-04include/linux/byteorder: import latest endian definitions from linuxKim Phillips
u-boot's byteorder headers did not contain endianness attributions for use with sparse, causing a lot of false positives. Import the kernel's latest definitions, and enable them by including compiler.h and types.h. They come with 'const' added for some swab functions, so fix those up, too: include/linux/byteorder/big_endian.h:46:2: warning: passing argument 1 of '__swab64p' discards 'const' qualifier from pointer target type [enabled by default] Also, note: u-boot's historic __BYTE_ORDER definition has been preserved (for the time being at least). We also remove ad-hoc barrier() definitions, since we're including compiler.h in files that hadn't in the past: macb.c:54:0: warning: "barrier" redefined [enabled by default] In addition, including compiler.h in byteorder changes the 'noinline' definition to expand to __attribute__((noinline)). This fixes arch/powerpc/lib/bootm.c: bootm.c:329:16: error: attribute '__attribute__': unknown attribute bootm.c:329:16: error: expected ')' before '__attribute__' bootm.c:329:25: error: expected identifier or '(' before ')' token powerpc sparse builds yield: include/common.h:356:22: error: marked inline, but without a definition the unknown-reason inlining without a definition is considered obsolete given it was part of the 2002 initial commit, and no arm version was 'fixed.' also fixed: ydirectenv.h:60:0: warning: "inline" redefined [enabled by default] and: Configuring for devconcenter - Board: intip, Options: DEVCONCENTER make[1]: *** [4xx_ibm_ddr2_autocalib.o] Error 1 make: *** [arch/powerpc/cpu/ppc4xx/libppc4xx.o] Error 2 powerpc-fsl-linux-size: './u-boot': No such file 4xx_ibm_ddr2_autocalib.c: In function 'DQS_autocalibration': include/asm/ppc4xx-sdram.h:1407:13: sorry, unimplemented: inlining failed in call to 'ppc4xx_ibm_ddr2_register_dump': function body not available 4xx_ibm_ddr2_autocalib.c:1243:32: sorry, unimplemented: called from here and: In file included from crc32.c:50:0: crc32table.h:4:1: warning: implicit declaration of function '___constant_swab32' [-Wimplicit-function-declaration] crc32table.h:4:1: error: initializer element is not constant crc32table.h:4:1: error: (near initialization for 'crc32table_le[0]') Signed-off-by: Kim Phillips <kim.phillips@freescale.com> [trini: Remove '#endif' in include/common.h around setenv portion] Signed-off-by: Tom Rini <trini@ti.com>
2012-11-04fs: rename fsload command to loadStephen Warren
When the generic filesystem load command "fsload" was written, I felt that "load" was too generic of a name for it, since many other similar commands already existed. However, it turns out that there is already an "fsload" command, so that name cannot be used. Rename the new "fsload" to plain "load" to avoid the conflict. At least anyone who's used a Basic interpreter should feel familiar with the name! Signed-off-by: Stephen Warren <swarren@nvidia.com>
2012-11-04fs: fix number base behaviour change in fatload/ext*loadStephen Warren
Commit 045fa1e "fs: add filesystem switch libary, implement ls and fsload commands" unified the implementation of fatload and ext*load with the new command fsload. However, this altered the interpretation of command-line numbers from always being base-16, to requiring a "0x" prefix for base-16 numbers. Enhance do_fsload() to allow commands to specify which base to use. Use base 0, thus requiring a "0x" prefix for the new fsload command. This feels much cleaner than assuming base 16. Use base 16 for the pre-existing fatload and ext*load to prevent a change in behaviour. Use base 16 exclusively for the loadaddr environment variable, since that variable is interpreted in multiple places, so we don't want the behaviour to change. Update command help text to make it clear where numbers are assumed to be hex, and where an explicit "0x" prefix is required. Signed-off-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2012-11-04fs: fix do_fsload() handling of optional argumentsStephen Warren
Most arguments to the shell command do_fsload() implements are optional. Fix the minimum argc check to respect that. Cater for the situation where argv[2] is not provided. Enhance both do_fsload() and do_ls() to check the maximum number of arguments too. While this check would typically be implemented via U_BOOT_CMD()'s max_args parameter, if these functions are called directly, then that check won't exist. Finally, alter do_ls() to check (argc >= 4) rather than (argc == 4) so that if the function is enhanced to allow extra arguments in the future, this test won't need to be changed at that time. Signed-off-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2012-11-02ZFS: Fix compile warning in fs/zfs/zfs.c (GCC 4.6.4 from ELDK 5.2.1)Stefan Roese
This patch fixes the following compile warning: zfs.c:2006:1: warning: 'zfs_label' defined but not used [-Wunused-function] zfs.c:2029:1: warning: 'zfs_uuid' defined but not used [-Wunused-function] Signed-off-by: Stefan Roese <sr@denx.de> Cc: Jorgen Lundman <lundman@lundman.net>
2012-11-02fs: handle CONFIG_NEEDS_MANUAL_RELOCStephen Warren
Without this, fstypes[].probe points at the wrong place, so calling the function results in undefined behaviour. Signed-off-by: Stephen Warren <swarren@nvidia.com> Tested-by: Andreas Bießmann <andreas.devel@googlemail.com>
2012-10-29fs: add filesystem switch libary, implement ls and fsload commandsStephen Warren
Implement "ls" and "fsload" commands that act like {fat,ext2}{ls,load}, and transparently handle either file-system. This scheme could easily be extended to other filesystem types; I only didn't do it for zfs because I don't have any filesystems of that type to test with. Replace the implementation of {fat,ext[24]}{ls,load} with this new code too. Signed-off-by: Stephen Warren <swarren@nvidia.com>
2012-10-29fs: separate CONFIG_FS_{FAT, EXT4} from CONFIG_CMD_{FAT, EXT*}Stephen Warren
This makes the FAT and ext4 filesystem implementations build if CONFIG_FS_{FAT,EXT4} are defined, rather than basing the build on whether CONFIG_CMD_{FAT,EXT*} are defined. This will allow the filesystems to be built separately from the filesystem-specific commands that use them. This paves the way for the creation of filesystem-generic commands that used the filesystems, without requiring the filesystem- specific commands. Minor documentation changes are made for this change. The new config options are automatically selected by the old config options to retain backwards-compatibility. Signed-off-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>