]> git.baikalelectronics.ru Git - uboot.git/commitdiff
fs: fat: first dentry of long name in FAT iterator
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Thu, 19 Nov 2020 06:44:08 +0000 (07:44 +0100)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Thu, 10 Dec 2020 08:15:00 +0000 (09:15 +0100)
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>
fs/fat/fat.c

index 5a418cfbb7a82dcb03621d58fd0cf2f8b7f61567..47344bb57e00b12ce0ec0cd6ee0674391499fbe4 100644 (file)
@@ -700,6 +700,18 @@ struct fat_itr {
         * @dent:               current directory entry
         */
        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
         */
@@ -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;