Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
17d6a918
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看板
提交
17d6a918
编写于
3月 07, 2014
作者:
M
Michal Privoznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
src/xenxs: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Signed-off-by:
N
Michal Privoznik
<
mprivozn@redhat.com
>
上级
ce17ddac
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
42 deletion
+22
-42
src/xenxs/xen_sxpr.c
src/xenxs/xen_sxpr.c
+14
-23
src/xenxs/xen_xm.c
src/xenxs/xen_xm.c
+8
-19
未找到文件。
src/xenxs/xen_sxpr.c
浏览文件 @
17d6a918
...
...
@@ -601,10 +601,9 @@ xenParseSxprNets(virDomainDefPtr def,
VIR_STRDUP
(
net
->
model
,
"netfront"
)
<
0
)
goto
cleanup
;
if
(
VIR_
REALLOC_N
(
def
->
nets
,
def
->
nnets
+
1
)
<
0
)
if
(
VIR_
APPEND_ELEMENT
(
def
->
nets
,
def
->
nnets
,
net
)
<
0
)
goto
cleanup
;
def
->
nets
[
def
->
nnets
++
]
=
net
;
vif_index
++
;
}
}
...
...
@@ -685,12 +684,11 @@ xenParseSxprSound(virDomainDefPtr def,
goto
error
;
}
if
(
VIR_
REALLOC_N
(
def
->
sounds
,
def
->
nsounds
+
1
)
<
0
)
{
if
(
VIR_
APPEND_ELEMENT
(
def
->
sounds
,
def
->
nsounds
,
sound
)
<
0
)
{
virDomainSoundDefFree
(
sound
);
goto
error
;
}
def
->
sounds
[
def
->
nsounds
++
]
=
sound
;
offset
=
offset2
?
offset2
+
1
:
NULL
;
}
while
(
offset
);
}
...
...
@@ -1057,10 +1055,8 @@ xenParseSxprPCI(virDomainDefPtr def,
dev
->
source
.
subsys
.
u
.
pci
.
addr
.
slot
=
slotID
;
dev
->
source
.
subsys
.
u
.
pci
.
addr
.
function
=
funcID
;
if
(
VIR_
REALLOC_N
(
def
->
hostdevs
,
def
->
nhostdevs
+
1
)
<
0
)
if
(
VIR_
APPEND_ELEMENT
(
def
->
hostdevs
,
def
->
nhostdevs
,
dev
)
<
0
)
goto
error
;
def
->
hostdevs
[
def
->
nhostdevs
++
]
=
dev
;
}
return
0
;
...
...
@@ -1326,11 +1322,10 @@ xenParseSxpr(const struct sexpr *root,
disk
->
bus
=
VIR_DOMAIN_DISK_BUS_IDE
;
disk
->
readonly
=
true
;
if
(
VIR_
REALLOC_N
(
def
->
disks
,
def
->
ndisks
+
1
)
<
0
)
{
if
(
VIR_
APPEND_ELEMENT
(
def
->
disks
,
def
->
ndisks
,
disk
)
<
0
)
{
virDomainDiskDefFree
(
disk
);
goto
error
;
}
def
->
disks
[
def
->
ndisks
++
]
=
disk
;
}
}
...
...
@@ -1361,11 +1356,10 @@ xenParseSxpr(const struct sexpr *root,
}
disk
->
bus
=
VIR_DOMAIN_DISK_BUS_FDC
;
if
(
VIR_
REALLOC_N
(
def
->
disks
,
def
->
ndisks
+
1
)
<
0
)
{
if
(
VIR_
APPEND_ELEMENT
(
def
->
disks
,
def
->
ndisks
,
disk
)
<
0
)
{
virDomainDiskDefFree
(
disk
);
goto
error
;
}
def
->
disks
[
def
->
ndisks
++
]
=
disk
;
}
}
}
...
...
@@ -1395,13 +1389,12 @@ xenParseSxpr(const struct sexpr *root,
virDomainChrDefPtr
chr
;
if
((
chr
=
xenParseSxprChar
(
tmp
,
tty
))
==
NULL
)
goto
error
;
if
(
VIR_REALLOC_N
(
def
->
serials
,
def
->
nserials
+
1
)
<
0
)
{
chr
->
deviceType
=
VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL
;
chr
->
target
.
port
=
def
->
nserials
+
ports_skipped
;
if
(
VIR_APPEND_ELEMENT
(
def
->
serials
,
def
->
nserials
,
chr
)
<
0
)
{
virDomainChrDefFree
(
chr
);
goto
error
;
}
chr
->
deviceType
=
VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL
;
chr
->
target
.
port
=
def
->
nserials
+
ports_skipped
;
def
->
serials
[
def
->
nserials
++
]
=
chr
;
}
else
ports_skipped
++
;
...
...
@@ -1417,13 +1410,12 @@ xenParseSxpr(const struct sexpr *root,
virDomainChrDefPtr
chr
;
if
((
chr
=
xenParseSxprChar
(
tmp
,
tty
))
==
NULL
)
goto
error
;
if
(
VIR_REALLOC_N
(
def
->
serials
,
def
->
nserials
+
1
)
<
0
)
{
chr
->
deviceType
=
VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL
;
chr
->
target
.
port
=
0
;
if
(
VIR_APPEND_ELEMENT
(
def
->
serials
,
def
->
nserials
,
chr
)
<
0
)
{
virDomainChrDefFree
(
chr
);
goto
error
;
}
chr
->
deviceType
=
VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL
;
chr
->
target
.
port
=
0
;
def
->
serials
[
def
->
nserials
++
]
=
chr
;
}
}
...
...
@@ -1433,13 +1425,12 @@ xenParseSxpr(const struct sexpr *root,
/* XXX does XenD stuff parallel port tty info into xenstore somewhere ? */
if
((
chr
=
xenParseSxprChar
(
tmp
,
NULL
))
==
NULL
)
goto
error
;
if
(
VIR_REALLOC_N
(
def
->
parallels
,
def
->
nparallels
+
1
)
<
0
)
{
chr
->
deviceType
=
VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL
;
chr
->
target
.
port
=
0
;
if
(
VIR_APPEND_ELEMENT
(
def
->
parallels
,
def
->
nparallels
,
chr
)
<
0
)
{
virDomainChrDefFree
(
chr
);
goto
error
;
}
chr
->
deviceType
=
VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL
;
chr
->
target
.
port
=
0
;
def
->
parallels
[
def
->
nparallels
++
]
=
chr
;
}
}
else
if
(
def
->
id
!=
0
)
{
if
(
VIR_ALLOC_N
(
def
->
consoles
,
1
)
<
0
)
...
...
src/xenxs/xen_xm.c
浏览文件 @
17d6a918
...
...
@@ -608,10 +608,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
disk
->
shared
=
true
;
/* Maintain list in sorted order according to target device name */
if
(
VIR_
REALLOC_N
(
def
->
disks
,
def
->
ndisks
+
1
)
<
0
)
if
(
VIR_
APPEND_ELEMENT
(
def
->
disks
,
def
->
ndisks
,
disk
)
<
0
)
goto
cleanup
;
def
->
disks
[
def
->
ndisks
++
]
=
disk
;
disk
=
NULL
;
skipdisk:
list
=
list
->
next
;
...
...
@@ -637,10 +635,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
disk
->
bus
=
VIR_DOMAIN_DISK_BUS_IDE
;
disk
->
readonly
=
true
;
if
(
VIR_
REALLOC_N
(
def
->
disks
,
def
->
ndisks
+
1
)
<
0
)
if
(
VIR_
APPEND_ELEMENT
(
def
->
disks
,
def
->
ndisks
,
disk
)
<
0
)
goto
cleanup
;
def
->
disks
[
def
->
ndisks
++
]
=
disk
;
disk
=
NULL
;
}
}
...
...
@@ -778,10 +774,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
VIR_STRDUP
(
net
->
ifname
,
vifname
)
<
0
)
goto
cleanup
;
if
(
VIR_
REALLOC_N
(
def
->
nets
,
def
->
nnets
+
1
)
<
0
)
if
(
VIR_
APPEND_ELEMENT
(
def
->
nets
,
def
->
nnets
,
net
)
<
0
)
goto
cleanup
;
def
->
nets
[
def
->
nnets
++
]
=
net
;
net
=
NULL
;
skipnic:
list
=
list
->
next
;
...
...
@@ -869,12 +863,10 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
hostdev
->
source
.
subsys
.
u
.
pci
.
addr
.
slot
=
slotID
;
hostdev
->
source
.
subsys
.
u
.
pci
.
addr
.
function
=
funcID
;
if
(
VIR_
REALLOC_N
(
def
->
hostdevs
,
def
->
nhostdevs
+
1
)
<
0
)
{
if
(
VIR_
APPEND_ELEMENT
(
def
->
hostdevs
,
def
->
nhostdevs
,
hostdev
)
<
0
)
{
virDomainHostdevDefFree
(
hostdev
);
goto
cleanup
;
}
def
->
hostdevs
[
def
->
nhostdevs
++
]
=
hostdev
;
hostdev
=
NULL
;
skippci:
list
=
list
->
next
;
...
...
@@ -1084,16 +1076,13 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
if
(
!
(
chr
=
xenParseSxprChar
(
port
,
NULL
)))
goto
cleanup
;
if
(
VIR_REALLOC_N
(
def
->
serials
,
def
->
nserials
+
1
)
<
0
)
{
virDomainChrDefFree
(
chr
);
goto
cleanup
;
}
chr
->
deviceType
=
VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL
;
chr
->
target
.
port
=
portnum
;
def
->
serials
[
def
->
nserials
++
]
=
chr
;
chr
=
NULL
;
if
(
VIR_APPEND_ELEMENT
(
def
->
serials
,
def
->
nserials
,
chr
)
<
0
)
{
virDomainChrDefFree
(
chr
);
goto
cleanup
;
}
list
=
list
->
next
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录