Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party NuttX
提交
5fb79f1e
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,发现更多精彩内容 >>
提交
5fb79f1e
编写于
4月 23, 2021
作者:
M
mucor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
while nfs_create failed return error code and set null for vnode
Change-Id: Ib99e937093336cfb16c44d0f811613d90f1b2f13
上级
45391fc3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
60 addition
and
58 deletion
+60
-58
fs/nfs/nfs_adapter.c
fs/nfs/nfs_adapter.c
+60
-58
未找到文件。
fs/nfs/nfs_adapter.c
浏览文件 @
5fb79f1e
...
...
@@ -2075,83 +2075,85 @@ int vfs_nfs_create(struct Vnode *parent, const char *filename, int mode, struct
/* Check for success */
if
(
error
=
=
OK
)
if
(
error
!
=
OK
)
{
/* Parse the returned data */
ptr
=
(
uint32_t
*
)
&
((
struct
rpc_reply_create
*
)
nmp
->
nm_iobuffer
)
->
create
;
*
vpp
=
NULL
;
goto
errout_with_mutex
;
}
/* Parse the returned data */
/* Save the file handle in the file data structure */
ptr
=
(
uint32_t
*
)
&
((
struct
rpc_reply_create
*
)
nmp
->
nm_iobuffer
)
->
create
;
tmp
=
*
ptr
++
;
/* handle_follows */
if
(
!
tmp
)
{
PRINTK
(
"ERROR: no file handle follows
\n
"
);
error
=
EINVAL
;
goto
errout_with_mutex
;
}
/* Save the file handle in the file data structure */
tmp
=
*
ptr
++
;
tmp
=
fxdr_unsigned
(
uint32_t
,
tmp
);
DEBUGASSERT
(
tmp
<=
NFSX_V3FHMAX
);
tmp
=
*
ptr
++
;
/* handle_follows */
if
(
!
tmp
)
{
PRINTK
(
"ERROR: no file handle follows
\n
"
);
error
=
EINVAL
;
goto
errout_with_mutex
;
}
np
->
n_fhsize
=
(
uint8_t
)
tmp
;
(
void
)
memcpy_s
(
&
np
->
n_fhandle
,
tmp
,
ptr
,
tmp
);
ptr
+=
uint32_increment
(
tmp
);
tmp
=
*
ptr
++
;
tmp
=
fxdr_unsigned
(
uint32_t
,
tmp
);
DEBUGASSERT
(
tmp
<=
NFSX_V3FHMAX
);
/* Save the attributes in the file data structure */
np
->
n_fhsize
=
(
uint8_t
)
tmp
;
(
void
)
memcpy_s
(
&
np
->
n_fhandle
,
tmp
,
ptr
,
tmp
);
ptr
+=
uint32_increment
(
tmp
);
tmp
=
*
ptr
;
/* handle_follows */
if
(
!
tmp
)
{
PRINTK
(
"WARNING: no file attributes
\n
"
);
}
else
{
/* Initialize the file attributes */
/* Save the attributes in the file data structure */
nfs_attrupdate
(
np
,
(
struct
nfs_fattr
*
)
ptr
);
}
tmp
=
*
ptr
;
/* handle_follows */
if
(
!
tmp
)
{
PRINTK
(
"WARNING: no file attributes
\n
"
);
}
else
{
/* Initialize the file attributes */
/* Any following dir_wcc data is ignored for now */
np
->
n_crefs
=
1
;
nfs_attrupdate
(
np
,
(
struct
nfs_fattr
*
)
ptr
);
}
/* Attach the private data to the struct file instance */
/* Any following dir_wcc data is ignored for now */
np
->
n_crefs
=
1
;
/* Then insert the new instance at the head of the list in the mountpoint
* tructure. It needs to be there (1) to handle error conditions that effect
* all files, and (2) to inform the umount logic that we are busy. We
* cannot unmount the file system if this list is not empty!
*/
/* Attach the private data to the struct file instance */
np
->
n_next
=
nmp
->
nm_head
;
nmp
->
nm_head
=
np
;
/* Then insert the new instance at the head of the list in the mountpoint
* tructure. It needs to be there (1) to handle error conditions that effect
* all files, and (2) to inform the umount logic that we are busy. We
* cannot unmount the file system if this list is not empty!
*/
np
->
n_flags
|=
(
NFSNODE_OPEN
|
NFSNODE_MODIFIED
);
np
->
n_name
=
zalloc
(
namelen
+
1
);
memcpy_s
(
np
->
n_name
,
(
namelen
+
1
),
filename
,
(
namelen
+
1
));
np
->
n_next
=
nmp
->
nm_head
;
nmp
->
nm_head
=
np
;
(
void
)
VnodeAlloc
(
&
nfs_vops
,
vpp
);
(
*
vpp
)
->
parent
=
parent
;
(
*
vpp
)
->
fop
=
&
nfs_fops
;
(
*
vpp
)
->
originMount
=
parent
->
originMount
;
(
*
vpp
)
->
data
=
np
;
(
*
vpp
)
->
type
=
filetype_to_vnodetype
(
np
->
n_type
);
(
*
vpp
)
->
mode
=
type_to_mode
((
*
vpp
)
->
type
,
nmp
->
nm_permission
);
(
*
vpp
)
->
gid
=
nmp
->
nm_gid
;
(
*
vpp
)
->
uid
=
nmp
->
nm_uid
;
np
->
n_flags
|=
(
NFSNODE_OPEN
|
NFSNODE_MODIFIED
);
np
->
n_name
=
zalloc
(
namelen
+
1
);
memcpy_s
(
np
->
n_name
,
(
namelen
+
1
),
filename
,
(
namelen
+
1
));
}
(
void
)
VnodeAlloc
(
&
nfs_vops
,
vpp
);
(
*
vpp
)
->
parent
=
parent
;
(
*
vpp
)
->
fop
=
&
nfs_fops
;
(
*
vpp
)
->
originMount
=
parent
->
originMount
;
(
*
vpp
)
->
data
=
np
;
(
*
vpp
)
->
type
=
filetype_to_vnodetype
(
np
->
n_type
);
(
*
vpp
)
->
mode
=
type_to_mode
((
*
vpp
)
->
type
,
nmp
->
nm_permission
);
(
*
vpp
)
->
gid
=
nmp
->
nm_gid
;
(
*
vpp
)
->
uid
=
nmp
->
nm_uid
;
nfs_mux_release
(
nmp
);
return
OK
;
errout_with_mutex:
if
(
np
)
{
free
(
np
);
}
errout_with_mutex:
if
(
np
)
{
free
(
np
);
}
nfs_mux_release
(
nmp
);
return
-
error
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录