04 Jan, 2019
1 commit
-
The FAT16/12 has rootdir area before data area, and the clusters for
rootdir are not mantained by FAT table. So we don't need to find empty
cluster for next rootdir space, just use next dir cluster. And the FAT
table don't need to update for this new dir cluster.Signed-off-by: Ye Li
Acked-by: Peng Fan
15 Dec, 2018
1 commit
-
Error: Invalid FAT entry: 0x3ffffffa
create filewhen Long file name cross root dir cluster boundry, this issue
happen.get_long_file_name have not consider fat12/16 case, which rootdir
locate before data area. and try to get next clust directly. Only
FAT32's root dir is located in data areaSigned-off-by: Frank Li
23 Jan, 2018
2 commits
-
fat.h unconditionally defines CONFIG_SUPPORT_VFAT (and has done since
2003), so as a result VFAT support is always enabled regardless of
whether a board config defines it or not. Drop this unnecessary option.Signed-off-by: Tuomas Tynkkynen
-
Signed-off-by: Tuomas Tynkkynen
20 Jan, 2018
1 commit
-
The message "reading %s\n" may be interesting when
debugging but otherwise it is superfluous.Only output the message when debugging.
Signed-off-by: Heinrich Schuchardt
Reviewed-by: Simon Glass
10 Jan, 2018
1 commit
-
commit 21a24c3bf35b ("fs/fat: fix case for FAT shortnames") made it
possible that get_name() returns file names with some upper cases.
find_directory_entry() must be updated to take this account, and use
case-insensitive functions to compare file names.Signed-off-by: Jean-Jacques Hiblot
30 Nov, 2017
1 commit
-
Before this patch one could receive following errors when executing "fatls"
command on machine with cache enabled (ex i.MX6Q) :=> fatls mmc 0:1
CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x4f59dfc8
ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x4f59e7c8
CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x4f59dfc8
ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x4f59e7c8To alleviate this problem - the calloc()s have been replaced with
malloc_cache_aligned() and memset().After those changes the buffers are properly aligned (with both start
address and size) to SoC cache line.Fixes: 09fa964bba80 ("fs/fat: Fix 'CACHE: Misaligned operation at range' warnings")
Suggested-by: Lukasz Majewski
Signed-off-by: Neil Armstrong
Reviewed-by: Lukasz Majewski
Reviewed-by: Fabio Estevam
09 Oct, 2017
2 commits
-
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
Reviewed-by: Tom Rini -
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
Reviewed-by: Tom Rini
06 Oct, 2017
1 commit
-
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
Signed-off-by: Tuomas Tynkkynen
22 Sep, 2017
1 commit
-
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
---
Rework to use malloc/free as moving this to a global overflows some SH
targets.
15 Sep, 2017
9 commits
-
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
Reviewed-by: Simon Glass
Reviewed-by: Łukasz Majewski -
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
Reviewed-by: Simon Glass -
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
Reviewed-by: Łukasz Majewski
Reviewed-by: Simon Glass -
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
Reviewed-by: Łukasz Majewski
Reviewed-by: Simon Glass -
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
Acked-by: Stefan Brüns
Reviewed-by: Simon Glass -
Implement the readdir interface using the directory iterators.
Signed-off-by: Rob Clark
Reviewed-by: Łukasz Majewski
Reviewed-by: Simon Glass -
And drop a whole lot of ugly code!
Signed-off-by: Rob Clark
Reviewed-by: Łukasz Majewski
Reviewed-by: Simon Glass -
Untangle directory traversal into a simple iterator, to replace the
existing multi-purpose do_fat_read_at() + get_dentfromdir().Signed-off-by: Rob Clark
Reviewed-by: Łukasz Majewski -
Want to re-use this in fat dirent iterator in next patch.
Signed-off-by: Rob Clark
Reviewed-by: Łukasz Majewski
Reviewed-by: Simon Glass
27 Aug, 2017
1 commit
-
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 partitionAdding 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 partitionSigned-off-by: Reno Farnesi
20 Aug, 2017
1 commit
-
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
12 Jul, 2017
1 commit
-
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
Reviewed-by: Bin Meng
04 Jun, 2017
1 commit
-
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
[trini: add select FS_FAT for CMD_FAT and SPL_FAT_SUPPORT]
Signed-off-by: Tom Rini
23 May, 2017
1 commit
-
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
29 Jan, 2017
1 commit
-
Doing unaligned reads is not supported on all architectures, use
byte sized reads of the little endian buffer.
Rename off16 to off8, as it reflects the buffer offset in byte
granularity (offset is in entry, i.e. 12 bit, granularity).
Fix a regression introduced in 8d48c92b45aea91e2a2be90f2ed93677e85526f1Reported-by: Oleksandr Tymoshenko
Signed-off-by: Stefan Brüns
Tested-by: Oleksandr Tymoshenko
28 Jan, 2017
1 commit
-
We convert CONFIG_PARTITION_UUIDS to Kconfig first. But in order to cleanly
update all of the config files we must also update CMD_PART and CMD_GPT to also
be in Kconfig in order to avoid complex logic elsewhere to update all of the
config files.Signed-off-by: Patrick Delaunay
Signed-off-by: Patrick Delaunay
Signed-off-by: Tom Rini
28 Dec, 2016
4 commits
-
Instead of shuffling bits from two adjacent 16 bit words, use one 16 bit
word with the appropriate byte offset in the buffer.Signed-off-by: Stefan Brüns
-
get_fatent_value(...) flushes changed FAT entries to disk when fetching
the next FAT blocks, in every other aspect it is identical to
get_fatent(...).Provide a stub implementation for flush_dirty_fat_buffer if
CONFIG_FAT_WRITE is not set. Calling flush_dirty_fat_buffer during read
only operation is fine as it checks if any buffers needs flushing.Signed-off-by: Stefan Brüns
Reviewed-by: Benoît Thébaudeau -
The FAT is read/flushed in segments of 6 (FATBUFBLOCKS) disk sectors. The
last segment may be less than 6 sectors, cap the length.Signed-off-by: Stefan Brüns
Reviewed-by: Benoît Thébaudeau -
The u-boot command fatwrite empties FAT clusters from the beginning
till the end of the file.
Specifically for FAT12 it fails to detect the end of the file and goes
beyond the file bounds thus corrupting the file system.Additionally, FAT entry chaining-up into a file is not implemented
for FAT12.The users normally workaround this by re-formatting the partition as
FAT16/FAT32, like here:
https://github.com/FEDEVEL/openrex-uboot-v2015.10/issues/1The patch fixes the bounds of a file and FAT12 entries chaining into
a file, including EOF markup.Signed-off-by: Philipp Skadorov
29 Nov, 2016
1 commit
-
fill_dir_slot use get_contents_vfatname_block as a temporary buffer for
constructing a list of dir_slot entries. To save the memory and providing
correct type of memory for above usage, a local buffer with accurate size
declaration is introduced.The local array size 640 is used because for long file name entry,
each entry use 32 bytes, one entry can store up to 13 characters.
The maximum number of entry possible is 20. So, total size is
32*20=640bytes.Signed-off-by: Genevieve Chan
Signed-off-by: Tien Fong Chee
23 Sep, 2016
3 commits
-
Current description does not match the function behaviour.
Signed-off-by: Stefan Brüns
Acked-by: Lukasz Majewski -
The code caches 6 sectors of the FAT. On FAT traversal, the old contents
needs to be flushed to disk, but only if any FAT entries had been modified.
Explicitly flag the buffer on modification.Currently, creating a new file traverses the whole FAT up to the first
free cluster and rewrites the on-disk blocks.Signed-off-by: Stefan Brüns
Reviewed-by: Lukasz Majewski -
fatlength is a local variable which is no more used after the assignment.
s_name is not used in the function, save the strncpy.Signed-off-by: Stefan Brüns
Acked-by: Lukasz Majewski
Acked-by: Stephen Warren
Reviewed-by: Benoît Thébaudeau
17 May, 2016
1 commit
-
This option currently enables both the command and the SCSI functionality.
Rename the existing option to CONFIG_SCSI since most of the code relates
to the feature.Signed-off-by: Simon Glass
23 Mar, 2016
1 commit
-
Signed-off-by: Vagrant Cascadian
Reviewed-by: Simon Glass
Reviewed-by: Tom Rini
Reviewed-by: Peter Griffin
15 Mar, 2016
3 commits
-
To ease conversion to driver model, add helper functions which deal with
calling each block device method. With driver model we can reimplement these
functions with the same arguments.Use inline functions to avoid increasing code size on some boards.
Signed-off-by: Simon Glass
Reviewed-by: Bin Meng
Tested-by: Stephen Warren -
This is a device number, and we want to use 'dev' to mean a driver model
device. Rename the member.Signed-off-by: Simon Glass
Reviewed-by: Bin Meng
Tested-by: Stephen Warren -
Rename three partition functions so that they start with part_. This makes
it clear what they relate to.Signed-off-by: Simon Glass
Tested-by: Stephen Warren