Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
天中雨水
rt-thread
提交
95006bb5
R
rt-thread
项目概览
天中雨水
/
rt-thread
该项目与 Fork 源项目分叉
Fork自
RT-Thread / rt-thread
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
95006bb5
编写于
12月 21, 2013
作者:
P
prife
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #215 from prife/master
fix dfs_unmount bug
上级
46f9280a
26a31d66
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
15 deletion
+21
-15
components/dfs/filesystems/elmfat/ff.c
components/dfs/filesystems/elmfat/ff.c
+6
-9
components/dfs/filesystems/elmfat/ff.h
components/dfs/filesystems/elmfat/ff.h
+0
-2
components/dfs/src/dfs_fs.c
components/dfs/src/dfs_fs.c
+15
-4
未找到文件。
components/dfs/filesystems/elmfat/ff.c
浏览文件 @
95006bb5
...
...
@@ -108,12 +108,8 @@
#if _MAX_SS != 512 && _MAX_SS != 1024 && _MAX_SS != 2048 && _MAX_SS != 4096
#error Wrong sector size.
#endif
#if _MAX_SS != 512
#define SS(fs) ((fs)->ssize)
/* Multiple sector size */
#else
#define SS(fs) 512U
/* Fixed sector size */
#endif
#define SS(fs) ((fs)->ssize)
/* sector size */
/* Reentrancy related */
#if _FS_REENTRANT
...
...
@@ -2058,10 +2054,11 @@ FRESULT chk_mounted ( /* FR_OK(0): successful, !=0: any error occurred */
stat
=
disk_initialize
(
fs
->
drv
);
/* Initialize low level disk I/O layer */
if
(
stat
&
STA_NOINIT
)
/* Check if the initialization succeeded */
return
FR_NOT_READY
;
/* Failed to initialize due to no media or hard error */
#if _MAX_SS != 512
/* Get disk sector size (variable sector size cfg only) */
/* Get disk sector size (variable sector size cfg only) */
if
(
disk_ioctl
(
fs
->
drv
,
GET_SECTOR_SIZE
,
&
fs
->
ssize
)
!=
RES_OK
)
return
FR_DISK_ERR
;
#endif
#if !_FS_READONLY
if
(
chk_wp
&&
(
stat
&
STA_PROTECT
))
/* Check disk write protection if needed */
return
FR_WRITE_PROTECTED
;
...
...
@@ -3601,10 +3598,10 @@ FRESULT f_mkfs (
stat
=
disk_initialize
(
drv
);
if
(
stat
&
STA_NOINIT
)
return
FR_NOT_READY
;
if
(
stat
&
STA_PROTECT
)
return
FR_WRITE_PROTECTED
;
#if _MAX_SS != 512
/* Get disk sector size */
/* Get disk sector size */
if
(
disk_ioctl
(
drv
,
GET_SECTOR_SIZE
,
&
SS
(
fs
))
!=
RES_OK
)
return
FR_DISK_ERR
;
#endif
if
(
disk_ioctl
(
drv
,
GET_SECTOR_COUNT
,
&
n_vol
)
!=
RES_OK
||
n_vol
<
128
)
return
FR_DISK_ERR
;
b_vol
=
(
sfd
)
?
0
:
63
;
/* Volume start sector */
...
...
components/dfs/filesystems/elmfat/ff.h
浏览文件 @
95006bb5
...
...
@@ -84,9 +84,7 @@ typedef struct {
BYTE
fsi_flag
;
/* fsinfo dirty flag (1:must be written back) */
WORD
id
;
/* File system mount ID */
WORD
n_rootdir
;
/* Number of root directory entries (FAT12/16) */
#if _MAX_SS != 512
WORD
ssize
;
/* Bytes per sector (512,1024,2048,4096) */
#endif
#if _FS_REENTRANT
_SYNC_t
sobj
;
/* Identifier of sync object */
#endif
...
...
components/dfs/src/dfs_fs.c
浏览文件 @
95006bb5
...
...
@@ -80,7 +80,7 @@ int dfs_register(const struct dfs_filesystem_operation *ops)
struct
dfs_filesystem
*
dfs_filesystem_lookup
(
const
char
*
path
)
{
struct
dfs_filesystem
*
iter
;
struct
dfs_filesystem
*
empty
=
RT_NULL
;
struct
dfs_filesystem
*
fs
=
RT_NULL
;
rt_uint32_t
fspath
,
prefixlen
;
prefixlen
=
0
;
...
...
@@ -104,13 +104,13 @@ struct dfs_filesystem *dfs_filesystem_lookup(const char *path)
if
(
fspath
>
1
&&
(
strlen
(
path
)
>
fspath
)
&&
(
path
[
fspath
]
!=
'/'
))
continue
;
empty
=
iter
;
fs
=
iter
;
prefixlen
=
fspath
;
}
dfs_unlock
();
return
empty
;
return
fs
;
}
/**
...
...
@@ -329,6 +329,7 @@ err1:
int
dfs_unmount
(
const
char
*
specialfile
)
{
char
*
fullpath
;
struct
dfs_filesystem
*
iter
;
struct
dfs_filesystem
*
fs
=
RT_NULL
;
fullpath
=
dfs_normalize_path
(
RT_NULL
,
specialfile
);
...
...
@@ -342,7 +343,17 @@ int dfs_unmount(const char *specialfile)
/* lock filesystem */
dfs_lock
();
fs
=
dfs_filesystem_lookup
(
fullpath
);
for
(
iter
=
&
filesystem_table
[
0
];
iter
<
&
filesystem_table
[
DFS_FILESYSTEMS_MAX
];
iter
++
)
{
/* check if the PATH is mounted */
if
((
iter
->
path
!=
NULL
)
&&
(
strcmp
(
iter
->
path
,
fullpath
)
==
0
))
{
fs
=
iter
;
break
;
}
}
if
(
fs
==
RT_NULL
||
fs
->
ops
->
unmount
==
RT_NULL
||
fs
->
ops
->
unmount
(
fs
)
<
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录