diff options
| author | Bernard Xiong <[email protected]> | 2017-10-06 10:59:14 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-10-06 10:59:14 +0800 |
| commit | 29d14993792d4bb76135fd2ecce63b21cf1ebcac (patch) | |
| tree | d25b7b2897ffb2c2c86ac3194f02a9fee4f25576 | |
| parent | a15d90a6865fa05e2420205556df7cece5f5c134 (diff) | |
| parent | d428166f083cb6dc1ce3033b4f99e3ace9731870 (diff) | |
Merge pull request #863 from yygg/master
[dfs] fix the mkfs issue of new ported elm fatfs.
| -rw-r--r-- | components/dfs/filesystems/elmfat/dfs_elm.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/components/dfs/filesystems/elmfat/dfs_elm.c b/components/dfs/filesystems/elmfat/dfs_elm.c index f6b6ed48d9..1338e3252e 100644 --- a/components/dfs/filesystems/elmfat/dfs_elm.c +++ b/components/dfs/filesystems/elmfat/dfs_elm.c @@ -212,6 +212,7 @@ int dfs_elm_mkfs(rt_device_t dev_id) int flag; FRESULT result; int index; + char logic_nbr[2] = {'0',':'}; work = rt_malloc(_MAX_SS); 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, * 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] Format options */ /* [IN] Size of the allocation unit */ /* [-] 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); /* check flag status, we need clear the temp driver stored in disk[] */ if (flag == FSM_STATUS_USE_TEMP_DRIVER) { rt_free(fat); - f_mount(RT_NULL, "",(BYTE)index); + f_mount(RT_NULL, logic_nbr,(BYTE)index); disk[index] = RT_NULL; /* close device */ rt_device_close(dev_id); |
