dosfs: Fix format request with sectors per cluster

This commit is contained in:
Sebastian Huber committed 2012-05-31 13:50:08 +02:00
1 parent f164ae751a
commit 53f2ca3be6
1 file changed
+10 -2
+10 -2
View File
@@ -484,14 +484,22 @@ static int msdos_format_determine_fmt_params
* NOTE: maximum sect_per_clust is arbitrarily choosen with values that
* are a compromise concerning capacity and efficency
*/
uint32_t fat12_sect_per_clust = 8;
uint32_t fat16_sect_per_clust = 32;
if (rqdata != NULL && rqdata->sectors_per_cluster != 0) {
fat12_sect_per_clust = rqdata->sectors_per_cluster;
fat16_sect_per_clust = rqdata->sectors_per_cluster;
}
if (fmt_params->totl_sector_cnt
< ((uint32_t)FAT_FAT12_MAX_CLN)*8) {
< FAT_FAT12_MAX_CLN * fat12_sect_per_clust) {
fmt_params->fattype = FAT_FAT12;
/* start trying with small clusters */
fmt_params->sectors_per_cluster = 2;
}
else if (fmt_params->totl_sector_cnt
< ((uint32_t)FAT_FAT16_MAX_CLN)*32) {
< FAT_FAT16_MAX_CLN * fat16_sect_per_clust) {
fmt_params->fattype = FAT_FAT16;
/* start trying with small clusters */
fmt_params->sectors_per_cluster = 2;