summaryrefslogtreecommitdiff
path: root/components/dfs
diff options
context:
space:
mode:
authorbernard <[email protected]>2013-07-29 14:43:52 +0800
committerbernard <[email protected]>2013-07-29 14:43:52 +0800
commitac850ef3f0bd46e421d8544152f41515fe36f0b6 (patch)
tree23f89d09ff6563e459d9f31bce9a1c0a4615640d /components/dfs
parent914244f368af021c0bd26be0deaac742fdf3569e (diff)
add device_open/close in mkfs
Diffstat (limited to 'components/dfs')
-rw-r--r--components/dfs/filesystems/elmfat/dfs_elm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/components/dfs/filesystems/elmfat/dfs_elm.c b/components/dfs/filesystems/elmfat/dfs_elm.c
index 4137504985..0d7f9b781c 100644
--- a/components/dfs/filesystems/elmfat/dfs_elm.c
+++ b/components/dfs/filesystems/elmfat/dfs_elm.c
@@ -224,6 +224,8 @@ int dfs_elm_mkfs(rt_device_t dev_id)
flag = FSM_STATUS_USE_TEMP_DRIVER;
disk[index] = dev_id;
+ /* try to open device */
+ rt_device_open(dev_id, RT_DEVICE_OFLAG_RDWR);
/* just fill the FatFs[vol] in ff.c, or mkfs will failded!
* consider this condition: you just umount the elm fat,
@@ -245,6 +247,8 @@ int dfs_elm_mkfs(rt_device_t dev_id)
rt_free(fat);
f_mount((BYTE)index, RT_NULL);
disk[index] = RT_NULL;
+ /* close device */
+ rt_device_close(dev_id);
}
if (result != FR_OK)