Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
88a4763e
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
88a4763e
编写于
5月 18, 2011
作者:
A
Aneesh Kumar K.V
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hw/9pfs: Update v9fs_statfs to use coroutines
Signed-off-by:
N
Aneesh Kumar K.V
<
aneesh.kumar@linux.vnet.ibm.com
>
上级
94840ff9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
44 addition
and
70 deletion
+44
-70
hw/9pfs/virtio-9p.c
hw/9pfs/virtio-9p.c
+44
-48
hw/9pfs/virtio-9p.h
hw/9pfs/virtio-9p.h
+0
-22
未找到文件。
hw/9pfs/virtio-9p.c
浏览文件 @
88a4763e
...
...
@@ -3036,79 +3036,75 @@ out:
qemu_free
(
vs
);
}
static
void
v9fs_statfs_post_statfs
(
V9fsState
*
s
,
V9fsStatfsState
*
vs
,
int
err
)
{
static
int
v9fs_fill_statfs
(
V9fsState
*
s
,
V9fsPDU
*
pdu
,
struct
statfs
*
stbuf
)
{
uint32_t
f_type
;
uint32_t
f_bsize
;
uint64_t
f_blocks
;
uint64_t
f_bfree
;
uint64_t
f_bavail
;
uint64_t
f_files
;
uint64_t
f_ffree
;
uint64_t
fsid_val
;
uint32_t
f_namelen
;
size_t
offset
=
7
;
int32_t
bsize_factor
;
if
(
err
)
{
err
=
-
errno
;
goto
out
;
}
/*
* compute bsize factor based on host file system block size
* and client msize
*/
bsize_factor
=
(
s
->
msize
-
P9_IOHDRSZ
)
/
vs
->
stbuf
.
f_bsize
;
bsize_factor
=
(
s
->
msize
-
P9_IOHDRSZ
)
/
stbuf
->
f_bsize
;
if
(
!
bsize_factor
)
{
bsize_factor
=
1
;
}
vs
->
v9statfs
.
f_type
=
vs
->
stbuf
.
f_type
;
vs
->
v9statfs
.
f_bsize
=
vs
->
stbuf
.
f_bsize
;
vs
->
v9statfs
.
f_bsize
*=
bsize_factor
;
f_type
=
stbuf
->
f_type
;
f_bsize
=
stbuf
->
f_bsize
;
f_bsize
*=
bsize_factor
;
/*
* f_bsize is adjusted(multiplied) by bsize factor, so we need to
* adjust(divide) the number of blocks, free blocks and available
* blocks by bsize factor
*/
vs
->
v9statfs
.
f_blocks
=
vs
->
stbuf
.
f_blocks
/
bsize_factor
;
vs
->
v9statfs
.
f_bfree
=
vs
->
stbuf
.
f_bfree
/
bsize_factor
;
vs
->
v9statfs
.
f_bavail
=
vs
->
stbuf
.
f_bavail
/
bsize_factor
;
vs
->
v9statfs
.
f_files
=
vs
->
stbuf
.
f_files
;
vs
->
v9statfs
.
f_ffree
=
vs
->
stbuf
.
f_ffree
;
vs
->
v9statfs
.
fsid_val
=
(
unsigned
int
)
vs
->
stbuf
.
f_fsid
.
__val
[
0
]
|
(
unsigned
long
long
)
vs
->
stbuf
.
f_fsid
.
__val
[
1
]
<<
32
;
vs
->
v9statfs
.
f_namelen
=
vs
->
stbuf
.
f_namelen
;
vs
->
offset
+=
pdu_marshal
(
vs
->
pdu
,
vs
->
offset
,
"ddqqqqqqd"
,
vs
->
v9statfs
.
f_type
,
vs
->
v9statfs
.
f_bsize
,
vs
->
v9statfs
.
f_blocks
,
vs
->
v9statfs
.
f_bfree
,
vs
->
v9statfs
.
f_bavail
,
vs
->
v9statfs
.
f_files
,
vs
->
v9statfs
.
f_ffree
,
vs
->
v9statfs
.
fsid_val
,
vs
->
v9statfs
.
f_namelen
);
f_blocks
=
stbuf
->
f_blocks
/
bsize_factor
;
f_bfree
=
stbuf
->
f_bfree
/
bsize_factor
;
f_bavail
=
stbuf
->
f_bavail
/
bsize_factor
;
f_files
=
stbuf
->
f_files
;
f_ffree
=
stbuf
->
f_ffree
;
fsid_val
=
(
unsigned
int
)
stbuf
->
f_fsid
.
__val
[
0
]
|
(
unsigned
long
long
)
stbuf
->
f_fsid
.
__val
[
1
]
<<
32
;
f_namelen
=
stbuf
->
f_namelen
;
out:
complete_pdu
(
s
,
vs
->
pdu
,
vs
->
offset
);
qemu_free
(
vs
);
return
pdu_marshal
(
pdu
,
offset
,
"ddqqqqqqd"
,
f_type
,
f_bsize
,
f_blocks
,
f_bfree
,
f_bavail
,
f_files
,
f_ffree
,
fsid_val
,
f_namelen
);
}
static
void
v9fs_statfs
(
void
*
opaque
)
{
int32_t
fid
;
ssize_t
retval
=
0
;
size_t
offset
=
7
;
V9fsFidState
*
fidp
;
struct
statfs
stbuf
;
V9fsPDU
*
pdu
=
opaque
;
V9fsState
*
s
=
pdu
->
s
;
V9fsStatfsState
*
vs
;
ssize_t
err
=
0
;
vs
=
qemu_malloc
(
sizeof
(
*
vs
));
vs
->
pdu
=
pdu
;
vs
->
offset
=
7
;
memset
(
&
vs
->
v9statfs
,
0
,
sizeof
(
vs
->
v9statfs
));
pdu_unmarshal
(
vs
->
pdu
,
vs
->
offset
,
"d"
,
&
vs
->
fid
);
vs
->
fidp
=
lookup_fid
(
s
,
vs
->
fid
);
if
(
vs
->
fidp
==
NULL
)
{
err
=
-
ENOENT
;
pdu_unmarshal
(
pdu
,
offset
,
"d"
,
&
fid
);
fidp
=
lookup_fid
(
s
,
fid
);
if
(
fidp
==
NULL
)
{
retval
=
-
ENOENT
;
goto
out
;
}
err
=
v9fs_do_statfs
(
s
,
&
vs
->
fidp
->
path
,
&
vs
->
stbuf
);
v9fs_statfs_post_statfs
(
s
,
vs
,
err
);
return
;
retval
=
v9fs_co_statfs
(
s
,
&
fidp
->
path
,
&
stbuf
);
if
(
retval
<
0
)
{
goto
out
;
}
retval
=
offset
;
retval
+=
v9fs_fill_statfs
(
s
,
pdu
,
&
stbuf
);
out:
complete_pdu
(
s
,
vs
->
pdu
,
err
);
qemu_free
(
vs
);
complete_pdu
(
s
,
pdu
,
retval
);
return
;
}
...
...
hw/9pfs/virtio-9p.h
浏览文件 @
88a4763e
...
...
@@ -398,28 +398,6 @@ struct virtio_9p_config
uint8_t
tag
[
0
];
}
__attribute__
((
packed
));
typedef
struct
V9fsStatfs
{
uint32_t
f_type
;
uint32_t
f_bsize
;
uint64_t
f_blocks
;
uint64_t
f_bfree
;
uint64_t
f_bavail
;
uint64_t
f_files
;
uint64_t
f_ffree
;
uint64_t
fsid_val
;
uint32_t
f_namelen
;
}
V9fsStatfs
;
typedef
struct
V9fsStatfsState
{
V9fsPDU
*
pdu
;
size_t
offset
;
int32_t
fid
;
V9fsStatfs
v9statfs
;
V9fsFidState
*
fidp
;
struct
statfs
stbuf
;
}
V9fsStatfsState
;
typedef
struct
V9fsMkState
{
V9fsPDU
*
pdu
;
size_t
offset
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录