Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
ed11a1a4
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,发现更多精彩内容 >>
提交
ed11a1a4
编写于
7月 04, 2013
作者:
M
Michal Privoznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapt to VIR_ALLOC and virAsprintf in src/vmx/*
上级
b24656bc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
66 deletion
+22
-66
src/vmx/vmx.c
src/vmx/vmx.c
+22
-66
未找到文件。
src/vmx/vmx.c
浏览文件 @
ed11a1a4
...
...
@@ -553,10 +553,8 @@ virVMXEscapeHex(const char *string, char escape, const char *special)
++
length
;
}
if
(
VIR_ALLOC_N
(
escaped
,
length
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
escaped
,
length
)
<
0
)
return
NULL
;
}
tmp1
=
string
;
/* reading from this one */
tmp2
=
escaped
;
/* writing to this one */
...
...
@@ -1121,10 +1119,8 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDefPtr def,
int
count
=
0
;
int
*
autodetectedModels
;
if
(
VIR_ALLOC_N
(
autodetectedModels
,
def
->
ndisks
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
autodetectedModels
,
def
->
ndisks
)
<
0
)
return
-
1
;
}
for
(
i
=
0
;
i
<
def
->
ncontrollers
;
++
i
)
{
controller
=
def
->
controllers
[
i
];
...
...
@@ -1287,10 +1283,8 @@ virVMXParseConfig(virVMXContext *ctx,
}
/* Allocate domain def */
if
(
VIR_ALLOC
(
def
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
def
)
<
0
)
goto
cleanup
;
}
def
->
virtType
=
VIR_DOMAIN_VIRT_VMWARE
;
def
->
id
=
-
1
;
...
...
@@ -1432,10 +1426,8 @@ virVMXParseConfig(virVMXContext *ctx,
cpumasklen
=
0
;
def
->
cpumask
=
virBitmapNew
(
VIR_DOMAIN_CPUMASK_LEN
);
if
(
!
def
->
cpumask
)
{
virReportOOMError
();
if
(
!
def
->
cpumask
)
goto
cleanup
;
}
while
(
*
current
!=
'\0'
)
{
virSkipSpaces
(
&
current
);
...
...
@@ -1551,10 +1543,8 @@ virVMXParseConfig(virVMXContext *ctx,
/* FIXME */
/* def:graphics */
if
(
VIR_ALLOC_N
(
def
->
graphics
,
1
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
def
->
graphics
,
1
)
<
0
)
goto
cleanup
;
}
def
->
ngraphics
=
0
;
...
...
@@ -1567,10 +1557,8 @@ virVMXParseConfig(virVMXContext *ctx,
}
/* def:disks: 4 * 15 scsi + 2 * 2 ide + 2 floppy = 66 */
if
(
VIR_ALLOC_N
(
def
->
disks
,
66
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
def
->
disks
,
66
)
<
0
)
goto
cleanup
;
}
def
->
ndisks
=
0
;
...
...
@@ -1692,10 +1680,8 @@ virVMXParseConfig(virVMXContext *ctx,
if
(
sharedFolder_maxNum
>
0
)
{
int
number
;
if
(
VIR_ALLOC_N
(
def
->
fss
,
sharedFolder_maxNum
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
def
->
fss
,
sharedFolder_maxNum
)
<
0
)
goto
cleanup
;
}
def
->
nfss
=
0
;
...
...
@@ -1713,10 +1699,8 @@ virVMXParseConfig(virVMXContext *ctx,
}
/* def:nets */
if
(
VIR_ALLOC_N
(
def
->
nets
,
4
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
def
->
nets
,
4
)
<
0
)
goto
cleanup
;
}
def
->
nnets
=
0
;
...
...
@@ -1735,10 +1719,8 @@ virVMXParseConfig(virVMXContext *ctx,
/* FIXME */
/* def:videos */
if
(
VIR_ALLOC_N
(
def
->
videos
,
1
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
def
->
videos
,
1
)
<
0
)
goto
cleanup
;
}
def
->
nvideos
=
0
;
...
...
@@ -1755,10 +1737,8 @@ virVMXParseConfig(virVMXContext *ctx,
/* FIXME */
/* def:serials */
if
(
VIR_ALLOC_N
(
def
->
serials
,
4
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
def
->
serials
,
4
)
<
0
)
goto
cleanup
;
}
def
->
nserials
=
0
;
...
...
@@ -1774,10 +1754,8 @@ virVMXParseConfig(virVMXContext *ctx,
}
/* def:parallels */
if
(
VIR_ALLOC_N
(
def
->
parallels
,
3
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
def
->
parallels
,
3
)
<
0
)
goto
cleanup
;
}
def
->
nparallels
=
0
;
...
...
@@ -1832,10 +1810,8 @@ virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def)
return
0
;
}
if
(
VIR_ALLOC
(
*
def
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
*
def
)
<
0
)
goto
failure
;
}
(
*
def
)
->
type
=
VIR_DOMAIN_GRAPHICS_TYPE_VNC
;
...
...
@@ -2006,10 +1982,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
return
-
1
;
}
if
(
VIR_ALLOC
(
*
def
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
*
def
)
<
0
)
return
-
1
;
}
(
*
def
)
->
device
=
device
;
(
*
def
)
->
bus
=
busType
;
...
...
@@ -2032,10 +2006,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
goto
cleanup
;
}
if
(
virAsprintf
(
&
prefix
,
"scsi%d:%d"
,
controllerOrBus
,
unit
)
<
0
)
{
virReportOOMError
();
if
(
virAsprintf
(
&
prefix
,
"scsi%d:%d"
,
controllerOrBus
,
unit
)
<
0
)
goto
cleanup
;
}
(
*
def
)
->
dst
=
virIndexToDiskName
...
...
@@ -2058,10 +2030,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
goto
cleanup
;
}
if
(
virAsprintf
(
&
prefix
,
"ide%d:%d"
,
controllerOrBus
,
unit
)
<
0
)
{
virReportOOMError
();
if
(
virAsprintf
(
&
prefix
,
"ide%d:%d"
,
controllerOrBus
,
unit
)
<
0
)
goto
cleanup
;
}
(
*
def
)
->
dst
=
virIndexToDiskName
(
controllerOrBus
*
2
+
unit
,
"hd"
);
...
...
@@ -2091,10 +2061,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
goto
cleanup
;
}
if
(
virAsprintf
(
&
prefix
,
"floppy%d"
,
unit
)
<
0
)
{
virReportOOMError
();
if
(
virAsprintf
(
&
prefix
,
"floppy%d"
,
unit
)
<
0
)
goto
cleanup
;
}
(
*
def
)
->
dst
=
virIndexToDiskName
(
unit
,
"fd"
);
...
...
@@ -2347,10 +2315,8 @@ int virVMXParseFileSystem(virConfPtr conf, int number, virDomainFSDefPtr *def)
return
-
1
;
}
if
(
VIR_ALLOC
(
*
def
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
*
def
)
<
0
)
return
-
1
;
}
(
*
def
)
->
type
=
VIR_DOMAIN_FS_TYPE_MOUNT
;
...
...
@@ -2472,10 +2438,8 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
return
-
1
;
}
if
(
VIR_ALLOC
(
*
def
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
*
def
)
<
0
)
return
-
1
;
}
snprintf
(
prefix
,
sizeof
(
prefix
),
"ethernet%d"
,
controller
);
...
...
@@ -2691,10 +2655,8 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
return
-
1
;
}
if
(
VIR_ALLOC
(
*
def
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
*
def
)
<
0
)
return
-
1
;
}
(
*
def
)
->
deviceType
=
VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL
;
...
...
@@ -2782,10 +2744,8 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
goto
cleanup
;
if
(
virAsprintf
(
&
(
*
def
)
->
source
.
data
.
tcp
.
service
,
"%d"
,
parsedUri
->
port
)
<
0
)
{
virReportOOMError
();
parsedUri
->
port
)
<
0
)
goto
cleanup
;
}
/* See vSphere API documentation about VirtualSerialPortURIBackingInfo */
if
(
parsedUri
->
scheme
==
NULL
||
...
...
@@ -2884,10 +2844,8 @@ virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, int port,
return
-
1
;
}
if
(
VIR_ALLOC
(
*
def
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
*
def
)
<
0
)
return
-
1
;
}
(
*
def
)
->
deviceType
=
VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL
;
...
...
@@ -2982,10 +2940,8 @@ virVMXParseSVGA(virConfPtr conf, virDomainVideoDefPtr *def)
return
-
1
;
}
if
(
VIR_ALLOC
(
*
def
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
*
def
)
<
0
)
return
-
1
;
}
(
*
def
)
->
type
=
VIR_DOMAIN_VIDEO_TYPE_VMVGA
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录