aboutsummaryrefslogtreecommitdiff
path: root/fs/fat/fat.c
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2018-09-11 15:59:09 +0900
committerAlexander Graf <agraf@suse.de>2018-09-23 21:55:29 +0200
commit3a10e07234e5f545ca70088e99f27d6098201449 (patch)
treef87266387824b75343a184b585da9c1e882362d3 /fs/fat/fat.c
parente7074cffb8dccf862260e15b8de5297891c917a0 (diff)
downloadu-boot-3a10e07234e5f545ca70088e99f27d6098201449.zip
u-boot-3a10e07234e5f545ca70088e99f27d6098201449.tar.gz
u-boot-3a10e07234e5f545ca70088e99f27d6098201449.tar.bz2
fs: fat: remember the starting cluster number of directory
The starting cluster number of directory is needed to initialize ".." (parent directory) entry when creating a new directory. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'fs/fat/fat.c')
-rw-r--r--fs/fat/fat.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 6d7012c..73ffdea 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -631,6 +631,7 @@ static int get_fs_info(fsdata *mydata)
typedef struct {
fsdata *fsdata; /* filesystem parameters */
+ unsigned start_clust; /* first cluster */
unsigned clust; /* current cluster */
unsigned next_clust; /* next cluster if remaining == 0 */
int last_cluster; /* set once we've read last cluster */
@@ -663,6 +664,7 @@ static int fat_itr_root(fat_itr *itr, fsdata *fsdata)
return -ENXIO;
itr->fsdata = fsdata;
+ itr->start_clust = 0;
itr->clust = fsdata->root_cluster;
itr->next_clust = fsdata->root_cluster;
itr->dent = NULL;
@@ -698,6 +700,7 @@ static void fat_itr_child(fat_itr *itr, fat_itr *parent)
assert(fat_itr_isdir(parent));
itr->fsdata = parent->fsdata;
+ itr->start_clust = clustnum;
if (clustnum > 0) {
itr->clust = clustnum;
itr->next_clust = clustnum;