]> git.sur5r.net Git - u-boot/blobdiff - fs/fat/fat_write.c
fs/fat/fatwrite: Local variable as buffer to store dir_slot entries
[u-boot] / fs / fat / fat_write.c
index babe9c8dd025eff59f9ee226d278ec000662c883..40a3860e47c9f58d63dc6b813b53fd772bd11c96 100644 (file)
@@ -327,7 +327,8 @@ static void flush_dir_table(fsdata *mydata, dir_entry **dentptr);
 static void
 fill_dir_slot(fsdata *mydata, dir_entry **dentptr, const char *l_name)
 {
-       dir_slot *slotptr = (dir_slot *)get_contents_vfatname_block;
+       __u8 temp_dir_slot_buffer[MAX_LFN_SLOT * sizeof(dir_slot)];
+       dir_slot *slotptr = (dir_slot *)temp_dir_slot_buffer;
        __u8 counter = 0, checksum;
        int idx = 0, ret;
 
@@ -528,7 +529,8 @@ static int set_fatent_value(fsdata *mydata, __u32 entry, __u32 entry_value)
 }
 
 /*
- * Determine the entry value at index 'entry' in a FAT (16/32) table
+ * Determine the next free cluster after 'entry' in a FAT (16/32) table
+ * and link it to 'entry'. EOC marker is not set on returned entry.
  */
 static __u32 determine_fatent(fsdata *mydata, __u32 entry)
 {
@@ -537,6 +539,7 @@ static __u32 determine_fatent(fsdata *mydata, __u32 entry)
        while (1) {
                next_fat = get_fatent_value(mydata, next_entry);
                if (next_fat == 0) {
+                       /* found free entry, link to entry */
                        set_fatent_value(mydata, entry, next_entry);
                        break;
                }