parent
69e8c0324e
commit
aafed7b434
|
@ -90,6 +90,7 @@ int dfs_unmount(const char *specialfile);
|
|||
|
||||
int dfs_mkfs(const char *fs_name, const char *device_name);
|
||||
int dfs_statfs(const char *path, struct statfs *buffer);
|
||||
int dfs_mount_device(rt_device_t dev);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -508,7 +508,7 @@ int dfs_mount_table(void)
|
|||
mount_table[index].rwflag,
|
||||
mount_table[index].data) != 0)
|
||||
{
|
||||
rt_kprintf("mount fs[%s] on %s failed.\n", mount_table[index].filesystemtype,
|
||||
LOG_E("mount fs[%s] on %s failed.\n", mount_table[index].filesystemtype,
|
||||
mount_table[index].path);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
@ -518,6 +518,43 @@ int dfs_mount_table(void)
|
|||
return 0;
|
||||
}
|
||||
INIT_ENV_EXPORT(dfs_mount_table);
|
||||
|
||||
int dfs_mount_device(rt_device_t dev)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
if(dev == RT_NULL) {
|
||||
rt_kprintf("the device is NULL to be mounted.\n");
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (mount_table[index].path == NULL) break;
|
||||
|
||||
if(strcmp(mount_table[index].device_name, dev->parent.name) == 0) {
|
||||
if (dfs_mount(mount_table[index].device_name,
|
||||
mount_table[index].path,
|
||||
mount_table[index].filesystemtype,
|
||||
mount_table[index].rwflag,
|
||||
mount_table[index].data) != 0)
|
||||
{
|
||||
LOG_E("mount fs[%s] device[%s] to %s failed.\n", mount_table[index].filesystemtype, dev->parent.name,
|
||||
mount_table[index].path);
|
||||
return -RT_ERROR;
|
||||
} else {
|
||||
LOG_D("mount fs[%s] device[%s] to %s ok.\n", mount_table[index].filesystemtype, dev->parent.name,
|
||||
mount_table[index].path);
|
||||
return RT_EOK;
|
||||
}
|
||||
}
|
||||
|
||||
index ++;
|
||||
}
|
||||
|
||||
rt_kprintf("can't find device:%s to be mounted.\n", dev->parent.name);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <dfs_posix.h>
|
||||
#include <dfs_poll.h>
|
||||
|
||||
#ifdef RT_USING_POSIX
|
||||
|
||||
struct rt_poll_node;
|
||||
|
||||
struct rt_poll_table
|
||||
|
@ -214,3 +216,4 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
|
|||
return num;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include <dfs_poll.h>
|
||||
#include <dfs_select.h>
|
||||
|
||||
#ifdef RT_USING_POSIX
|
||||
|
||||
static void fdszero(fd_set *set, int nfds)
|
||||
{
|
||||
fd_mask *m;
|
||||
|
@ -178,3 +180,4 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struc
|
|||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -472,7 +472,7 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
|
|||
}
|
||||
|
||||
#ifdef RT_USING_DFS_MNTTABLE
|
||||
if (0) // if (blk_dev)
|
||||
if (blk_dev)
|
||||
{
|
||||
LOG_I("try to mount file system!");
|
||||
/* try to mount file system on this block device */
|
||||
|
@ -508,8 +508,9 @@ void rt_mmcsd_blk_remove(struct rt_mmcsd_card *card)
|
|||
if (mounted_path)
|
||||
{
|
||||
dfs_unmount(mounted_path);
|
||||
LOG_D("unmount file system %s for device %s.\r\n", mounted_path, blk_dev->dev.parent.name);
|
||||
}
|
||||
|
||||
rt_sem_delete(blk_dev->part.lock);
|
||||
rt_device_unregister(&blk_dev->dev);
|
||||
rt_list_remove(&blk_dev->list);
|
||||
rt_free(blk_dev);
|
||||
|
|
Loading…
Reference in New Issue