Merge pull request #863 from yygg/master
[dfs] fix the mkfs issue of new ported elm fatfs.
This commit is contained in:
commit
29d1499379
|
@ -212,6 +212,7 @@ int dfs_elm_mkfs(rt_device_t dev_id)
|
||||||
int flag;
|
int flag;
|
||||||
FRESULT result;
|
FRESULT result;
|
||||||
int index;
|
int index;
|
||||||
|
char logic_nbr[2] = {'0',':'};
|
||||||
|
|
||||||
work = rt_malloc(_MAX_SS);
|
work = rt_malloc(_MAX_SS);
|
||||||
if(RT_NULL == work) {
|
if(RT_NULL == work) {
|
||||||
|
@ -255,23 +256,26 @@ int dfs_elm_mkfs(rt_device_t dev_id)
|
||||||
* on the disk, you will get a failure. so we need f_mount here,
|
* on the disk, you will get a failure. so we need f_mount here,
|
||||||
* just fill the FatFS[index] in elm fatfs to make mkfs work.
|
* just fill the FatFS[index] in elm fatfs to make mkfs work.
|
||||||
*/
|
*/
|
||||||
f_mount(fat, "", (BYTE)index);
|
logic_nbr[0] = '0' + index;
|
||||||
|
f_mount(fat, logic_nbr, (BYTE)index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
logic_nbr[0] = '0' + index;
|
||||||
|
|
||||||
/* [IN] Logical drive number */
|
/* [IN] Logical drive number */
|
||||||
/* [IN] Format options */
|
/* [IN] Format options */
|
||||||
/* [IN] Size of the allocation unit */
|
/* [IN] Size of the allocation unit */
|
||||||
/* [-] Working buffer */
|
/* [-] Working buffer */
|
||||||
/* [IN] Size of working buffer */
|
/* [IN] Size of working buffer */
|
||||||
result = f_mkfs("", FM_ANY, 0, work, _MAX_SS);
|
result = f_mkfs(logic_nbr, FM_ANY, 0, work, _MAX_SS);
|
||||||
rt_free(work);
|
rt_free(work);
|
||||||
|
|
||||||
/* check flag status, we need clear the temp driver stored in disk[] */
|
/* check flag status, we need clear the temp driver stored in disk[] */
|
||||||
if (flag == FSM_STATUS_USE_TEMP_DRIVER)
|
if (flag == FSM_STATUS_USE_TEMP_DRIVER)
|
||||||
{
|
{
|
||||||
rt_free(fat);
|
rt_free(fat);
|
||||||
f_mount(RT_NULL, "",(BYTE)index);
|
f_mount(RT_NULL, logic_nbr,(BYTE)index);
|
||||||
disk[index] = RT_NULL;
|
disk[index] = RT_NULL;
|
||||||
/* close device */
|
/* close device */
|
||||||
rt_device_close(dev_id);
|
rt_device_close(dev_id);
|
||||||
|
|
Loading…
Reference in New Issue