diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2020-11-19 07:44:08 +0100 |
---|---|---|
committer | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2020-12-10 09:15:00 +0100 |
commit | 89735b44c4cee895b416f005468370d2943fa8d8 (patch) | |
tree | ed3cdbe60acdb23d583193fca8901ba04c060219 /fs/fat | |
parent | 4a593dd0c5a1e1af40f47758f2aa1a4074a4ccdc (diff) | |
download | u-boot-89735b44c4cee895b416f005468370d2943fa8d8.tar.gz u-boot-89735b44c4cee895b416f005468370d2943fa8d8.tar.bz2 u-boot-89735b44c4cee895b416f005468370d2943fa8d8.zip |
fs: fat: first dentry of long name in FAT iterator
A long name is split over multiple directory entries. When deleting a file
with a long name we need the first directory entry to be able to delete the
whole chain.
Add the necessary fields to the FAT iterator:
* cluster of first directory entry
* address of first directory entry
* remaining entries in cluster
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'fs/fat')
-rw-r--r-- | fs/fat/fat.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 5a418cfbb7..47344bb57e 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -701,6 +701,18 @@ struct fat_itr { */ dir_entry *dent; /** + * @dent_rem: remaining entries after long name start + */ + int dent_rem; + /** + * @dent_clust: cluster of long name start + */ + unsigned int dent_clust; + /** + * @dent_start: first directory entry for long name + */ + dir_entry *dent_start; + /** * @l_name: long name of current directory entry */ char l_name[VFAT_MAXLEN_BYTES]; @@ -966,9 +978,13 @@ static int fat_itr_next(fat_itr *itr) while (1) { dent = next_dent(itr); - if (!dent) + if (!dent) { + itr->dent_start = NULL; return 0; - + } + itr->dent_rem = itr->remaining; + itr->dent_start = itr->dent; + itr->dent_clust = itr->clust; if (dent->name[0] == DELETED_FLAG) continue; |