Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Mozi
rt-thread
提交
aafed7b4
R
rt-thread
项目概览
Mozi
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aafed7b4
编写于
11月 16, 2019
作者:
H
hichard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.修复sd卡热插拔内存泄露的bug
2.dfs增加函数,配合实现sd卡热插拔自动挂载卸载文件系统
上级
69e8c032
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
49 addition
and
4 deletion
+49
-4
components/dfs/include/dfs_fs.h
components/dfs/include/dfs_fs.h
+1
-0
components/dfs/src/dfs_fs.c
components/dfs/src/dfs_fs.c
+38
-1
components/dfs/src/poll.c
components/dfs/src/poll.c
+3
-0
components/dfs/src/select.c
components/dfs/src/select.c
+3
-0
components/drivers/sdio/block_dev.c
components/drivers/sdio/block_dev.c
+4
-3
未找到文件。
components/dfs/include/dfs_fs.h
浏览文件 @
aafed7b4
...
...
@@ -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
}
...
...
components/dfs/src/dfs_fs.c
浏览文件 @
aafed7b4
...
...
@@ -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
...
...
components/dfs/src/poll.c
浏览文件 @
aafed7b4
...
...
@@ -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
components/dfs/src/select.c
浏览文件 @
aafed7b4
...
...
@@ -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
components/drivers/sdio/block_dev.c
浏览文件 @
aafed7b4
...
...
@@ -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 */
...
...
@@ -507,9 +507,10 @@ void rt_mmcsd_blk_remove(struct rt_mmcsd_card *card)
const
char
*
mounted_path
=
dfs_filesystem_get_mounted_path
(
&
(
blk_dev
->
dev
));
if
(
mounted_path
)
{
dfs_unmount
(
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
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录