Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
d7d06cc1
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,发现更多精彩内容 >>
提交
d7d06cc1
编写于
3月 07, 2014
作者:
M
Michal Privoznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
src/parallels: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Signed-off-by:
N
Michal Privoznik
<
mprivozn@redhat.com
>
上级
d9e4d5cb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
35 deletion
+12
-35
src/parallels/parallels_driver.c
src/parallels/parallels_driver.c
+4
-11
src/parallels/parallels_storage.c
src/parallels/parallels_storage.c
+8
-24
未找到文件。
src/parallels/parallels_driver.c
浏览文件 @
d7d06cc1
...
...
@@ -231,11 +231,9 @@ parallelsAddSerialInfo(virDomainChrDefPtr **serials, size_t *nserials,
if
(
parallelsGetSerialInfo
(
chr
,
key
,
value
))
goto
cleanup
;
if
(
VIR_
REALLOC_N
(
*
serials
,
*
nserials
+
1
)
<
0
)
if
(
VIR_
APPEND_ELEMENT
(
*
serials
,
*
nserials
,
chr
)
<
0
)
goto
cleanup
;
(
*
serials
)[(
*
nserials
)
++
]
=
chr
;
return
0
;
cleanup:
...
...
@@ -273,11 +271,9 @@ parallelsAddVideoInfo(virDomainDefPtr def, virJSONValuePtr value)
if
(
VIR_ALLOC
(
accel
)
<
0
)
goto
error
;
if
(
VIR_
REALLOC_N
(
def
->
videos
,
def
->
nvideos
+
1
)
<
0
)
if
(
VIR_
APPEND_ELEMENT_COPY
(
def
->
videos
,
def
->
nvideos
,
video
)
<
0
)
goto
error
;
def
->
videos
[
def
->
nvideos
++
]
=
video
;
video
->
type
=
VIR_DOMAIN_VIDEO_TYPE_VGA
;
video
->
vram
=
mem
<<
20
;
video
->
heads
=
1
;
...
...
@@ -386,11 +382,9 @@ parallelsAddHddInfo(virDomainDefPtr def, const char *key, virJSONValuePtr value)
if
(
parallelsGetHddInfo
(
def
,
disk
,
key
,
value
))
goto
error
;
if
(
VIR_
REALLOC_N
(
def
->
disks
,
def
->
ndisks
+
1
)
<
0
)
if
(
VIR_
APPEND_ELEMENT
(
def
->
disks
,
def
->
ndisks
,
disk
)
<
0
)
goto
error
;
def
->
disks
[
def
->
ndisks
++
]
=
disk
;
return
0
;
error:
...
...
@@ -625,10 +619,9 @@ parallelsAddVNCInfo(virDomainDefPtr def, virJSONValuePtr jobj_root)
gr
->
listens
[
0
].
type
=
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS
;
if
(
VIR_
REALLOC_N
(
def
->
graphics
,
def
->
ngraphics
+
1
)
<
0
)
if
(
VIR_
APPEND_ELEMENT
(
def
->
graphics
,
def
->
ngraphics
,
gr
)
<
0
)
goto
cleanup
;
def
->
graphics
[
def
->
ngraphics
++
]
=
gr
;
return
0
;
cleanup:
...
...
src/parallels/parallels_storage.c
浏览文件 @
d7d06cc1
...
...
@@ -311,11 +311,9 @@ static int parallelsAddDiskVolume(virStoragePoolObjPtr pool,
if
(
VIR_STRDUP
(
def
->
key
,
def
->
target
.
path
)
<
0
)
goto
error
;
if
(
VIR_
REALLOC_N
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
+
1
)
<
0
)
if
(
VIR_
APPEND_ELEMENT
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
,
def
)
<
0
)
goto
error
;
pool
->
volumes
.
objs
[
pool
->
volumes
.
count
++
]
=
def
;
return
0
;
no_memory:
virReportOOMError
();
...
...
@@ -1229,9 +1227,6 @@ parallelsStorageVolDefineXML(virStoragePoolObjPtr pool,
}
}
if
(
VIR_REALLOC_N
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
+
1
)
<
0
)
goto
cleanup
;
if
(
virAsprintf
(
&
privvol
->
target
.
path
,
"%s/%s"
,
pool
->
def
->
target
.
path
,
privvol
->
name
)
<
0
)
goto
cleanup
;
...
...
@@ -1255,7 +1250,9 @@ parallelsStorageVolDefineXML(virStoragePoolObjPtr pool,
pool
->
def
->
allocation
);
}
pool
->
volumes
.
objs
[
pool
->
volumes
.
count
++
]
=
privvol
;
if
(
VIR_APPEND_ELEMENT_COPY
(
pool
->
volumes
.
objs
,
pool
->
volumes
.
count
,
privvol
)
<
0
)
goto
cleanup
;
ret
=
privvol
;
privvol
=
NULL
;
...
...
@@ -1362,10 +1359,6 @@ parallelsStorageVolCreateXMLFrom(virStoragePoolPtr pool,
privpool
->
def
->
available
=
(
privpool
->
def
->
capacity
-
privpool
->
def
->
allocation
);
if
(
VIR_REALLOC_N
(
privpool
->
volumes
.
objs
,
privpool
->
volumes
.
count
+
1
)
<
0
)
goto
cleanup
;
if
(
virAsprintf
(
&
privvol
->
target
.
path
,
"%s/%s"
,
privpool
->
def
->
target
.
path
,
privvol
->
name
)
==
-
1
)
goto
cleanup
;
...
...
@@ -1377,7 +1370,9 @@ parallelsStorageVolCreateXMLFrom(virStoragePoolPtr pool,
privpool
->
def
->
available
=
(
privpool
->
def
->
capacity
-
privpool
->
def
->
allocation
);
privpool
->
volumes
.
objs
[
privpool
->
volumes
.
count
++
]
=
privvol
;
if
(
VIR_APPEND_ELEMENT_COPY
(
privpool
->
volumes
.
objs
,
privpool
->
volumes
.
count
,
privvol
)
<
0
)
goto
cleanup
;
ret
=
virGetStorageVol
(
pool
->
conn
,
privpool
->
def
->
name
,
privvol
->
name
,
privvol
->
key
,
...
...
@@ -1416,18 +1411,7 @@ int parallelsStorageVolDefRemove(virStoragePoolObjPtr privpool,
virStorageVolDefFree
(
privvol
);
if
(
i
<
(
privpool
->
volumes
.
count
-
1
))
memmove
(
privpool
->
volumes
.
objs
+
i
,
privpool
->
volumes
.
objs
+
i
+
1
,
sizeof
(
*
(
privpool
->
volumes
.
objs
))
*
(
privpool
->
volumes
.
count
-
(
i
+
1
)));
if
(
VIR_REALLOC_N
(
privpool
->
volumes
.
objs
,
privpool
->
volumes
.
count
-
1
)
<
0
)
{
;
/* Failure to reduce memory allocation isn't fatal */
}
privpool
->
volumes
.
count
--
;
VIR_DELETE_ELEMENT
(
privpool
->
volumes
.
objs
,
i
,
privpool
->
volumes
.
count
);
break
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录