nuttx/fs/fat
Jukka Laitinen 26b7de0f34 fs/fat: Fix number of data clusters usable for fat driver
Fix the issue where fat driver is not using the last two clusters in
the file system.

The fat parameter fs->fs_nclusters is the maximum number of data clusters;
this doesn't include the two in the beginning. Many checks in the fat driver
treat the fs->fs_nclusters-1 as being the last accessible cluster, which is not
right, the last accessible one is actually this number + 2 when the cluster
count includes the two first ones.

Normally this is not an issue when writes are being done through the same
driver, the last two clusters are just never used. But if the filesystem is
modified by external driver, for example with a populated fat created with PC,
or modifying the FS via USB-MSC, this leads to the fat driver not being able to
read anything that uses the last two clusters.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-12-22 11:09:12 +01:00
..
CMakeLists.txt build: add initial cmake build system 2023-07-08 13:50:48 +08:00
fs_fat32.c fs/fat: Fix number of data clusters usable for fat driver 2023-12-22 11:09:12 +01:00
fs_fat32.h Indent the define statement by two spaces 2023-05-21 09:52:08 -03:00
fs_fat32attrib.c fs/inode: remove all unnecessary check for filep/inode 2023-08-29 09:47:11 +08:00
fs_fat32dirent.c
fs_fat32util.c fs/fat: Fix number of data clusters usable for fat driver 2023-12-22 11:09:12 +01:00
Kconfig Kconfig: Simplify the conditional default statement 2023-07-16 14:39:20 -03:00
Make.defs