<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/include/fat.h, branch v2014.01</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<entry>
<title>Add GPL-2.0+ SPDX-License-Identifier to source files</title>
<updated>2013-07-24T13:44:38+00:00</updated>
<author>
<name>Wolfgang Denk</name>
<email>wd@denx.de</email>
</author>
<published>2013-07-08T07:37:19+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=1a4596601fd395f3afb8f82f3f840c5e00bdd57a'/>
<id>1a4596601fd395f3afb8f82f3f840c5e00bdd57a</id>
<content type='text'>
Signed-off-by: Wolfgang Denk &lt;wd@denx.de&gt;
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini &lt;trini@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Wolfgang Denk &lt;wd@denx.de&gt;
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini &lt;trini@ti.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fs: Move ls and read methods into ext4, fat</title>
<updated>2013-03-04T19:19:56+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2012-12-26T09:53:33+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=e6d5241534486effa116bf685f7707041492ec7b'/>
<id>e6d5241534486effa116bf685f7707041492ec7b</id>
<content type='text'>
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 &lt;sjg@chromium.org&gt;
Reviewed-by: Tom Rini &lt;trini@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;sjg@chromium.org&gt;
Reviewed-by: Tom Rini &lt;trini@ti.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>FAT: use toupper/tolower instead of recoding them</title>
<updated>2013-02-04T14:05:46+00:00</updated>
<author>
<name>Richard Genoud</name>
<email>richard.genoud@gmail.com</email>
</author>
<published>2012-12-13T00:47:36+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=fb7e16cc1c1f5d5bb212118b89218b2e706226b2'/>
<id>fb7e16cc1c1f5d5bb212118b89218b2e706226b2</id>
<content type='text'>
toupper/tolower function are already declared, so use them.

Signed-off-by: Richard Genoud &lt;richard.genoud@gmail.com&gt;
Acked-by: Marek Vasut &lt;marex@denx.de&gt;
Acked-by: Stefano Babic &lt;sbabic@denx.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
toupper/tolower function are already declared, so use them.

Signed-off-by: Richard Genoud &lt;richard.genoud@gmail.com&gt;
Acked-by: Marek Vasut &lt;marex@denx.de&gt;
Acked-by: Stefano Babic &lt;sbabic@denx.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>FAT: implement fat_set_blk_dev(), convert cmd_fat.c</title>
<updated>2012-10-25T19:07:47+00:00</updated>
<author>
<name>Stephen Warren</name>
<email>swarren@nvidia.com</email>
</author>
<published>2012-10-17T06:44:59+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=5e8f98319d8582d6a066610b5f1ec9b1a3f79704'/>
<id>5e8f98319d8582d6a066610b5f1ec9b1a3f79704</id>
<content type='text'>
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 &lt;swarren@nvidia.com&gt;
Reviewed-by: Benoît Thébaudeau &lt;benoit.thebaudeau@advansee.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;swarren@nvidia.com&gt;
Reviewed-by: Benoît Thébaudeau &lt;benoit.thebaudeau@advansee.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>FAT: Make it possible to read from any file position</title>
<updated>2012-09-26T18:11:32+00:00</updated>
<author>
<name>Benoît Thébaudeau</name>
<email>benoit.thebaudeau@advansee.com</email>
</author>
<published>2012-09-18T08:14:56+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=1170e634dd2a6fdd541ae2153fd3fd73919da8fc'/>
<id>1170e634dd2a6fdd541ae2153fd3fd73919da8fc</id>
<content type='text'>
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 &lt;benoit.thebaudeau@advansee.com&gt;
Cc: Wolfgang Denk &lt;wd@denx.de&gt;
Signed-off-by: Tom Rini &lt;trini@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;benoit.thebaudeau@advansee.com&gt;
Cc: Wolfgang Denk &lt;wd@denx.de&gt;
Signed-off-by: Tom Rini &lt;trini@ti.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fat: fix FAT sector offsets overflow on large FAT partitions</title>
<updated>2012-05-22T08:14:05+00:00</updated>
<author>
<name>Aaron Williams</name>
<email>aaron.williams@caviumnetworks.com</email>
</author>
<published>2012-05-19T07:20:40+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=1d90c3b457a64aa339aa900199e519ff08440778'/>
<id>1d90c3b457a64aa339aa900199e519ff08440778</id>
<content type='text'>
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 cluster

These issues were observed when reading files from a 64GB FAT32
filesystem.

Signed-off-by: Aaron Williams &lt;aaron.williams@caviumnetworks.com&gt;
Tested-by: Anatolij Gustschin &lt;agust@denx.de&gt;
Signed-off-by: Anatolij Gustschin &lt;agust@denx.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 cluster

These issues were observed when reading files from a 64GB FAT32
filesystem.

Signed-off-by: Aaron Williams &lt;aaron.williams@caviumnetworks.com&gt;
Tested-by: Anatolij Gustschin &lt;agust@denx.de&gt;
Signed-off-by: Anatolij Gustschin &lt;agust@denx.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>FAT: Add FAT write feature</title>
<updated>2011-10-26T19:40:44+00:00</updated>
<author>
<name>Donggeun Kim</name>
<email>dg77.kim@samsung.com</email>
</author>
<published>2011-10-24T21:15:28+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=c30a15e590c7e5bfd27e4704c81648071f11d51f'/>
<id>c30a15e590c7e5bfd27e4704c81648071f11d51f</id>
<content type='text'>
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 &lt;dg77.kim@samsung.com&gt;
Signed-off-by: Kyungmin Park &lt;kyungmin.park@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;dg77.kim@samsung.com&gt;
Signed-off-by: Kyungmin Park &lt;kyungmin.park@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fat: replace LINEAR_PREFETCH_SIZE with PREFETCH_BLOCKS</title>
<updated>2011-10-01T19:52:19+00:00</updated>
<author>
<name>Sergei Shtylyov</name>
<email>sshtylyov@ru.mvista.com</email>
</author>
<published>2011-08-19T09:37:46+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=025421eab453fd41a3cc14a0fc48115b0dc4c287'/>
<id>025421eab453fd41a3cc14a0fc48115b0dc4c287</id>
<content type='text'>
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 &lt;sshtylyov@mvista.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;sshtylyov@mvista.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fat: fix crash with big sector size</title>
<updated>2011-10-01T19:50:39+00:00</updated>
<author>
<name>Sergei Shtylyov</name>
<email>sshtylyov@ru.mvista.com</email>
</author>
<published>2011-08-08T09:38:33+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=ac4977719e157bcb3c45c70d9dd781164727530d'/>
<id>ac4977719e157bcb3c45c70d9dd781164727530d</id>
<content type='text'>
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 &lt;sshtylyov@mvista.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;sshtylyov@mvista.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>VFAT: fix processing of scattered long file name entries</title>
<updated>2010-10-12T20:39:14+00:00</updated>
<author>
<name>Mikhail Zolotaryov</name>
<email>lebon@lebon.org.ua</email>
</author>
<published>2010-09-08T14:06:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=3831530dcb7b71329c272ccd6181f8038b6a6dd0'/>
<id>3831530dcb7b71329c272ccd6181f8038b6a6dd0</id>
<content type='text'>
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 &lt;lebon@lebon.org.ua&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;lebon@lebon.org.ua&gt;
</pre>
</div>
</content>
</entry>
</feed>
