mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-11-09 08:37:58 +08:00
dosfs: Fix format request with sectors per cluster
This commit is contained in:
1 parent
f164ae751a
commit
53f2ca3be6
1 file changed
+10
-2
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user