Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
65c05f9a
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
65c05f9a
编写于
5月 18, 2011
作者:
A
Aneesh Kumar K.V
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hw/9pfs: Update v9fs_setattr to use coroutines
Signed-off-by:
N
Aneesh Kumar K.V
<
aneesh.kumar@linux.vnet.ibm.com
>
上级
4011ead2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
117 deletion
+54
-117
hw/9pfs/virtio-9p.c
hw/9pfs/virtio-9p.c
+54
-109
hw/9pfs/virtio-9p.h
hw/9pfs/virtio-9p.h
+0
-8
未找到文件。
hw/9pfs/virtio-9p.c
浏览文件 @
65c05f9a
...
...
@@ -1329,139 +1329,84 @@ out:
#define ATTR_ATIME_SET (1 << 7)
#define ATTR_MTIME_SET (1 << 8)
static
void
v9fs_setattr_post_truncate
(
V9fsState
*
s
,
V9fsSetattrState
*
vs
,
int
err
)
{
if
(
err
==
-
1
)
{
err
=
-
errno
;
goto
out
;
}
err
=
vs
->
offset
;
out:
complete_pdu
(
s
,
vs
->
pdu
,
err
);
qemu_free
(
vs
);
}
static
void
v9fs_setattr_post_chown
(
V9fsState
*
s
,
V9fsSetattrState
*
vs
,
int
err
)
static
void
v9fs_setattr
(
void
*
opaque
)
{
if
(
err
==
-
1
)
{
err
=
-
errno
;
goto
out
;
}
int
err
=
0
;
int32_t
fid
;
V9fsFidState
*
fidp
;
size_t
offset
=
7
;
V9fsIattr
v9iattr
;
V9fsPDU
*
pdu
=
opaque
;
V9fsState
*
s
=
pdu
->
s
;
if
(
vs
->
v9iattr
.
valid
&
(
ATTR_SIZE
))
{
err
=
v9fs_do_truncate
(
s
,
&
vs
->
fidp
->
path
,
vs
->
v9iattr
.
size
);
}
v9fs_setattr_post_truncate
(
s
,
vs
,
err
);
return
;
pdu_unmarshal
(
pdu
,
offset
,
"dI"
,
&
fid
,
&
v9iattr
);
out:
complete_pdu
(
s
,
vs
->
pdu
,
err
);
qemu_free
(
vs
);
}
static
void
v9fs_setattr_post_utimensat
(
V9fsState
*
s
,
V9fsSetattrState
*
vs
,
int
err
)
{
if
(
err
==
-
1
)
{
err
=
-
errno
;
fidp
=
lookup_fid
(
s
,
fid
);
if
(
fidp
==
NULL
)
{
err
=
-
EINVAL
;
goto
out
;
}
/* If the only valid entry in iattr is ctime we can call
* chown(-1,-1) to update the ctime of the file
*/
if
((
vs
->
v9iattr
.
valid
&
(
ATTR_UID
|
ATTR_GID
))
||
((
vs
->
v9iattr
.
valid
&
ATTR_CTIME
)
&&
!
((
vs
->
v9iattr
.
valid
&
ATTR_MASK
)
&
~
ATTR_CTIME
)))
{
if
(
!
(
vs
->
v9iattr
.
valid
&
ATTR_UID
))
{
vs
->
v9iattr
.
uid
=
-
1
;
}
if
(
!
(
vs
->
v9iattr
.
valid
&
ATTR_GID
))
{
vs
->
v9iattr
.
gid
=
-
1
;
if
(
v9iattr
.
valid
&
ATTR_MODE
)
{
err
=
v9fs_co_chmod
(
s
,
&
fidp
->
path
,
v9iattr
.
mode
);
if
(
err
<
0
)
{
goto
out
;
}
err
=
v9fs_do_chown
(
s
,
&
vs
->
fidp
->
path
,
vs
->
v9iattr
.
uid
,
vs
->
v9iattr
.
gid
);
}
v9fs_setattr_post_chown
(
s
,
vs
,
err
);
return
;
out:
complete_pdu
(
s
,
vs
->
pdu
,
err
);
qemu_free
(
vs
);
}
static
void
v9fs_setattr_post_chmod
(
V9fsState
*
s
,
V9fsSetattrState
*
vs
,
int
err
)
{
if
(
err
==
-
1
)
{
err
=
-
errno
;
goto
out
;
}
if
(
vs
->
v9iattr
.
valid
&
(
ATTR_ATIME
|
ATTR_MTIME
))
{
if
(
v9iattr
.
valid
&
(
ATTR_ATIME
|
ATTR_MTIME
))
{
struct
timespec
times
[
2
];
if
(
v
s
->
v
9iattr
.
valid
&
ATTR_ATIME
)
{
if
(
v
s
->
v
9iattr
.
valid
&
ATTR_ATIME_SET
)
{
times
[
0
].
tv_sec
=
v
s
->
v
9iattr
.
atime_sec
;
times
[
0
].
tv_nsec
=
v
s
->
v
9iattr
.
atime_nsec
;
if
(
v9iattr
.
valid
&
ATTR_ATIME
)
{
if
(
v9iattr
.
valid
&
ATTR_ATIME_SET
)
{
times
[
0
].
tv_sec
=
v9iattr
.
atime_sec
;
times
[
0
].
tv_nsec
=
v9iattr
.
atime_nsec
;
}
else
{
times
[
0
].
tv_nsec
=
UTIME_NOW
;
}
}
else
{
times
[
0
].
tv_nsec
=
UTIME_OMIT
;
}
if
(
vs
->
v9iattr
.
valid
&
ATTR_MTIME
)
{
if
(
vs
->
v9iattr
.
valid
&
ATTR_MTIME_SET
)
{
times
[
1
].
tv_sec
=
vs
->
v9iattr
.
mtime_sec
;
times
[
1
].
tv_nsec
=
vs
->
v9iattr
.
mtime_nsec
;
if
(
v9iattr
.
valid
&
ATTR_MTIME
)
{
if
(
v9iattr
.
valid
&
ATTR_MTIME_SET
)
{
times
[
1
].
tv_sec
=
v9iattr
.
mtime_sec
;
times
[
1
].
tv_nsec
=
v9iattr
.
mtime_nsec
;
}
else
{
times
[
1
].
tv_nsec
=
UTIME_NOW
;
}
}
else
{
times
[
1
].
tv_nsec
=
UTIME_OMIT
;
}
err
=
v9fs_do_utimensat
(
s
,
&
vs
->
fidp
->
path
,
times
);
err
=
v9fs_co_utimensat
(
s
,
&
fidp
->
path
,
times
);
if
(
err
<
0
)
{
goto
out
;
}
}
v9fs_setattr_post_utimensat
(
s
,
vs
,
err
);
return
;
out:
complete_pdu
(
s
,
vs
->
pdu
,
err
);
qemu_free
(
vs
);
}
static
void
v9fs_setattr
(
void
*
opaque
)
{
V9fsPDU
*
pdu
=
opaque
;
V9fsState
*
s
=
pdu
->
s
;
int32_t
fid
;
V9fsSetattrState
*
vs
;
int
err
=
0
;
vs
=
qemu_malloc
(
sizeof
(
*
vs
));
vs
->
pdu
=
pdu
;
vs
->
offset
=
7
;
pdu_unmarshal
(
pdu
,
vs
->
offset
,
"dI"
,
&
fid
,
&
vs
->
v9iattr
);
vs
->
fidp
=
lookup_fid
(
s
,
fid
);
if
(
vs
->
fidp
==
NULL
)
{
err
=
-
EINVAL
;
goto
out
;
/*
* If the only valid entry in iattr is ctime we can call
* chown(-1,-1) to update the ctime of the file
*/
if
((
v9iattr
.
valid
&
(
ATTR_UID
|
ATTR_GID
))
||
((
v9iattr
.
valid
&
ATTR_CTIME
)
&&
!
((
v9iattr
.
valid
&
ATTR_MASK
)
&
~
ATTR_CTIME
)))
{
if
(
!
(
v9iattr
.
valid
&
ATTR_UID
))
{
v9iattr
.
uid
=
-
1
;
}
if
(
!
(
v9iattr
.
valid
&
ATTR_GID
))
{
v9iattr
.
gid
=
-
1
;
}
err
=
v9fs_co_chown
(
s
,
&
fidp
->
path
,
v9iattr
.
uid
,
v9iattr
.
gid
);
if
(
err
<
0
)
{
goto
out
;
}
}
if
(
vs
->
v9iattr
.
valid
&
ATTR_MODE
)
{
err
=
v9fs_do_chmod
(
s
,
&
vs
->
fidp
->
path
,
vs
->
v9iattr
.
mode
);
if
(
v9iattr
.
valid
&
(
ATTR_SIZE
))
{
err
=
v9fs_co_truncate
(
s
,
&
fidp
->
path
,
v9iattr
.
size
);
if
(
err
<
0
)
{
goto
out
;
}
}
v9fs_setattr_post_chmod
(
s
,
vs
,
err
);
return
;
err
=
offset
;
out:
complete_pdu
(
s
,
vs
->
pdu
,
err
);
qemu_free
(
vs
);
complete_pdu
(
s
,
pdu
,
err
);
}
static
void
v9fs_walk_complete
(
V9fsState
*
s
,
V9fsWalkState
*
vs
,
int
err
)
...
...
hw/9pfs/virtio-9p.h
浏览文件 @
65c05f9a
...
...
@@ -374,14 +374,6 @@ typedef struct V9fsIattr
int64_t
mtime_nsec
;
}
V9fsIattr
;
typedef
struct
V9fsSetattrState
{
V9fsPDU
*
pdu
;
size_t
offset
;
V9fsIattr
v9iattr
;
V9fsFidState
*
fidp
;
}
V9fsSetattrState
;
struct
virtio_9p_config
{
/* number of characters in tag */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录