Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
19a3da7f
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,发现更多精彩内容 >>
提交
19a3da7f
编写于
6月 17, 2009
作者:
B
Blue Swirl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix opening of read only raw images
Signed-off-by:
N
Blue Swirl
<
blauwirbel@gmail.com
>
上级
5c55ff99
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
16 deletion
+15
-16
block/raw-posix.c
block/raw-posix.c
+15
-16
未找到文件。
block/raw-posix.c
浏览文件 @
19a3da7f
...
...
@@ -123,7 +123,7 @@ static int cdrom_reopen(BlockDriverState *bs);
#endif
static
int
raw_open_common
(
BlockDriverState
*
bs
,
const
char
*
filename
,
int
flags
)
int
bdrv_flags
,
int
open_
flags
)
{
BDRVRawState
*
s
=
bs
->
opaque
;
int
fd
,
ret
;
...
...
@@ -132,9 +132,9 @@ static int raw_open_common(BlockDriverState *bs, const char *filename,
s
->
lseek_err_cnt
=
0
;
s
->
open_flags
|=
O_BINARY
;
s
->
open_flags
=
open_flags
|
O_BINARY
;
s
->
open_flags
&=
~
O_ACCMODE
;
if
((
flags
&
BDRV_O_ACCESS
)
==
BDRV_O_RDWR
)
{
if
((
bdrv_
flags
&
BDRV_O_ACCESS
)
==
BDRV_O_RDWR
)
{
s
->
open_flags
|=
O_RDWR
;
}
else
{
s
->
open_flags
|=
O_RDONLY
;
...
...
@@ -143,9 +143,9 @@ static int raw_open_common(BlockDriverState *bs, const char *filename,
/* Use O_DSYNC for write-through caching, no flags for write-back caching,
* and O_DIRECT for no caching. */
if
((
flags
&
BDRV_O_NOCACHE
))
if
((
bdrv_
flags
&
BDRV_O_NOCACHE
))
s
->
open_flags
|=
O_DIRECT
;
else
if
(
!
(
flags
&
BDRV_O_CACHE_WB
))
else
if
(
!
(
bdrv_
flags
&
BDRV_O_CACHE_WB
))
s
->
open_flags
|=
O_DSYNC
;
s
->
fd
=
-
1
;
...
...
@@ -158,7 +158,7 @@ static int raw_open_common(BlockDriverState *bs, const char *filename,
}
s
->
fd
=
fd
;
s
->
aligned_buf
=
NULL
;
if
((
flags
&
BDRV_O_NOCACHE
))
{
if
((
bdrv_
flags
&
BDRV_O_NOCACHE
))
{
s
->
aligned_buf
=
qemu_blockalign
(
bs
,
ALIGNED_BUFFER_SIZE
);
if
(
s
->
aligned_buf
==
NULL
)
{
ret
=
-
errno
;
...
...
@@ -172,12 +172,13 @@ static int raw_open_common(BlockDriverState *bs, const char *filename,
static
int
raw_open
(
BlockDriverState
*
bs
,
const
char
*
filename
,
int
flags
)
{
BDRVRawState
*
s
=
bs
->
opaque
;
int
open_flags
=
0
;
s
->
type
=
FTYPE_FILE
;
if
(
flags
&
BDRV_O_CREAT
)
s
->
open_flags
|
=
O_CREAT
|
O_TRUNC
;
open_flags
=
O_CREAT
|
O_TRUNC
;
return
raw_open_common
(
bs
,
filename
,
flags
);
return
raw_open_common
(
bs
,
filename
,
flags
,
open_flags
);
}
/* XXX: use host sector size if necessary with:
...
...
@@ -1008,7 +1009,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
}
#endif
return
raw_open_common
(
bs
,
filename
,
flags
);
return
raw_open_common
(
bs
,
filename
,
flags
,
0
);
}
#if defined(__linux__)
...
...
@@ -1186,10 +1187,9 @@ static int floppy_open(BlockDriverState *bs, const char *filename, int flags)
posix_aio_init
();
s
->
type
=
FTYPE_FD
;
/* open will not fail even if no floppy is inserted */
s
->
open_flags
|=
O_NONBLOCK
;
ret
=
raw_open_common
(
bs
,
filename
,
flags
);
/* open will not fail even if no floppy is inserted, so add O_NONBLOCK */
ret
=
raw_open_common
(
bs
,
filename
,
flags
,
O_NONBLOCK
);
if
(
ret
)
return
ret
;
...
...
@@ -1279,11 +1279,10 @@ static int cdrom_open(BlockDriverState *bs, const char *filename, int flags)
{
BDRVRawState
*
s
=
bs
->
opaque
;
/* open will not fail even if no CD is inserted */
s
->
open_flags
|=
O_NONBLOCK
;
s
->
type
=
FTYPE_CD
;
return
raw_open_common
(
bs
,
filename
,
flags
);
/* open will not fail even if no CD is inserted, so add O_NONBLOCK */
return
raw_open_common
(
bs
,
filename
,
flags
,
O_NONBLOCK
);
}
static
int
cdrom_probe_device
(
const
char
*
filename
)
...
...
@@ -1373,7 +1372,7 @@ static int cdrom_open(BlockDriverState *bs, const char *filename, int flags)
s
->
type
=
FTYPE_CD
;
ret
=
raw_open_common
(
bs
,
filename
,
flags
);
ret
=
raw_open_common
(
bs
,
filename
,
flags
,
0
);
if
(
ret
)
return
ret
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录