aboutsummaryrefslogtreecommitdiff
path: root/fs/fat/fat.c
diff options
context:
space:
mode:
authorHeinrich Schuchardt2020-11-22 16:04:47 +0100
committerHeinrich Schuchardt2020-12-10 09:14:59 +0100
commit7557c8485517aa9d2602abb0010c10ab64feee72 (patch)
treea3c8f7edd972ff4f9c18e18b3b4ea889d2aca74d /fs/fat/fat.c
parent27ed690382fd6f6e5796ec9c08693a94cfdc0f14 (diff)
fs: fat: set start cluster for root directory
When iterating over a child directory we set itr->start_clust. Do the same when over the root directory. When looking for deleted directory entries or existing short names we will have to iterate over directories a second and third time. With this patch we do not need any special logic for the root directory. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'fs/fat/fat.c')
-rw-r--r--fs/fat/fat.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 674236d68a6..5a418cfbb7a 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -734,7 +734,7 @@ static int fat_itr_root(fat_itr *itr, fsdata *fsdata)
return -ENXIO;
itr->fsdata = fsdata;
- itr->start_clust = 0;
+ itr->start_clust = fsdata->root_cluster;
itr->clust = fsdata->root_cluster;
itr->next_clust = fsdata->root_cluster;
itr->dent = NULL;
@@ -778,6 +778,7 @@ static void fat_itr_child(fat_itr *itr, fat_itr *parent)
} else {
itr->clust = parent->fsdata->root_cluster;
itr->next_clust = parent->fsdata->root_cluster;
+ itr->start_clust = parent->fsdata->root_cluster;
itr->is_root = 1;
}
itr->dent = NULL;
@@ -1067,6 +1068,7 @@ static int fat_itr_resolve(fat_itr *itr, const char *path, unsigned type)
/* point back to itself */
itr->clust = itr->fsdata->root_cluster;
itr->next_clust = itr->fsdata->root_cluster;
+ itr->start_clust = itr->fsdata->root_cluster;
itr->dent = NULL;
itr->remaining = 0;
itr->last_cluster = 0;