aboutsummaryrefslogtreecommitdiff
path: root/fs/fat/fat.c
diff options
context:
space:
mode:
authorThomas RIENOESSL2018-11-13 14:00:59 +0100
committerTom Rini2018-11-20 12:35:35 -0500
commita68b0e11ea774492713a65d9fd5bb525fcaefff3 (patch)
tree0403cedae741708dc0393a6297fb65e1a480cea2 /fs/fat/fat.c
parent2fa77bd12533e29e1b0f1742f66f258700715d52 (diff)
fs: fat: assign rootdir sector when accessing root directory
This fixes problems accessing drives formated under Windows as FAT16. Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info> [trini: Rebase on top of f528c140c801] Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'fs/fat/fat.c')
-rw-r--r--fs/fat/fat.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index b08949d3705..4bc3030ab88 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -725,7 +725,10 @@ static void *next_cluster(fat_itr *itr)
if (itr->last_cluster)
return NULL;
- sect = clust_to_sect(itr->fsdata, itr->next_clust);
+ if (itr->fsdata->fatsize != 32 && itr->is_root)
+ sect = mydata->rootdir_sect;
+ else
+ sect = clust_to_sect(itr->fsdata, itr->next_clust);
debug("FAT read(sect=%d), clust_size=%d, DIRENTSPERBLOCK=%zd\n",
sect, itr->fsdata->clust_size, DIRENTSPERBLOCK);