MLK-20668-2 fat: Fix issue in rootdir table flush for FAT16/12
The FAT16/12 has rootdir area before data area, and the clusters for rootdir are not mantained by FAT table. So we don't need to find empty cluster for next rootdir space, just use next dir cluster. And the FAT table don't need to update for this new dir cluster. Signed-off-by: Ye Li <ye.li@nxp.com> Acked-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
parent
615283d0eb
commit
9e0a33cacc
|
|
@ -591,14 +591,18 @@ static void flush_dir_table(fsdata *mydata, dir_entry **dentptr)
|
|||
printf("error: wrinting directory entry\n");
|
||||
return;
|
||||
}
|
||||
dir_newclust = find_empty_cluster(mydata);
|
||||
set_fatent_value(mydata, dir_curclust, dir_newclust);
|
||||
if (mydata->fatsize == 32)
|
||||
|
||||
if (mydata->fatsize == 32) {
|
||||
dir_newclust = find_empty_cluster(mydata);
|
||||
set_fatent_value(mydata, dir_curclust, dir_newclust);
|
||||
set_fatent_value(mydata, dir_newclust, 0xffffff8);
|
||||
else if (mydata->fatsize == 16)
|
||||
set_fatent_value(mydata, dir_newclust, 0xfff8);
|
||||
else if (mydata->fatsize == 12)
|
||||
set_fatent_value(mydata, dir_newclust, 0xff8);
|
||||
} else {
|
||||
dir_newclust = dir_curclust + 1;
|
||||
if (dir_newclust > 1) {
|
||||
printf("error: fail to get empty clust for directory entry\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
dir_curclust = dir_newclust;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue