summaryrefslogtreecommitdiff
path: root/fs
AgeCommit message (Collapse)Author
2018-05-17ubifs update and yocto build supportJoris van Vossen
2017-10-23mtd: remove MTDDEBUG() and CONFIG_MTD_DEBUGMasahiro Yamada
All users of this macro have been converted. Remove MTDDEBUG and related CONFIG options. ubifs_dbg_msg_key() is kept. It is silent unless DEBUG is defined. I am not touching scripts/config_whitelist.txt. The deprecated options will be dropped by the next resync. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-10-16fs/jffs2/mini_inflate.c: use "static inline" instead of "inline"Vagrant Cascadian
This makes gcc no longer expect an out-of-line version of the functions being present elsewhere. This fixes a failure to build on several marvell targets with gcc-7 on Debian: https://bugs.debian.org/877963 Signed-off-by: Adrian Bunk <bunk@debian.org> Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
2017-10-16jffs2: ECC corrected nand data is ignoredEngling, Uwe
Hello, I ran into a problem with the JFFS2 filesystem driver implemented in U-Boot. I've got a NAND device that has correctable ECC errors (corrected somewhere in mtd/nand/nand_base.c). The NAND driver tells the filesystem layer (jffs2_1pass.c) above that there occurred correctable ECC errors and returns with a "value > 0". The JFFS2 driver recognizes the corrected ECC errors as real error and skips this block because the only accepts a "return value == 0" as correct. This problem exists for over 8 years (I checked version 2010.09) so I'm a little bit worried that I interpreted something wrong or didn't get the whole context. Can someone confirm this bug (and the bugfix) in the u-boot jffs2 driver? There was a mail in 2012 that mentioned the same problem, but there was no patch: http://u-boot.10912.n7.nabble.com/JFFS2-seems-to-drop-nand-data-with-ECC-corrections-td142008.html Sometime after this discussion the return value of nand_read() changed from -EUCLEAN as correctable ECC error to a positive value with the count of ECC corrected errors. With kind reguards, Uwe Engling
2017-10-16fs: Set .opendir to fs_opendir_unsupported for btrfsMarek Behún
Otherwise fs_opendir will fault. Signed-off-by: Marek Behun <marek.behun@nic.cz>
2017-10-16fs: btrfs: Remove a foreign language noteMarek Behún
I accidentaly left a foreign language note in the code from development. Signed-off-by: Marek Behun <marek.behun@nic.cz>
2017-10-16fs: btrfs: Fix usage of uninitialized variablesMarek Behún
The variable res should be initialized to 0 in these functions, because if the searched key is not found, the variable is used uninitialized. Reported-by: Coverity (CID: 167335) Reported-by: Coverity (CID: 167336) Reported-by: Coverity (CID: 167337) Signed-off-by: Marek Behun <marek.behun@nic.cz>
2017-10-08fs/fat: Check malloc return values and fix memory leaksTuomas Tynkkynen
Check malloc() return values and properly unwind on errors so memory allocated for fat_itr structures get freed properly. Also fixes a leak of fsdata.fatbuf in fat_size(). Fixes: 2460098cffacd1 ("fs/fat: Reduce stack usage") Reported-by: Coverity (CID: 167225, 167233, 167234) Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-10-08fs/fat: Fix 'CACHE: Misaligned operation at range' warningsTuomas Tynkkynen
The 'block' field of fat_itr needs to be properly aligned for DMA and while it does have '__aligned(ARCH_DMA_MINALIGN)', the fat_itr structure itself needs to be properly aligned as well. While at it use malloc_cache_aligned() for the other aligned allocations in the file as well. Fixes: 2460098cffacd1 ("fs/fat: Reduce stack usage") Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-10-06fs/ext4/ext4fs.c: Free dirnode in error path of ext4fs_lsTom Rini
As reported by Coverity, we did not free dirnode in the case of failure. Do so now. Reported-by: Coverity (CID: 131221) Cc: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-06fs/fat: Fix pathnames using '..' that lead to the root directoryTuomas Tynkkynen
If we end up back in the root directory via a '..' directory entry, set itr->is_root accordingly. Failing to do that gives spews like "Invalid FAT entry" and being unable to access directory entries located past the first cluster of the root directory. Fixes: 8eafae209c35 ("fat/fs: convert to directory iterators") Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
2017-10-06fs/ext4: Fix group descriptor checksum calculationTuomas Tynkkynen
The current code doesn't compute the group descriptor checksum correctly for the filesystems that e2fsprogs 1.43.4 creates (they have 'Group descriptor size: 64' as reported by tune2fs). Extend the checksum calculation to be done as ext4_group_desc_csum() does in Linux. This fixes these errors in dmesg from running fs-test.sh and makes it succeed again: [1671902.620699] EXT4-fs (loop1): ext4_check_descriptors: Checksum for group 0 failed (35782!=10965) [1671902.620706] EXT4-fs (loop1): group descriptors corrupted! Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
2017-10-04treewide: replace with error() with pr_err()Masahiro Yamada
U-Boot widely uses error() as a bit noisier variant of printf(). This macro causes name conflict with the following line in include/linux/compiler-gcc.h: # define __compiletime_error(message) __attribute__((error(message))) This prevents us from using __compiletime_error(), and makes it difficult to fully sync BUILD_BUG macros with Linux. (Notice Linux's BUILD_BUG_ON_MSG is implemented by using compiletime_assert().) Let's convert error() into now treewide-available pr_err(). Done with the help of Coccinelle, excluing tools/ directory. The semantic patch I used is as follows: // <smpl> @@@@ -error +pr_err (...) // </smpl> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: Re-run Coccinelle] Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-03fs/btrfs: Fix warning in btrfs_check_super()Tom Rini
We specifically say that the last arg is u32, so use %lu. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-03fs: btrfs: Add U-Boot fs handlers.Marek Behún
Signed-off-by: Marek Behun <marek.behun@nic.cz> create mode 100644 fs/btrfs/Kconfig create mode 100644 fs/btrfs/Makefile create mode 100644 fs/btrfs/btrfs.c create mode 100644 include/btrfs.h
2017-10-03fs: btrfs: Add single-device read-only BTRFS implementationMarek Behún
This adds the proper implementation for the BTRFS filesystem. The implementation currently supports only read-only mode and the filesystem can be only on a single device. Checksums of data chunks is unimplemented. Compression is implemented (ZLIB + LZO). Signed-off-by: Marek Behun <marek.behun@nic.cz> create mode 100644 fs/btrfs/btrfs.h create mode 100644 fs/btrfs/chunk-map.c create mode 100644 fs/btrfs/compression.c create mode 100644 fs/btrfs/ctree.c create mode 100644 fs/btrfs/dev.c create mode 100644 fs/btrfs/dir-item.c create mode 100644 fs/btrfs/extent-io.c create mode 100644 fs/btrfs/hash.c create mode 100644 fs/btrfs/inode.c create mode 100644 fs/btrfs/root.c create mode 100644 fs/btrfs/subvolume.c create mode 100644 fs/btrfs/super.c
2017-10-03fs: btrfs: Add disk-to-cpu and cpu-to-disk conversion functionsMarek Behún
BTRFS on disk structures are stored in Little Endian. Add functions to convert this structures to cpu and to disk format. On Little Endian hosts, these functions do nothing. On Big Endian the CALL_MACRO_FROM_EACH from variadic-macro.h is used to define all the members for each structure on which cpu_to_le* or le*_to_cpu is to be called. Signed-off-by: Marek Behun <marek.behun@nic.cz> create mode 100644 fs/btrfs/conv-funcs.h
2017-10-03fs: btrfs: Add btrfs_tree.h and ctree.h from Linux (and modified)Marek Behún
Add btrfs_tree.h and ctree.h from Linux which contains constants and structures for the BTRFS filesystem. Signed-off-by: Marek Behun <marek.behun@nic.cz> create mode 100644 fs/btrfs/btrfs_tree.h create mode 100644 fs/btrfs/ctree.h
2017-10-03fs: Create a common fs_devread for ext4/reiserfs/zfsMarek Behún
The ext4, reiserfs and zfs filesystems all have their own implementation of the same function, *_devread. Generalize this function into fs_devread and put the code into fs/fs_internal.c. Signed-off-by: Marek Behun <marek.behun@nic.cz> [trini: Move fs/fs_internal.o hunk to the end of fs/Makefile as all cases need it] Signed-off-by: Tom Rini <trini@konsulko.com>
2017-09-22fs/fat: Reduce stack usageTom Rini
We have limited stack in SPL builds. Drop itrblock and move to malloc/free of itr to move this off of the stack. As part of this fix a double-free issue in fat_size(). Signed-off-by: Tom Rini <trini@konsulko.com> --- Rework to use malloc/free as moving this to a global overflows some SH targets.
2017-09-15fs/fat: fix fatbuf leakRob Clark
A new fatbuf was allocated by get_fs_info() (called by fat_itr_root()), but not freed, resulting in eventually running out of memory. Spotted by running 'ls -r' in a large FAT filesystem from Shell.efi. fatbuf is mainly used to cache FAT entry lookups (get_fatent()).. possibly once fat_write.c it can move into the iterator to simplify this. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Łukasz Majewski <lukma@denx.de>
2017-09-15fs/fat: Clean up open-coded sector <-> cluster conversionsRob Clark
Use the clust_to_sect() helper that was introduced earlier, and add an inverse sect_to_clust(), plus update the various spots that open-coded this conversion previously. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-15fs/fat: fix case for FAT shortnamesRob Clark
Noticed when comparing our output to linux. There are some lcase bits which control whether filename and/or extension should be downcase'd. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-15fat/fs: move ls to generic implementationRob Clark
Add a generic implementation of 'ls' using opendir/readdir/closedir, and replace fat's custom implementation. Other filesystems should move to the generic implementation after they add opendir/readdir/closedir support. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-15fat/fs: remove a bunch of dead codeRob Clark
Spotted by chance, when trying to remove file_fat_ls(), I noticed there were some dead users of the API. Signed-off-by: Rob Clark <robdclark@gmail.com> Acked-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-15fs/fat: implement opendir/readdir/closedirRob Clark
Implement the readdir interface using the directory iterators. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-15fs: add fs_readdir()Rob Clark
Needed to support efi file protocol. The fallback.efi loader wants to be able to read the contents of the /EFI directory to find an OS to boot. Modelled after POSIX opendir()/readdir()/closedir(). Unlike the other fs APIs, this is stateful (ie. state is held in the FS_DIR "directory stream"), to avoid re-traversing of the directory structure at each step. The directory stream must be released with closedir() when it is no longer needed. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-15fat/fs: convert to directory iteratorsRob Clark
And drop a whole lot of ugly code! Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-15fs/fat: introduce new director iteratorsRob Clark
Untangle directory traversal into a simple iterator, to replace the existing multi-purpose do_fat_read_at() + get_dentfromdir(). Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Łukasz Majewski <lukma@denx.de>
2017-09-15fs/fat: split out helper to init fsdataRob Clark
Want to re-use this in fat dirent iterator in next patch. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-08-26fs: ext4: Fix journal overrun issue reported by CoverityTom Rini
While &p_jdb[fs->blksz] is a valid expression (it points *one* char sized element past the end of the array, e.g. &p_jdb[fs->blksz + 1] is invalid (according to the C standard (C99/C11)). Changing this to tag = (struct ext3_journal_block_tag *)(p_jdb + ofs); Cc: Stefan Brüns <stefan.bruens@rwth-aachen.de> Suggested-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reported-by: Coverity (CID: 165117, 165110) Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2017-08-26fs: fat: fix fatwrite overflow calculationReno Farnesi
The overflow calculation was incorrect. Adding the start block of the partition is not needed because the sectors are already relative to the beginning of the partition. If you attempted to write a file smaller than cur_part_info.start blocks on a full partition the old calculation fails to catch the overflow. This would cause an infinite loop in the determine_fatent function. Old, incorrect calculation: ending sector of new file = start sector + file size (in sectors) last sector = partition start + total sectors on the partition Adding the partition start block number is not needed because sectors are already relative to the start of the partition. New calculation: ending sector of new file = start sector + file size (in sectors) last sector = total sectors on the partition Signed-off-by: Reno Farnesi <nfarnesi4@gmail.com>
2017-08-20fs/fat: Correct blk_dread() return value checkTom Rini
The function blk_dread will return -ENOSYS on failure or on success the number of blocks read, which must be the number asked to read (otherwise it failed somewhere). Correct this check. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-08-16env: Rename getenv/_f() to env_get()Simon Glass
We are now using an env_ prefix for environment functions. Rename these two functions for consistency. Also add function comments in common.h. Quite a few places use getenv() in a condition context, provoking a warning from checkpatch. These are fixed up in this patch also. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-16env: Rename common functions related to setenv()Simon Glass
We are now using an env_ prefix for environment functions. Rename these commonly used functions, for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-16env: Rename setenv() to env_set()Simon Glass
We are now using an env_ prefix for environment functions. Rename setenv() for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-11Convert CONFIG_CMD_YAFFS2 to KconfigSimon Glass
This converts the following to Kconfig: CONFIG_CMD_YAFFS2 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-07-12fs: use get_nand_dev_by_index()Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
2017-07-11Kconfig: Add CONFIG_SATA to enable SATASimon Glass
At present CONFIG_CMD_SATA enables the 'sata' command which also brings in SATA support. Some boards may wish to enable SATA without the command. Add a separate CONFIG to permit this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2017-06-16treewide: remove unneeded semicolonsMasahiro Yamada
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-06-06fs: usbifs: Fix warning in ubifsSiva Durga Prasad Paladugu
This patch fixes the below warning by typecasting it properly fs/ubifs/ubifs.c: In function 'ubifs_load': fs/ubifs/ubifs.c:942:29: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] err = ubifs_read(filename, (void *)addr, 0, size, &actread); Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2017-06-03fs: fat: add kbuild configuration supportSekhar Nori
Add Kconfig symbols for various configurations supported by FAT filesystem support code. CONFIG_SUPPORT_VFAT has been left out since its force enabled in include/fat.h and probably should get removed at some point. Signed-off-by: Sekhar Nori <nsekhar@ti.com> [trini: add select FS_FAT for CMD_FAT and SPL_FAT_SUPPORT] Signed-off-by: Tom Rini <trini@konsulko.com>
2017-05-22fs: Kconfig: Add a separate option for FS_JFFS2Simon Glass
Rather than using CMD_JFFS2 for both the filesystem and its command, we should have a separate option for each. This allows us to enable JFFS2 support without the command, if desired, which reduces U-Boot's size slightly. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-05-22Kconfig: Add a CONFIG_IDE optionSimon Glass
At present IDE support is controlled by CONFIG_CMD_IDE. Add a separate CONFIG_IDE option so that IDE support can be enabled without requiring the 'ide' command. Update existing users and move the ide driver into drivers/block since it should not be in common/. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-04-30fs: Kconfig: Add a separate option for FS_CRAMFSSimon Glass
Rather than using CMD_CRAMFS for both the filesystem and its command, we should have a separate option for each. This allows us to enable CRAMFS support without the command, if desired, which reduces U-Boot's size slightly. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: imply FS_CRAMFS for keymile] Signed-off-by: Tom Rini <trini@konsulko.com>
2017-04-30fs: Kconfig: Add a separate config for FS_CBFSSimon Glass
Rather than using CMD_CBFS for both the filesystem and its command, we should have a separate option for each. This allows us to enable CBFS support without the command, if desired, which reduces U-Boot's size slightly. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: imply FS_CBFS on SYS_COREBOOT] Signed-off-by: Tom Rini <trini@konsulko.com>
2017-04-27ext4: Fix comparision of unsigned expression with < 0Lokesh Vutla
In file ext4fs.c funtion ext4fs_read_file() compares an unsigned expression with < 0 like below lbaint_t blknr; blknr = read_allocated_block(&(node->inode), i); if (blknr < 0) return -1; blknr is of type ulong/uint64_t. read_allocated_block() returns long int. So comparing blknr with < 0 will always be false. Instead declare blknr as long int. Similarly ext4/dev.c does a similar comparison. Drop the redundant comparison. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-04-18yaffs2: remove redundant conditionxypron.glpk@gmx.de
If !parent, the changed line is not reached. So there is no need to check the value again. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-04-18cramfs: basic symlink supportTyler Hall
Handle symlinks to files in the current directory. Other cases could be handled with additional code, but this is a start. Add explicit errors for absolute paths and links found in the middle of a path (directories). Other cases like '..' or '.' will result with the file not being found as when those path components are explicitly provided. Add a helper to decompress a null-terminated link name which is shared with cramfs_list_inode. Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
2017-04-18cramfs: block pointers are 32 bitsTyler Hall
Using a variably-sized type is incorrect here since we're reading a fixed file format. Fixes cramfs on 64-bit platforms. Signed-off-by: Tyler Hall <tylerwhall@gmail.com>