Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party NuttX
提交
8812f7fe
T
Third Party NuttX
项目概览
OpenHarmony
/
Third Party NuttX
大约 1 年 前同步成功
通知
5
Star
19
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party NuttX
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8812f7fe
编写于
4月 29, 2021
作者:
O
openharmony_ci
提交者:
Gitee
4月 29, 2021
浏览文件
操作
浏览文件
下载
差异文件
!34 修复文件系统errout等异常分支的资源回收问题+do_create函数整改
Merge pull request !34 from li_zan/master
上级
8445d70f
58906adc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
23 deletion
+24
-23
fs/mount/fs_mount.c
fs/mount/fs_mount.c
+2
-2
fs/vfs/fs_open.c
fs/vfs/fs_open.c
+22
-21
未找到文件。
fs/mount/fs_mount.c
浏览文件 @
8812f7fe
...
...
@@ -238,7 +238,7 @@ int mount(const char *source, const char *target,
PRINTK
(
"ERROR: Filesystem does not support bind
\n
"
);
errcode
=
-
ENOSYS
;
goto
errout_with_
mountpt
;
goto
errout_with_
lock
;
}
/* Increment reference count for the reference we pass to the file system */
...
...
@@ -250,7 +250,7 @@ int mount(const char *source, const char *target,
if
(
partition
->
mountpoint_name
==
NULL
)
{
errcode
=
-
ENOMEM
;
goto
errout_with_
mountpt
;
goto
errout_with_
lock
;
}
(
void
)
strncpy_s
(
partition
->
mountpoint_name
,
strlen
(
target
)
+
1
,
target
,
strlen
(
target
));
partition
->
mountpoint_name
[
strlen
(
target
)]
=
'\0'
;
...
...
fs/vfs/fs_open.c
浏览文件 @
8812f7fe
...
...
@@ -128,11 +128,11 @@ int get_path_from_fd(int fd, char **path)
return
OK
;
}
static
int
do_creat
(
struct
Vnode
*
*
node
,
char
*
fullpath
,
mode_t
m
ode
)
static
int
do_creat
(
struct
Vnode
*
parentNode
,
char
*
fullpath
,
mode_t
mode
,
struct
Vnode
**
n
ode
)
{
int
ret
;
struct
Vnode
*
parentNode
=
*
node
;
char
*
name
=
strrchr
(
fullpath
,
'/'
)
+
1
;
parentNode
->
useCount
++
;
if
(
parentNode
->
vop
!=
NULL
&&
parentNode
->
vop
->
Create
!=
NULL
)
{
...
...
@@ -165,6 +165,7 @@ int fp_open(char *fullpath, int oflags, mode_t mode)
int
accmode
;
struct
file
*
filep
=
NULL
;
struct
Vnode
*
vnode
=
NULL
;
struct
Vnode
*
parentVnode
=
NULL
;
VnodeHold
();
ret
=
VnodeLookup
(
fullpath
,
&
vnode
,
0
);
...
...
@@ -174,7 +175,8 @@ int fp_open(char *fullpath, int oflags, mode_t mode)
if
(
vnode
->
type
==
VNODE_TYPE_BCHR
)
{
ret
=
-
EINVAL
;
goto
errout_without_count
;
VnodeDrop
();
goto
errout
;
}
#ifdef LOSCFG_FS_VFS_BLOCK_DEVICE
if
(
vnode
->
type
==
VNODE_TYPE_BLK
)
{
...
...
@@ -183,7 +185,7 @@ int fp_open(char *fullpath, int oflags, mode_t mode)
if
(
fd
<
0
)
{
ret
=
fd
;
goto
errout
_without_count
;
goto
errout
;
}
return
fd
;
}
...
...
@@ -192,39 +194,38 @@ int fp_open(char *fullpath, int oflags, mode_t mode)
{
ret
=
-
EEXIST
;
VnodeDrop
();
goto
errout
_without_count
;
goto
errout
;
}
if
(
vnode
->
type
==
VNODE_TYPE_DIR
)
{
ret
=
-
EISDIR
;
VnodeDrop
();
goto
errout
_without_count
;
goto
errout
;
}
accmode
=
oflag_convert_mode
(
oflags
);
if
(
VfsVnodePermissionCheck
(
vnode
,
accmode
))
{
ret
=
-
EACCES
;
VnodeDrop
();
goto
errout
_without_count
;
goto
errout
;
}
}
if
((
ret
!=
OK
)
&&
(
oflags
&
O_CREAT
)
&&
vnode
)
{
vnode
->
useCount
++
;
/* if file not exist, but parent dir of the file is exist */
if
(
VfsVnodePermissionCheck
(
vnode
,
(
WRITE_OP
|
EXEC_OP
)))
{
ret
=
-
EACCES
;
vnode
->
useCount
--
;
VnodeDrop
();
goto
errout
_without_count
;
goto
errout
;
}
ret
=
do_creat
(
&
vnode
,
fullpath
,
mode
);
parentVnode
=
vnode
;
ret
=
do_creat
(
parentVnode
,
fullpath
,
mode
,
&
vnode
);
if
(
ret
!=
OK
)
{
VnodeDrop
();
goto
errout
_without_count
;
goto
errout
;
}
}
...
...
@@ -232,7 +233,7 @@ int fp_open(char *fullpath, int oflags, mode_t mode)
{
/* found nothing */
VnodeDrop
();
goto
errout
_without_count
;
goto
errout
;
}
vnode
->
useCount
++
;
VnodeDrop
();
...
...
@@ -242,7 +243,7 @@ int fp_open(char *fullpath, int oflags, mode_t mode)
if
(
vnode
->
useCount
>
1
)
{
ret
=
-
EBUSY
;
goto
errout
;
goto
errout
_with_count
;
}
if
(
vnode
->
vop
->
Truncate
)
...
...
@@ -250,13 +251,13 @@ int fp_open(char *fullpath, int oflags, mode_t mode)
ret
=
vnode
->
vop
->
Truncate
(
vnode
,
0
);
if
(
ret
!=
OK
)
{
goto
errout
;
goto
errout
_with_count
;
}
}
else
{
ret
=
-
ENOSYS
;
goto
errout
;
goto
errout
_with_count
;
}
}
...
...
@@ -264,7 +265,7 @@ int fp_open(char *fullpath, int oflags, mode_t mode)
if
(
fd
<
0
)
{
ret
=
-
EMFILE
;
goto
errout
;
goto
errout
_with_count
;
}
/* Get the file structure corresponding to the file descriptor. */
...
...
@@ -273,7 +274,7 @@ int fp_open(char *fullpath, int oflags, mode_t mode)
{
files_release
(
fd
);
ret
=
-
get_errno
();
goto
errout
;
goto
errout
_with_count
;
}
filep
->
f_vnode
=
vnode
;
...
...
@@ -288,7 +289,7 @@ int fp_open(char *fullpath, int oflags, mode_t mode)
if
(
ret
<
0
)
{
files_release
(
fd
);
goto
errout
;
goto
errout
_with_count
;
}
/* we do not bother to handle the NULL scenario, if so, page-cache feature will not be used
...
...
@@ -299,11 +300,11 @@ int fp_open(char *fullpath, int oflags, mode_t mode)
return
fd
;
errout:
errout
_with_count
:
VnodeHold
();
vnode
->
useCount
--
;
VnodeDrop
();
errout
_without_count
:
errout:
set_errno
(
-
ret
);
return
VFS_ERROR
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录