24 Sep, 2018
3 commits
-
In this patch, unlink support is added to FAT file system.
A directory can be deleted only if it is empty.In this implementation, only a directory entry for a short file name
will be removed. So entries for a long file name can and should be
reclaimed with fsck.Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf -
In this patch, mkdir support is added to FAT file system.
A newly created directory contains only "." and ".." entries.Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf -
get_fs_info() was introduced in major re-work of read operation by Rob.
We want to reuse this function in write operation by extending it with
additional members in fsdata structure.Signed-off-by: AKASHI Takahiro
Signed-off-by: Alexander Graf
13 Jun, 2018
1 commit
-
After the commit 265edc03d5a1 ("fs/fat: Clean up open-coded sector
cluster conversions"), it is hung up writing new file to FAT16
disk with more than 19 files in armv7. It is because result value
of sect_to_cluster() is not proper by casting from signed value to
unsigned value. Fix the wrong casting of sect_to_cluster().Reported-by: Jaehoon Chung
Signed-off-by: Seung-Woo Kim
Reviewed-by: Lukasz Majewski
07 May, 2018
1 commit
-
When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.Signed-off-by: Tom Rini
23 Jan, 2018
1 commit
-
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
15 Sep, 2017
7 commits
-
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 -
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
04 Jun, 2017
1 commit
-
Now that these symbols are in Kconfig, migrate all users. Use imply on
a number of platforms that default to having this enabled. As part of
this we must migrate some straglers for CMD_FAT and DOS_PARTITION.Signed-off-by: Tom Rini
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
1 commit
-
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
15 Mar, 2016
1 commit
-
Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
and causes 80-column violations, rename it to struct blk_desc.Signed-off-by: Simon Glass
Reviewed-by: Bin Meng
Tested-by: Stephen Warren
23 Nov, 2014
2 commits
-
The sandbox/ext4/fat/generic fs commands do not gracefully deal with files
greater than 2GB. Negative values are returned in such cases.To handle this, the fs functions have been modified to take an additional
parameter of type "* loff_t" which is then populated. The return value
of the fs functions are used only for error conditions.Signed-off-by: Suriyan Ramasami
Acked-by: Simon Glass
[trini: Update board/gdsys/p1022/controlcenterd-id.c,
drivers/fpga/zynqpl.c for changes]
Signed-off-by: Tom Rini -
Change the internal FAT functions to use loff_t for offsets.
Signed-off-by: Suriyan Ramasami
Acked-by: Simon Glass
[trini: Fix fs/fat/fat.c for min3 updates]
Signed-off-by: Tom Rini
09 Aug, 2014
1 commit
-
These commands may be used to determine the size of a file without
actually reading the whole file content into memory. This may be used
to determine if the file will fit into the memory buffer that will
contain it. In particular, the DFU code will use it for this purpose
in the next commit.Signed-off-by: Stephen Warren
06 Jun, 2014
1 commit
-
Define the MAX_CLUSTSIZE to default of 65536 only if
CONFIG_FS_FAT_MAX_CLUSTSIZE is not defined.
This option has been provided to save memory in some
memory constrained cases.Signed-off-by: Siva Durga Prasad Paladugu
Acked-by: Michal Simek
13 May, 2014
2 commits
-
In fat_write.c, the last clust condition check is incorrect:
if ((curclust >= 0xffffff8) || (curclust >= 0xfff8)) {
... ...
}For example, in FAT32 if curclust is 0x11000. It is a valid clust.
But on above condition check, it will be think as a last clust.So the correct last clust check should be:
in fat32, curclust >= 0xffffff8
in fat16, curclust >= 0xfff8
in fat12, curclust >= 0xff8This patch correct the last clust check.
Signed-off-by: Josh Wu
-
Signed-off-by: Josh Wu
19 Feb, 2014
1 commit
-
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
Acked-by: Simon Glass
24 Jul, 2013
1 commit
-
Signed-off-by: Wolfgang Denk
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini
05 Mar, 2013
1 commit
-
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
Reviewed-by: Tom Rini
04 Feb, 2013
1 commit
-
toupper/tolower function are already declared, so use them.
Signed-off-by: Richard Genoud
Acked-by: Marek Vasut
Acked-by: Stefano Babic
26 Oct, 2012
1 commit
-
This makes the FAT filesystem API more consistent with other block-based
filesystems. If in the future standard multi-filesystem commands such as
"ls" or "load" are implemented, having FAT work the same way as other
filesystems will be necessary.Convert cmd_fat.c to the new API, so the code looks more like other files
implementing the same commands for other filesystems.Signed-off-by: Stephen Warren
Reviewed-by: Benoît Thébaudeau
27 Sep, 2012
1 commit
-
When storage devices contain files larger than the embedded RAM, it is
useful to be able to read these files by chunks, e.g. for a software
update to the embedded NAND Flash from an external storage device (USB
stick, SD card, etc.).Hence, this patch makes it possible by adding a new FAT API to read
files from a given position. This patch also adds this feature to the
fatload command.Signed-off-by: Benoît Thébaudeau
Cc: Wolfgang Denk
Signed-off-by: Tom Rini
22 May, 2012
1 commit
-
This patch fixes several issues where sector offsets can overflow due
to being limited to 16-bits. The cases where an overflow can happen
when accessing large FAT32 partitions are:- length of FAT in sectors
- start sector of root directory
- the sector of the first clusterThese issues were observed when reading files from a 64GB FAT32
filesystem.Signed-off-by: Aaron Williams
Tested-by: Anatolij Gustschin
Signed-off-by: Anatolij Gustschin
27 Oct, 2011
1 commit
-
In some cases, saving data in RAM as a file with FAT format is required.
This patch allows the file to be written in FAT formatted partition.The usage is similar with reading a file.
First, fat_register_device function is called before file_fat_write function
in order to set target partition.
Then, file_fat_write function is invoked with desired file name,
start ram address for writing data, and file size.Signed-off-by: Donggeun Kim
Signed-off-by: Kyungmin Park
02 Oct, 2011
2 commits
-
Currently in do_fat_read() when reading FAT sectors, we have to divide down
LINEAR_PREFETCH_SIZE by the sector size, whereas it's defined as 2 sectors
worth of bytes. In order to avoid redundant multiplication/division, introduce
#define PREFETCH_BLOCKS instead of #define LINEAR_PREFETCH_SIZE.Signed-off-by: Sergei Shtylyov
-
Apple iPod nanos have sector sizes of 2 or 4 KiB, which crashes U-Boot when it
tries to read the boot sector into 512-byte buffer situated on stack. Make the
FAT code indifferent to the sector size.Signed-off-by: Sergei Shtylyov
13 Oct, 2010
1 commit
-
The U-Boot code has the following bugs related to the processing of Long File
Name (LFN) entries scattered across several clusters/sectors :1) get_vfatname() function is designed to gather scattered LFN entries by
cluster chain processing - that doesn't work for FAT12/16 root directory.
In other words, the function expects the following input data:
1.1) FAT32 directory (which is cluster chain based);
OR
1.2) FAT12/16 non-root directory (which is also cluster chain based);
OR
1.3) FAT12/16 root directory (allocated as contiguous sectors area), but
all necessary information MUST be within the input buffer of filesystem cluster
size (thus cluster-chain jump is never initiated).In order to accomplish the last condition, root directory parsing code in
do_fat_read() uses the following trick: read-out cluster-size block, process
only first sector (512 bytes), then shift 512 forward, read-out cluster-size
block and so on. This works great unless cluster size is equal to 512 bytes
(in a case you have a small partition), or long file name entries are scattered
across three sectors, see 4) for details.2) Despite of the fact that get_vfatname() supports FAT32 root directory
browsing, do_fat_read() function doesn't send current cluster number correctly,
so root directory look-up doesn't work correctly.3) get_vfatname() doesn't gather scattered entries correctly also is the case
when all LFN entries are located at the end of the source cluster, but real
directory entry (which must be returned) is at the only beginning of the
next one. No error detected, the resulting directory entry returned contains
a semi-random information (wrong size, wrong start cluster number and so on)
i.e. the entry is not accessible.4) LFN (VFAT) allows up to 20 entries (slots) each containing 26 bytes (13
UTF-16 code units) to represent a single long file name i.e. up to 520 bytes.
U-Boot allocates 256 bytes buffer instead, i.e. 10 or more LFN slots record
may cause buffer overflow / memory corruption.
Also, it's worth to mention that 20+1 slots occupy 672 bytes space which may
take more than one cluster of 512 bytes (medium-size FAT32 or small FAT16
partition) - get_vfatname() function doesn't support such case as well.The patch attached fixes these problems in the following way:
- keep using 256 bytes buffer for a long file name, but safely prevent a
possible buffer overflow (skip LFN processing, if it contains 10 or more
slots).- explicitly specify FAT12/16 root directory parsing buffer size, instead
of relying on cluster size. The value used is a double sector size (to store
current sector and the next one). This fixes the first problem and increases
performance on big FAT12/16 partitions;- send current cluster number (FAT32) to get_vfatname() during root
directory processing;- use LFN counter to seek the real directory entry in get_vfatname() - fixes the
third problem;- skip deleted entries in the root directory (to prevent bogus buffer
overflow detection and LFN counter steps).Note: it's not advised to split up the patch, because a separate part may
operate incorrectly.Signed-off-by: Mikhail Zolotaryov
25 Jul, 2010
1 commit
-
- reformat
- throw out macros like FAT_DPRINT and FAT_DPRINT
- remove dead codeSigned-off-by: Wolfgang Denk
05 Dec, 2008
1 commit
-
This code contains some non-ascii characters in comment lines and code.
Most editors do not display those characters properly and editing those
files results always in diffs at these places which are usually not required
to be changed at all. This is error prone.So, remove those weird characters and replace them by normal C-style
equivalents for which the proper defines were already in the header.Signed-off-by: Remy Bohmer
21 May, 2008
1 commit
-
This commit gets rid of a huge amount of silly white-space issues.
Especially, all sequences of SPACEs followed by TAB characters get
removed (unless they appear in print statements).Also remove all embedded "vim:" and "vi:" statements which hide
indentation problems.Signed-off-by: Wolfgang Denk
03 Mar, 2008
1 commit
-
This fixes the cluster size tests in the FAT32 file system.
The current implementation of VFAT support doesn't work if the
referred cluster has an offset > 16bit representation, causing
"fatload" and "fatls" commands etc. to fail.Signed-off-by: michael trimarchi
15 Aug, 2006
1 commit
-
Patch by Joachim Jaeger, 18 Nov 2005
24 Apr, 2004
1 commit
-
sticks (including FAT / VFAT filesystem support)
* Add SL811 Host Controller Interface driver for USB
* Add CFG_I2C_EEPROM_ADDR_OVERFLOW desription to README
* Patch by Pantelis Antoniou, 19 Apr 2004:
Allow to use shell style syntax (i. e. ${var} ) with standard parser.
Minor patches for Intracom boards.* Patch by Christian Pell, 19 Apr 2004:
cleanup support for CF/IDE on PCMCIA for PXA25X