Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
3b8a0f6a
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3b8a0f6a
编写于
9月 07, 2017
作者:
N
Nikolay Shirokovskiy
提交者:
Michal Privoznik
9月 19, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
iohelper: drop unused operation length limit
上级
3faf3ca6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
22 deletion
+8
-22
src/util/iohelper.c
src/util/iohelper.c
+7
-21
src/util/virfile.c
src/util/virfile.c
+1
-1
未找到文件。
src/util/iohelper.c
浏览文件 @
3b8a0f6a
...
...
@@ -44,7 +44,7 @@
#define VIR_FROM_THIS VIR_FROM_STORAGE
static
int
runIO
(
const
char
*
path
,
int
fd
,
int
oflags
,
unsigned
long
long
length
)
runIO
(
const
char
*
path
,
int
fd
,
int
oflags
)
{
void
*
base
=
NULL
;
/* Location to be freed */
char
*
buf
=
NULL
;
/* Aligned location within base */
...
...
@@ -79,7 +79,7 @@ runIO(const char *path, int fd, int oflags, unsigned long long length)
fdoutname
=
"stdout"
;
/* To make the implementation simpler, we give up on any
* attempt to use O_DIRECT in a non-trivial manner. */
if
(
direct
&&
((
end
=
lseek
(
fd
,
0
,
SEEK_CUR
))
!=
0
||
length
))
{
if
(
direct
&&
((
end
=
lseek
(
fd
,
0
,
SEEK_CUR
))
!=
0
))
{
virReportSystemError
(
end
<
0
?
errno
:
EINVAL
,
"%s"
,
_
(
"O_DIRECT read needs entire seekable file"
));
goto
cleanup
;
...
...
@@ -110,20 +110,13 @@ runIO(const char *path, int fd, int oflags, unsigned long long length)
while
(
1
)
{
ssize_t
got
;
if
(
length
&&
(
length
-
total
)
<
buflen
)
buflen
=
length
-
total
;
if
(
buflen
==
0
)
break
;
/* End of requested data from client */
if
((
got
=
saferead
(
fdin
,
buf
,
buflen
))
<
0
)
{
virReportSystemError
(
errno
,
_
(
"Unable to read %s"
),
fdinname
);
goto
cleanup
;
}
if
(
got
==
0
)
break
;
/* End of file before end of requested data */
if
(
got
<
buflen
||
(
buflen
&
alignMask
)
)
{
if
(
got
<
buflen
)
{
/* O_DIRECT can handle at most one short read, at end of file */
if
(
direct
&&
shortRead
)
{
virReportSystemError
(
EINVAL
,
"%s"
,
...
...
@@ -178,7 +171,7 @@ usage(int status)
if
(
status
)
{
fprintf
(
stderr
,
_
(
"%s: try --help for more details"
),
program_name
);
}
else
{
printf
(
_
(
"Usage: %s FILENAME
LENGTH
FD
\n
"
),
program_name
);
printf
(
_
(
"Usage: %s FILENAME FD
\n
"
),
program_name
);
}
exit
(
status
);
}
...
...
@@ -187,7 +180,6 @@ int
main
(
int
argc
,
char
**
argv
)
{
const
char
*
path
;
unsigned
long
long
length
;
int
oflags
=
-
1
;
int
fd
=
-
1
;
...
...
@@ -204,14 +196,8 @@ main(int argc, char **argv)
if
(
argc
>
1
&&
STREQ
(
argv
[
1
],
"--help"
))
usage
(
EXIT_SUCCESS
);
if
(
argc
==
4
)
{
/* FILENAME LENGTH FD */
if
(
virStrToLong_ull
(
argv
[
2
],
NULL
,
10
,
&
length
)
<
0
)
{
fprintf
(
stderr
,
_
(
"%s: malformed file length %s"
),
program_name
,
argv
[
2
]);
exit
(
EXIT_FAILURE
);
}
if
(
virStrToLong_i
(
argv
[
3
],
NULL
,
10
,
&
fd
)
<
0
)
{
if
(
argc
==
3
)
{
/* FILENAME FD */
if
(
virStrToLong_i
(
argv
[
2
],
NULL
,
10
,
&
fd
)
<
0
)
{
fprintf
(
stderr
,
_
(
"%s: malformed fd %s"
),
program_name
,
argv
[
3
]);
exit
(
EXIT_FAILURE
);
...
...
@@ -234,7 +220,7 @@ main(int argc, char **argv)
usage
(
EXIT_FAILURE
);
}
if
(
fd
<
0
||
runIO
(
path
,
fd
,
oflags
,
length
)
<
0
)
if
(
fd
<
0
||
runIO
(
path
,
fd
,
oflags
)
<
0
)
goto
error
;
return
0
;
...
...
src/util/virfile.c
浏览文件 @
3b8a0f6a
...
...
@@ -260,7 +260,7 @@ virFileWrapperFdNew(int *fd, const char *name, unsigned int flags)
LIBEXECDIR
)))
goto
error
;
ret
->
cmd
=
virCommandNewArgList
(
iohelper_path
,
name
,
"0"
,
NULL
);
ret
->
cmd
=
virCommandNewArgList
(
iohelper_path
,
name
,
NULL
);
VIR_FREE
(
iohelper_path
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录