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

    Ye Li
     

15 Dec, 2018

1 commit

  • Error: Invalid FAT entry: 0x3ffffffa
    create file

    when 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 area

    Signed-off-by: Frank Li

    Frank Li
     

23 Jan, 2018

2 commits


20 Jan, 2018

1 commit


10 Jan, 2018

1 commit


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 - 0x4f59e7c8

    To 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

    Neil Armstrong
     

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

    Tuomas 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
    Reviewed-by: Tom Rini

    Tuomas Tynkkynen
     

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

    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.

    Tom Rini
     

15 Sep, 2017

9 commits


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 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

    Reno Farnesi
     

20 Aug, 2017

1 commit


12 Jul, 2017

1 commit


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

    Sekhar Nori
     

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

    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 8d48c92b45aea91e2a2be90f2ed93677e85526f1

    Reported-by: Oleksandr Tymoshenko
    Signed-off-by: Stefan Brüns
    Tested-by: Oleksandr Tymoshenko

    Stefan Brüns
     

28 Jan, 2017

1 commit


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

    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

    Stefan Brüns
     
  • 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

    Stefan Brüns
     
  • 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/1

    The patch fixes the bounds of a file and FAT12 entries chaining into
    a file, including EOF markup.

    Signed-off-by: Philipp Skadorov

    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

    Tien Fong Chee
     

23 Sep, 2016

3 commits


17 May, 2016

1 commit


23 Mar, 2016

1 commit


15 Mar, 2016

3 commits