Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
1d73398e
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看板
提交
1d73398e
编写于
5月 14, 2008
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove all use of strcmp, strncmp in favour of STREQ, STREQLEN, STRPREFIX
上级
e830d525
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
190 addition
and
176 deletion
+190
-176
ChangeLog
ChangeLog
+13
-0
Makefile.cfg
Makefile.cfg
+0
-1
proxy/libvirt_proxy.c
proxy/libvirt_proxy.c
+2
-2
src/conf.c
src/conf.c
+2
-2
src/hash.c
src/hash.c
+6
-6
src/iptables.c
src/iptables.c
+3
-3
src/libvirt.c
src/libvirt.c
+2
-2
src/openvz_conf.c
src/openvz_conf.c
+5
-5
src/qemu_conf.c
src/qemu_conf.c
+31
-31
src/remote_internal.c
src/remote_internal.c
+5
-5
src/sexpr.c
src/sexpr.c
+2
-2
src/test.c
src/test.c
+7
-7
src/util.c
src/util.c
+4
-4
src/virsh.c
src/virsh.c
+15
-15
src/xen_unified.c
src/xen_unified.c
+3
-3
src/xend_internal.c
src/xend_internal.c
+20
-20
src/xm_internal.c
src/xm_internal.c
+52
-52
src/xml.c
src/xml.c
+11
-11
src/xmlrpc.c
src/xmlrpc.c
+1
-1
tests/virshtest.c
tests/virshtest.c
+4
-2
tests/xml2sexprtest.c
tests/xml2sexprtest.c
+1
-1
tests/xmlrpctest.c
tests/xmlrpctest.c
+1
-1
未找到文件。
ChangeLog
浏览文件 @
1d73398e
Wed May 14 15:34:43 EST 2008 Daniel P. Berrange <berrange@redhat.com>
* proxy/libvirt_proxy.c, src/conf.c, src/hash.c,
src/iptables.c, src/libvirt.c, src/openvz_conf.c,
src/qemu_conf.c, src/remote_internal.c, src/sexpr.c,
src/test.c, src/util.c, src/virsh.c, src/xen_unified.c,
src/xend_internal.c, src/xm_internal.c, src/xml.c,
src/xmlrpc.c, tests/virshtest.c, tests/xml2sexprtest.c,
tests/xmlrpctest.c: Replace all use of strcmp, strncmp,
etc with STREQ/STREQLEN/STRPREFIX macros.
* Makefile.cfg: Enable strcmp syntax check
* .x-sc_prohibit_strcmp: Blacklist gnulib module
Tue May 13 10:55:43 CEST 2008 Jim Meyering <meyering@redhat.com>
avoid "not a string literal..." warnings
...
...
Makefile.cfg
浏览文件 @
1d73398e
...
...
@@ -40,7 +40,6 @@ local-checks-to-skip = \
sc_prohibit_jm_in_m4
\
sc_prohibit_quote_without_use
\
sc_prohibit_quotearg_without_use
\
sc_prohibit_strcmp
\
sc_root_tests
\
sc_space_tab
\
sc_sun_os_names
\
...
...
proxy/libvirt_proxy.c
浏览文件 @
1d73398e
...
...
@@ -802,9 +802,9 @@ int main(int argc, char **argv) {
}
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
!
strcmp
(
argv
[
i
],
"-v"
))
{
if
(
STREQ
(
argv
[
i
],
"-v"
))
{
debug
++
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-no-timeout"
))
{
}
else
if
(
STREQ
(
argv
[
i
],
"-no-timeout"
))
{
persist
=
1
;
}
else
{
usage
(
argv
[
0
]);
...
...
src/conf.c
浏览文件 @
1d73398e
...
...
@@ -800,7 +800,7 @@ __virConfGetValue(virConfPtr conf, const char *setting)
cur
=
conf
->
entries
;
while
(
cur
!=
NULL
)
{
if
((
cur
->
name
!=
NULL
)
&&
(
!
strcmp
(
cur
->
name
,
setting
)))
if
((
cur
->
name
!=
NULL
)
&&
(
STREQ
(
cur
->
name
,
setting
)))
return
(
cur
->
value
);
cur
=
cur
->
next
;
}
...
...
@@ -829,7 +829,7 @@ __virConfSetValue (virConfPtr conf,
cur
=
conf
->
entries
;
while
(
cur
!=
NULL
)
{
if
((
cur
->
name
!=
NULL
)
&&
(
!
strcmp
(
cur
->
name
,
setting
)))
{
if
((
cur
->
name
!=
NULL
)
&&
(
STREQ
(
cur
->
name
,
setting
)))
{
break
;
}
prev
=
cur
;
...
...
src/hash.c
浏览文件 @
1d73398e
...
...
@@ -270,11 +270,11 @@ virHashAddEntry(virHashTablePtr table, const char *name, void *userdata)
}
else
{
for
(
insert
=
&
(
table
->
table
[
key
]);
insert
->
next
!=
NULL
;
insert
=
insert
->
next
)
{
if
(
!
strcmp
(
insert
->
name
,
name
))
if
(
STREQ
(
insert
->
name
,
name
))
return
(
-
1
);
len
++
;
}
if
(
!
strcmp
(
insert
->
name
,
name
))
if
(
STREQ
(
insert
->
name
,
name
))
return
(
-
1
);
}
...
...
@@ -335,14 +335,14 @@ virHashUpdateEntry(virHashTablePtr table, const char *name,
}
else
{
for
(
insert
=
&
(
table
->
table
[
key
]);
insert
->
next
!=
NULL
;
insert
=
insert
->
next
)
{
if
(
!
strcmp
(
insert
->
name
,
name
))
{
if
(
STREQ
(
insert
->
name
,
name
))
{
if
(
f
)
f
(
insert
->
payload
,
insert
->
name
);
insert
->
payload
=
userdata
;
return
(
0
);
}
}
if
(
!
strcmp
(
insert
->
name
,
name
))
{
if
(
STREQ
(
insert
->
name
,
name
))
{
if
(
f
)
f
(
insert
->
payload
,
insert
->
name
);
insert
->
payload
=
userdata
;
...
...
@@ -393,7 +393,7 @@ virHashLookup(virHashTablePtr table, const char *name)
if
(
table
->
table
[
key
].
valid
==
0
)
return
(
NULL
);
for
(
entry
=
&
(
table
->
table
[
key
]);
entry
!=
NULL
;
entry
=
entry
->
next
)
{
if
(
!
strcmp
(
entry
->
name
,
name
))
if
(
STREQ
(
entry
->
name
,
name
))
return
(
entry
->
payload
);
}
return
(
NULL
);
...
...
@@ -445,7 +445,7 @@ virHashRemoveEntry(virHashTablePtr table, const char *name,
}
else
{
for
(
entry
=
&
(
table
->
table
[
key
]);
entry
!=
NULL
;
entry
=
entry
->
next
)
{
if
(
!
strcmp
(
entry
->
name
,
name
))
{
if
(
STREQ
(
entry
->
name
,
name
))
{
if
((
f
!=
NULL
)
&&
(
entry
->
payload
!=
NULL
))
f
(
entry
->
payload
,
entry
->
name
);
entry
->
payload
=
NULL
;
...
...
src/iptables.c
浏览文件 @
1d73398e
...
...
@@ -114,7 +114,7 @@ stripLine(char *str, int len, const char *line)
s
=
str
;
while
((
p
=
strchr
(
s
,
'\n'
)))
{
if
(
p
==
s
||
strncmp
(
s
,
line
,
p
-
s
)
!=
0
)
{
if
(
p
==
s
||
STRNEQLEN
(
s
,
line
,
p
-
s
)
)
{
s
=
++
p
;
continue
;
}
...
...
@@ -125,7 +125,7 @@ stripLine(char *str, int len, const char *line)
changed
=
1
;
}
if
(
strcmp
(
s
,
line
)
==
0
)
{
if
(
STREQ
(
s
,
line
)
)
{
*
s
=
'\0'
;
changed
=
1
;
}
...
...
@@ -310,7 +310,7 @@ iptRulesRemove(iptRules *rules,
int
i
;
for
(
i
=
0
;
i
<
rules
->
nrules
;
i
++
)
if
(
!
strcmp
(
rules
->
rules
[
i
].
rule
,
rule
))
if
(
STREQ
(
rules
->
rules
[
i
].
rule
,
rule
))
break
;
if
(
i
>=
rules
->
nrules
)
...
...
src/libvirt.c
浏览文件 @
1d73398e
...
...
@@ -655,7 +655,7 @@ virGetVersion(unsigned long *libVer, const char *type,
type
=
"Xen"
;
for
(
i
=
0
;
i
<
virDriverTabCount
;
i
++
)
{
if
((
virDriverTab
[
i
]
!=
NULL
)
&&
(
!
strcasecmp
(
virDriverTab
[
i
]
->
name
,
type
)))
{
(
STRCASEEQ
(
virDriverTab
[
i
]
->
name
,
type
)))
{
*
typeVer
=
virDriverTab
[
i
]
->
ver
;
break
;
}
...
...
@@ -721,7 +721,7 @@ do_open (const char *name,
}
/* Convert xen -> xen:/// for back compat */
if
(
!
strcasecmp
(
name
,
"xen"
))
if
(
STRCASEEQ
(
name
,
"xen"
))
name
=
"xen:///"
;
/* Convert xen:// -> xen:/// because xmlParseURI cannot parse the
...
...
src/openvz_conf.c
浏览文件 @
1d73398e
...
...
@@ -107,7 +107,7 @@ struct openvz_vm
struct
openvz_vm
*
vm
=
driver
->
vms
;
while
(
vm
)
{
if
(
!
strcmp
(
vm
->
vmdef
->
name
,
name
))
if
(
STREQ
(
vm
->
vmdef
->
name
,
name
))
return
vm
;
vm
=
vm
->
next
;
}
...
...
@@ -324,7 +324,7 @@ static struct openvz_vm_def
goto
bail_out
;
}
if
(
strcmp
((
char
*
)
prop
,
"openvz"
)){
if
(
STRNEQ
((
char
*
)
prop
,
"openvz"
)){
error
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"invalid domain type attribute"
));
goto
bail_out
;
}
...
...
@@ -553,7 +553,7 @@ openvzGetVPSInfo(virConnectPtr conn) {
_
(
"Failed to parse vzlist output"
));
goto
error
;
}
if
(
strcmp
(
status
,
"stopped"
))
{
if
(
STRNEQ
(
status
,
"stopped"
))
{
(
*
pnext
)
->
status
=
VIR_DOMAIN_RUNNING
;
driver
->
num_active
++
;
(
*
pnext
)
->
vpsid
=
veid
;
...
...
@@ -673,7 +673,7 @@ openvzGetVPSUUID(int vpsid, char *uuidstr)
}
sscanf
(
line
,
"%s %s
\n
"
,
iden
,
uuidbuf
);
if
(
!
strcmp
(
iden
,
"#UUID:"
))
{
if
(
STREQ
(
iden
,
"#UUID:"
))
{
strncpy
(
uuidstr
,
uuidbuf
,
VIR_UUID_STRING_BUFLEN
);
break
;
}
...
...
@@ -747,7 +747,7 @@ int openvzAssignUUIDs(void)
while
((
dent
=
readdir
(
dp
)))
{
res
=
sscanf
(
dent
->
d_name
,
"%d.%5s"
,
&
vpsid
,
ext
);
if
(
!
(
res
==
2
&&
!
strcmp
(
ext
,
"conf"
)))
if
(
!
(
res
==
2
&&
STREQ
(
ext
,
"conf"
)))
continue
;
if
(
vpsid
>
0
)
/* '0.conf' belongs to the host, ignore it */
openvzSetUUID
(
vpsid
);
...
...
src/qemu_conf.c
浏览文件 @
1d73398e
...
...
@@ -166,7 +166,7 @@ struct qemud_vm *qemudFindVMByName(const struct qemud_driver *driver,
struct
qemud_vm
*
vm
=
driver
->
vms
;
while
(
vm
)
{
if
(
!
strcmp
(
vm
->
def
->
name
,
name
))
if
(
STREQ
(
vm
->
def
->
name
,
name
))
return
vm
;
vm
=
vm
->
next
;
}
...
...
@@ -192,7 +192,7 @@ struct qemud_network *qemudFindNetworkByName(const struct qemud_driver *driver,
struct
qemud_network
*
network
=
driver
->
networks
;
while
(
network
)
{
if
(
!
strcmp
(
network
->
def
->
name
,
name
))
if
(
STREQ
(
network
->
def
->
name
,
name
))
return
network
;
network
=
network
->
next
;
}
...
...
@@ -644,30 +644,30 @@ static int qemudParseDiskXML(virConnectPtr conn,
}
if
(
device
&&
!
strcmp
((
const
char
*
)
device
,
"floppy"
)
&&
strcmp
((
const
char
*
)
target
,
"fda"
)
&&
strcmp
((
const
char
*
)
target
,
"fdb"
))
{
STREQ
((
const
char
*
)
device
,
"floppy"
)
&&
STRNEQ
((
const
char
*
)
target
,
"fda"
)
&&
STRNEQ
((
const
char
*
)
target
,
"fdb"
))
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Invalid floppy device name: %s"
),
target
);
goto
error
;
}
if
(
device
&&
!
strcmp
((
const
char
*
)
device
,
"cdrom"
)
&&
strcmp
((
const
char
*
)
target
,
"hdc"
))
{
STREQ
((
const
char
*
)
device
,
"cdrom"
)
&&
STRNEQ
((
const
char
*
)
target
,
"hdc"
))
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Invalid cdrom device name: %s"
),
target
);
goto
error
;
}
if
(
device
&&
!
strcmp
((
const
char
*
)
device
,
"cdrom"
))
STREQ
((
const
char
*
)
device
,
"cdrom"
))
disk
->
readonly
=
1
;
if
((
!
device
||
!
strcmp
((
const
char
*
)
device
,
"disk"
))
&&
strncmp
((
const
char
*
)
target
,
"hd"
,
2
)
&&
strncmp
((
const
char
*
)
target
,
"sd"
,
2
)
&&
strncmp
((
const
char
*
)
target
,
"vd"
,
2
))
{
if
((
!
device
||
STREQ
((
const
char
*
)
device
,
"disk"
))
&&
!
STRPREFIX
((
const
char
*
)
target
,
"hd"
)
&&
!
STRPREFIX
((
const
char
*
)
target
,
"sd"
)
&&
!
STRPREFIX
((
const
char
*
)
target
,
"vd"
))
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Invalid harddisk device name: %s"
),
target
);
goto
error
;
...
...
@@ -682,11 +682,11 @@ static int qemudParseDiskXML(virConnectPtr conn,
if
(
!
device
)
disk
->
device
=
QEMUD_DISK_DISK
;
else
if
(
!
strcmp
((
const
char
*
)
device
,
"disk"
))
else
if
(
STREQ
((
const
char
*
)
device
,
"disk"
))
disk
->
device
=
QEMUD_DISK_DISK
;
else
if
(
!
strcmp
((
const
char
*
)
device
,
"cdrom"
))
else
if
(
STREQ
((
const
char
*
)
device
,
"cdrom"
))
disk
->
device
=
QEMUD_DISK_CDROM
;
else
if
(
!
strcmp
((
const
char
*
)
device
,
"floppy"
))
else
if
(
STREQ
((
const
char
*
)
device
,
"floppy"
))
disk
->
device
=
QEMUD_DISK_FLOPPY
;
else
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
...
...
@@ -1376,9 +1376,9 @@ static int qemudParseInputXML(virConnectPtr conn,
goto
error
;
}
if
(
!
strcmp
((
const
char
*
)
type
,
"mouse"
))
{
if
(
STREQ
((
const
char
*
)
type
,
"mouse"
))
{
input
->
type
=
QEMU_INPUT_TYPE_MOUSE
;
}
else
if
(
!
strcmp
((
const
char
*
)
type
,
"tablet"
))
{
}
else
if
(
STREQ
((
const
char
*
)
type
,
"tablet"
))
{
input
->
type
=
QEMU_INPUT_TYPE_TABLET
;
}
else
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
...
...
@@ -1388,7 +1388,7 @@ static int qemudParseInputXML(virConnectPtr conn,
}
if
(
bus
)
{
if
(
!
strcmp
((
const
char
*
)
bus
,
"ps2"
))
{
/* Only allow mouse */
if
(
STREQ
((
const
char
*
)
bus
,
"ps2"
))
{
/* Only allow mouse */
if
(
input
->
type
==
QEMU_INPUT_TYPE_TABLET
)
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"ps2 bus does not support %s input device"
),
...
...
@@ -1396,7 +1396,7 @@ static int qemudParseInputXML(virConnectPtr conn,
goto
error
;
}
input
->
bus
=
QEMU_INPUT_BUS_PS2
;
}
else
if
(
!
strcmp
((
const
char
*
)
bus
,
"usb"
))
{
/* Allow mouse & keyboard */
}
else
if
(
STREQ
((
const
char
*
)
bus
,
"usb"
))
{
/* Allow mouse & keyboard */
input
->
bus
=
QEMU_INPUT_BUS_USB
;
}
else
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
...
...
@@ -1537,11 +1537,11 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
goto
error
;
}
if
(
!
strcmp
((
char
*
)
prop
,
"qemu"
))
if
(
STREQ
((
char
*
)
prop
,
"qemu"
))
def
->
virtType
=
QEMUD_VIRT_QEMU
;
else
if
(
!
strcmp
((
char
*
)
prop
,
"kqemu"
))
else
if
(
STREQ
((
char
*
)
prop
,
"kqemu"
))
def
->
virtType
=
QEMUD_VIRT_KQEMU
;
else
if
(
!
strcmp
((
char
*
)
prop
,
"kvm"
))
else
if
(
STREQ
((
char
*
)
prop
,
"kvm"
))
def
->
virtType
=
QEMUD_VIRT_KVM
;
else
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
...
...
@@ -1654,7 +1654,7 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
(
obj
->
stringval
==
NULL
)
||
(
obj
->
stringval
[
0
]
==
0
))
{
def
->
noReboot
=
0
;
}
else
{
if
(
!
strcmp
((
char
*
)
obj
->
stringval
,
"destroy"
))
if
(
STREQ
((
char
*
)
obj
->
stringval
,
"destroy"
))
def
->
noReboot
=
1
;
else
def
->
noReboot
=
0
;
...
...
@@ -1667,7 +1667,7 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
(
obj
->
stringval
==
NULL
)
||
(
obj
->
stringval
[
0
]
==
0
))
{
def
->
localtime
=
0
;
}
else
{
if
(
!
strcmp
((
char
*
)
obj
->
stringval
,
"localtime"
))
if
(
STREQ
((
char
*
)
obj
->
stringval
,
"localtime"
))
def
->
localtime
=
1
;
else
def
->
localtime
=
0
;
...
...
@@ -1791,13 +1791,13 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
for
(
i
=
0
;
i
<
obj
->
nodesetval
->
nodeNr
&&
i
<
QEMUD_MAX_BOOT_DEVS
;
i
++
)
{
if
(
!
(
prop
=
xmlGetProp
(
obj
->
nodesetval
->
nodeTab
[
i
],
BAD_CAST
"dev"
)))
continue
;
if
(
!
strcmp
((
char
*
)
prop
,
"hd"
))
{
if
(
STREQ
((
char
*
)
prop
,
"hd"
))
{
def
->
os
.
bootDevs
[
def
->
os
.
nBootDevs
++
]
=
QEMUD_BOOT_DISK
;
}
else
if
(
!
strcmp
((
char
*
)
prop
,
"fd"
))
{
}
else
if
(
STREQ
((
char
*
)
prop
,
"fd"
))
{
def
->
os
.
bootDevs
[
def
->
os
.
nBootDevs
++
]
=
QEMUD_BOOT_FLOPPY
;
}
else
if
(
!
strcmp
((
char
*
)
prop
,
"cdrom"
))
{
}
else
if
(
STREQ
((
char
*
)
prop
,
"cdrom"
))
{
def
->
os
.
bootDevs
[
def
->
os
.
nBootDevs
++
]
=
QEMUD_BOOT_CDROM
;
}
else
if
(
!
strcmp
((
char
*
)
prop
,
"network"
))
{
}
else
if
(
STREQ
((
char
*
)
prop
,
"network"
))
{
def
->
os
.
bootDevs
[
def
->
os
.
nBootDevs
++
]
=
QEMUD_BOOT_NET
;
}
else
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
...
...
@@ -1849,7 +1849,7 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
(
obj
->
nodesetval
==
NULL
)
||
(
obj
->
nodesetval
->
nodeNr
==
0
))
{
def
->
graphicsType
=
QEMUD_GRAPHICS_NONE
;
}
else
if
((
prop
=
xmlGetProp
(
obj
->
nodesetval
->
nodeTab
[
0
],
BAD_CAST
"type"
)))
{
if
(
!
strcmp
((
char
*
)
prop
,
"vnc"
))
{
if
(
STREQ
((
char
*
)
prop
,
"vnc"
))
{
xmlChar
*
vncport
,
*
vnclisten
;
def
->
graphicsType
=
QEMUD_GRAPHICS_VNC
;
vncport
=
xmlGetProp
(
obj
->
nodesetval
->
nodeTab
[
0
],
BAD_CAST
"port"
);
...
...
@@ -1868,7 +1868,7 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
def
->
keymap
=
(
char
*
)
xmlGetProp
(
obj
->
nodesetval
->
nodeTab
[
0
],
BAD_CAST
"keymap"
);
xmlFree
(
vncport
);
xmlFree
(
vnclisten
);
}
else
if
(
!
strcmp
((
char
*
)
prop
,
"sdl"
))
{
}
else
if
(
STREQ
((
char
*
)
prop
,
"sdl"
))
{
def
->
graphicsType
=
QEMUD_GRAPHICS_SDL
;
}
else
{
qemudReportError
(
conn
,
NULL
,
NULL
,
VIR_ERR_INTERNAL_ERROR
,
...
...
@@ -2318,7 +2318,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
* 3. The qemu binary has the -no-kqemu flag
*/
if
((
vm
->
qemuCmdFlags
&
QEMUD_CMD_FLAG_KQEMU
)
&&
!
strcmp
(
ut
.
machine
,
vm
->
def
->
os
.
arch
)
&&
STREQ
(
ut
.
machine
,
vm
->
def
->
os
.
arch
)
&&
vm
->
def
->
virtType
==
QEMUD_VIRT_QEMU
)
disableKQEMU
=
1
;
...
...
src/remote_internal.c
浏览文件 @
1d73398e
...
...
@@ -316,15 +316,15 @@ doRemoteOpen (virConnectPtr conn,
trans_tcp
,
}
transport
;
if
(
!
transport_str
||
strcasecmp
(
transport_str
,
"tls"
)
==
0
)
if
(
!
transport_str
||
STRCASEEQ
(
transport_str
,
"tls"
)
)
transport
=
trans_tls
;
else
if
(
strcasecmp
(
transport_str
,
"unix"
)
==
0
)
else
if
(
STRCASEEQ
(
transport_str
,
"unix"
)
)
transport
=
trans_unix
;
else
if
(
strcasecmp
(
transport_str
,
"ssh"
)
==
0
)
else
if
(
STRCASEEQ
(
transport_str
,
"ssh"
)
)
transport
=
trans_ssh
;
else
if
(
strcasecmp
(
transport_str
,
"ext"
)
==
0
)
else
if
(
STRCASEEQ
(
transport_str
,
"ext"
)
)
transport
=
trans_ext
;
else
if
(
strcasecmp
(
transport_str
,
"tcp"
)
==
0
)
else
if
(
STRCASEEQ
(
transport_str
,
"tcp"
)
)
transport
=
trans_tcp
;
else
{
error
(
conn
,
VIR_ERR_INVALID_ARG
,
...
...
src/sexpr.c
浏览文件 @
1d73398e
...
...
@@ -433,7 +433,7 @@ sexpr_lookup_key(const struct sexpr *sexpr, const char *node)
return
NULL
;
}
if
(
strcmp
(
sexpr
->
u
.
s
.
car
->
u
.
value
,
token
)
!=
0
)
{
if
(
STRNEQ
(
sexpr
->
u
.
s
.
car
->
u
.
value
,
token
)
)
{
return
NULL
;
}
...
...
@@ -451,7 +451,7 @@ sexpr_lookup_key(const struct sexpr *sexpr, const char *node)
continue
;
}
if
(
strcmp
(
i
->
u
.
s
.
car
->
u
.
s
.
car
->
u
.
value
,
token
)
==
0
)
{
if
(
STREQ
(
i
->
u
.
s
.
car
->
u
.
s
.
car
->
u
.
value
,
token
)
)
{
sexpr
=
i
->
u
.
s
.
car
;
break
;
}
...
...
src/test.c
浏览文件 @
1d73398e
...
...
@@ -196,13 +196,13 @@ testError(virConnectPtr con,
}
static
int
testRestartStringToFlag
(
const
char
*
str
)
{
if
(
!
strcmp
(
str
,
"restart"
))
{
if
(
STREQ
(
str
,
"restart"
))
{
return
VIR_DOMAIN_RESTART
;
}
else
if
(
!
strcmp
(
str
,
"destroy"
))
{
}
else
if
(
STREQ
(
str
,
"destroy"
))
{
return
VIR_DOMAIN_DESTROY
;
}
else
if
(
!
strcmp
(
str
,
"preserve"
))
{
}
else
if
(
STREQ
(
str
,
"preserve"
))
{
return
VIR_DOMAIN_PRESERVE
;
}
else
if
(
!
strcmp
(
str
,
"rename-restart"
))
{
}
else
if
(
STREQ
(
str
,
"rename-restart"
))
{
return
VIR_DOMAIN_RENAME_RESTART
;
}
else
{
return
(
0
);
...
...
@@ -914,7 +914,7 @@ static int testOpen(virConnectPtr conn,
if
(
!
uri
)
return
VIR_DRV_OPEN_DECLINED
;
if
(
!
uri
->
scheme
||
strcmp
(
uri
->
scheme
,
"test"
)
!=
0
)
if
(
!
uri
->
scheme
||
STRNEQ
(
uri
->
scheme
,
"test"
)
)
return
VIR_DRV_OPEN_DECLINED
;
/* Remote driver should handle these. */
...
...
@@ -1170,7 +1170,7 @@ static virDomainPtr testLookupDomainByName(virConnectPtr conn,
for
(
i
=
0
;
i
<
MAX_DOMAINS
;
i
++
)
{
if
(
privconn
->
domains
[
i
].
active
&&
strcmp
(
name
,
privconn
->
domains
[
i
].
name
)
==
0
)
{
STREQ
(
name
,
privconn
->
domains
[
i
].
name
)
)
{
idx
=
i
;
break
;
}
...
...
@@ -1767,7 +1767,7 @@ static virNetworkPtr testLookupNetworkByName(virConnectPtr conn,
for
(
i
=
0
;
i
<
MAX_NETWORKS
;
i
++
)
{
if
(
privconn
->
networks
[
i
].
active
&&
strcmp
(
name
,
privconn
->
networks
[
i
].
name
)
==
0
)
{
STREQ
(
name
,
privconn
->
networks
[
i
].
name
)
)
{
idx
=
i
;
break
;
}
...
...
src/util.c
浏览文件 @
1d73398e
...
...
@@ -384,8 +384,8 @@ int virFileMatchesNameSuffix(const char *file,
int
suffixlen
=
strlen
(
suffix
);
if
(
filelen
==
(
namelen
+
suffixlen
)
&&
!
strncmp
(
file
,
name
,
namelen
)
&&
!
strncmp
(
file
+
namelen
,
suffix
,
suffixlen
))
STREQLEN
(
file
,
name
,
namelen
)
&&
STREQLEN
(
file
+
namelen
,
suffix
,
suffixlen
))
return
1
;
else
return
0
;
...
...
@@ -400,7 +400,7 @@ int virFileHasSuffix(const char *str,
if
(
len
<
suffixlen
)
return
0
;
return
strcmp
(
str
+
len
-
suffixlen
,
suffix
)
==
0
;
return
STREQ
(
str
+
len
-
suffixlen
,
suffix
)
;
}
#ifndef __MINGW32__
...
...
@@ -479,7 +479,7 @@ int virFileLinkPointsTo(const char *checkLink,
}
/* compare */
if
(
strcmp
(
checkReal
,
real
)
!=
0
)
{
if
(
STRNEQ
(
checkReal
,
real
)
)
{
virLog
(
"Link '%s' does not point to '%s', ignoring"
,
checkLink
,
checkReal
);
return
0
;
...
...
src/virsh.c
浏览文件 @
1d73398e
...
...
@@ -4351,7 +4351,7 @@ cmdVNCDisplay(vshControl * ctl, vshCmd * cmd)
obj
=
xmlXPathEval
(
BAD_CAST
"string(/domain/devices/graphics[@type='vnc']/@listen)"
,
ctxt
);
if
((
obj
==
NULL
)
||
(
obj
->
type
!=
XPATH_STRING
)
||
(
obj
->
stringval
==
NULL
)
||
(
obj
->
stringval
[
0
]
==
0
)
||
!
strcmp
((
const
char
*
)
obj
->
stringval
,
"0.0.0.0"
))
{
STREQ
((
const
char
*
)
obj
->
stringval
,
"0.0.0.0"
))
{
vshPrint
(
ctl
,
":%d
\n
"
,
port
-
5900
);
}
else
{
vshPrint
(
ctl
,
"%s:%d
\n
"
,
(
const
char
*
)
obj
->
stringval
,
port
-
5900
);
...
...
@@ -4587,9 +4587,9 @@ cmdAttachInterface(vshControl * ctl, vshCmd * cmd)
script
=
vshCommandOptString
(
cmd
,
"script"
,
NULL
);
/* check interface type */
if
(
strcmp
(
type
,
"network"
)
==
0
)
{
if
(
STREQ
(
type
,
"network"
)
)
{
typ
=
1
;
}
else
if
(
strcmp
(
type
,
"bridge"
)
==
0
)
{
}
else
if
(
STREQ
(
type
,
"bridge"
)
)
{
typ
=
2
;
}
else
{
vshError
(
ctl
,
FALSE
,
_
(
"No support %s in command 'attach-interface'"
),
type
);
...
...
@@ -4824,23 +4824,23 @@ cmdAttachDisk(vshControl * ctl, vshCmd * cmd)
mode
=
vshCommandOptString
(
cmd
,
"mode"
,
NULL
);
if
(
type
)
{
if
(
strcmp
(
type
,
"cdrom"
)
&&
strcmp
(
type
,
"disk"
))
{
if
(
STRNEQ
(
type
,
"cdrom"
)
&&
STRNEQ
(
type
,
"disk"
))
{
vshError
(
ctl
,
FALSE
,
_
(
"No support %s in command 'attach-disk'"
),
type
);
goto
cleanup
;
}
}
if
(
driver
)
{
if
(
!
strcmp
(
driver
,
"file"
)
||
!
strcmp
(
driver
,
"tap"
))
{
if
(
STREQ
(
driver
,
"file"
)
||
STREQ
(
driver
,
"tap"
))
{
isFile
=
1
;
}
else
if
(
strcmp
(
driver
,
"phy"
))
{
}
else
if
(
STRNEQ
(
driver
,
"phy"
))
{
vshError
(
ctl
,
FALSE
,
_
(
"No support %s in command 'attach-disk'"
),
driver
);
goto
cleanup
;
}
}
if
(
mode
)
{
if
(
strcmp
(
mode
,
"readonly"
)
&&
strcmp
(
mode
,
"shareable"
))
{
if
(
STRNEQ
(
mode
,
"readonly"
)
&&
STRNEQ
(
mode
,
"shareable"
))
{
vshError
(
ctl
,
FALSE
,
_
(
"No support %s in command 'attach-disk'"
),
mode
);
goto
cleanup
;
}
...
...
@@ -5171,7 +5171,7 @@ vshCmddefGetInfo(vshCmdDef * cmd, const char *name)
vshCmdInfo
*
info
;
for
(
info
=
cmd
->
info
;
info
&&
info
->
name
;
info
++
)
{
if
(
strcmp
(
info
->
name
,
name
)
==
0
)
if
(
STREQ
(
info
->
name
,
name
)
)
return
info
->
data
;
}
return
NULL
;
...
...
@@ -5183,7 +5183,7 @@ vshCmddefGetOption(vshCmdDef * cmd, const char *name)
vshCmdOptDef
*
opt
;
for
(
opt
=
cmd
->
opts
;
opt
&&
opt
->
name
;
opt
++
)
if
(
strcmp
(
opt
->
name
,
name
)
==
0
)
if
(
STREQ
(
opt
->
name
,
name
)
)
return
opt
;
return
NULL
;
}
...
...
@@ -5244,7 +5244,7 @@ vshCmddefSearch(const char *cmdname)
vshCmdDef
*
c
;
for
(
c
=
commands
;
c
->
name
;
c
++
)
if
(
strcmp
(
c
->
name
,
cmdname
)
==
0
)
if
(
STREQ
(
c
->
name
,
cmdname
)
)
return
c
;
return
NULL
;
}
...
...
@@ -5343,7 +5343,7 @@ vshCommandOpt(vshCmd * cmd, const char *name)
vshCmdOpt
*
opt
=
cmd
->
opts
;
while
(
opt
)
{
if
(
opt
->
def
&&
strcmp
(
opt
->
def
->
name
,
name
)
==
0
)
if
(
opt
->
def
&&
STREQ
(
opt
->
def
->
name
,
name
)
)
return
opt
;
opt
=
opt
->
next
;
}
...
...
@@ -5617,7 +5617,7 @@ vshCommandRun(vshControl * ctl, vshCmd * cmd)
if
(
ctl
->
timing
)
GETTIMEOFDAY
(
&
after
);
if
(
strcmp
(
cmd
->
def
->
name
,
"quit"
)
==
0
)
/* hack ... */
if
(
STREQ
(
cmd
->
def
->
name
,
"quit"
)
)
/* hack ... */
return
ret
;
if
(
ctl
->
timing
)
...
...
@@ -6213,7 +6213,7 @@ vshReadlineCommandGenerator(const char *text, int state)
*/
while
((
name
=
commands
[
list_index
].
name
))
{
list_index
++
;
if
(
strncmp
(
name
,
text
,
len
)
==
0
)
if
(
STREQLEN
(
name
,
text
,
len
)
)
return
vshStrdup
(
NULL
,
name
);
}
...
...
@@ -6262,7 +6262,7 @@ vshReadlineOptionsGenerator(const char *text, int state)
continue
;
if
(
len
>
2
)
{
if
(
strncmp
(
name
,
text
+
2
,
len
-
2
))
if
(
STRNEQLEN
(
name
,
text
+
2
,
len
-
2
))
continue
;
}
res
=
vshMalloc
(
NULL
,
strlen
(
name
)
+
3
);
...
...
@@ -6435,7 +6435,7 @@ vshParseArgv(vshControl * ctl, int argc, char **argv)
if
(
sz
==
2
&&
*
(
last
+
1
)
==
o
->
val
)
/* valid virsh short option */
valid
=
TRUE
;
else
if
(
sz
>
2
&&
strcmp
(
o
->
name
,
last
+
2
)
==
0
)
else
if
(
sz
>
2
&&
STREQ
(
o
->
name
,
last
+
2
)
)
/* valid virsh long option */
valid
=
TRUE
;
}
...
...
src/xen_unified.c
浏览文件 @
1d73398e
...
...
@@ -245,8 +245,8 @@ xenUnifiedOpen (virConnectPtr conn, xmlURIPtr uri, virConnectAuthPtr auth, int f
/* Refuse any scheme which isn't "xen://" or "http://". */
if
(
uri
->
scheme
&&
strcasecmp
(
uri
->
scheme
,
"xen"
)
!=
0
&&
strcasecmp
(
uri
->
scheme
,
"http"
)
!=
0
)
STRCASENEQ
(
uri
->
scheme
,
"xen"
)
&&
STRCASENEQ
(
uri
->
scheme
,
"http"
)
)
return
VIR_DRV_OPEN_DECLINED
;
/* xmlParseURI will parse a naked string like "foo" as a URI with
...
...
@@ -258,7 +258,7 @@ xenUnifiedOpen (virConnectPtr conn, xmlURIPtr uri, virConnectAuthPtr auth, int f
return
VIR_DRV_OPEN_DECLINED
;
/* Refuse any xen:// URI with a server specified - allow remote to do it */
if
(
uri
->
scheme
&&
strcasecmp
(
uri
->
scheme
,
"xen"
)
==
0
&&
uri
->
server
)
if
(
uri
->
scheme
&&
STRCASEEQ
(
uri
->
scheme
,
"xen"
)
&&
uri
->
server
)
return
VIR_DRV_OPEN_DECLINED
;
/* Allocate per-connection private data. */
...
...
src/xend_internal.c
浏览文件 @
1d73398e
...
...
@@ -403,7 +403,7 @@ sreads(virConnectPtr xend, int fd, char *buffer, size_t n_buffer)
static
int
istartswith
(
const
char
*
haystack
,
const
char
*
needle
)
{
return
(
strncasecmp
(
haystack
,
needle
,
strlen
(
needle
))
==
0
);
return
STRCASEEQLEN
(
haystack
,
needle
,
strlen
(
needle
)
);
}
...
...
@@ -426,7 +426,7 @@ xend_req(virConnectPtr xend, int fd, char *content, size_t n_content)
int
retcode
=
0
;
while
(
sreads
(
xend
,
fd
,
buffer
,
sizeof
(
buffer
))
>
0
)
{
if
(
strcmp
(
buffer
,
"
\r\n
"
)
==
0
)
if
(
STREQ
(
buffer
,
"
\r\n
"
)
)
break
;
if
(
istartswith
(
buffer
,
"Content-Length: "
))
...
...
@@ -487,7 +487,7 @@ xend_get(virConnectPtr xend, const char *path,
close
(
s
);
if
(((
ret
<
0
)
||
(
ret
>=
300
))
&&
((
ret
!=
404
)
||
(
strncmp
(
path
,
"/xend/domain/"
,
13
))))
{
((
ret
!=
404
)
||
(
STRNEQLEN
(
path
,
"/xend/domain/"
,
13
))))
{
virXendError
(
xend
,
VIR_ERR_GET_FAILED
,
content
);
}
...
...
@@ -1882,7 +1882,7 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root,
/* There is a case without the uname to the CD-ROM device */
offset
=
strchr
(
dst
,
':'
);
if
(
offset
)
{
if
(
hvm
&&
!
strcmp
(
offset
,
":cdrom"
))
{
if
(
hvm
&&
STREQ
(
offset
,
":cdrom"
))
{
isNoSrcCdrom
=
1
;
}
offset
[
0
]
=
'\0'
;
...
...
@@ -1913,7 +1913,7 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root,
src
=
offset
+
1
;
if
(
!
strcmp
(
drvName
,
"tap"
))
{
if
(
STREQ
(
drvName
,
"tap"
))
{
offset
=
strchr
(
src
,
':'
);
if
(
!
offset
)
{
virXendError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
...
...
@@ -1936,23 +1936,23 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root,
omnipotent, we can revisit this, perhaps stat()'ing
the src file in question */
isBlock
=
0
;
}
else
if
(
!
strcmp
(
drvName
,
"phy"
))
{
}
else
if
(
STREQ
(
drvName
,
"phy"
))
{
isBlock
=
1
;
}
else
if
(
!
strcmp
(
drvName
,
"file"
))
{
}
else
if
(
STREQ
(
drvName
,
"file"
))
{
isBlock
=
0
;
}
}
if
(
!
strncmp
(
dst
,
"ioemu:"
,
6
))
if
(
STREQLEN
(
dst
,
"ioemu:"
,
6
))
dst
+=
6
;
/* New style disk config from Xen >= 3.0.3 */
if
(
xendConfigVersion
>
1
)
{
offset
=
strrchr
(
dst
,
':'
);
if
(
offset
)
{
if
(
!
strcmp
(
offset
,
":cdrom"
))
{
if
(
STREQ
(
offset
,
":cdrom"
))
{
cdrom
=
1
;
}
else
if
(
!
strcmp
(
offset
,
":disk"
))
{
}
else
if
(
STREQ
(
offset
,
":disk"
))
{
/* The default anyway */
}
else
{
/* Unknown, lets pretend its a disk too */
...
...
@@ -1993,9 +1993,9 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root,
/* XXX should we force mode == r, if cdrom==1, or assume
xend has already done this ? */
if
((
mode
!=
NULL
)
&&
(
!
strcmp
(
mode
,
"r"
)))
if
((
mode
!=
NULL
)
&&
(
STREQ
(
mode
,
"r"
)))
virBufferAddLit
(
&
buf
,
" <readonly/>
\n
"
);
else
if
((
mode
!=
NULL
)
&&
(
!
strcmp
(
mode
,
"w!"
)))
else
if
((
mode
!=
NULL
)
&&
(
STREQ
(
mode
,
"w!"
)))
virBufferAddLit
(
&
buf
,
" <shareable/>
\n
"
);
virBufferAddLit
(
&
buf
,
" </disk>
\n
"
);
...
...
@@ -2046,11 +2046,11 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root,
* or for HVM guests in >= 3.0.5 */
tmp
=
sexpr_node
(
node
,
"device/vfb/type"
);
if
(
tmp
&&
!
strcmp
(
tmp
,
"sdl"
))
{
if
(
tmp
&&
STREQ
(
tmp
,
"sdl"
))
{
vfb
=
1
;
virBufferVSprintf
(
&
buf
,
" <input type='mouse' bus='%s'/>
\n
"
,
hvm
?
"ps2"
:
"xen"
);
virBufferAddLit
(
&
buf
,
" <graphics type='sdl'/>
\n
"
);
}
else
if
(
tmp
&&
!
strcmp
(
tmp
,
"vnc"
))
{
}
else
if
(
tmp
&&
STREQ
(
tmp
,
"vnc"
))
{
int
port
=
xenStoreDomainGetVNCPort
(
conn
,
domid
);
const
char
*
listenAddr
=
sexpr_node
(
node
,
"device/vfb/vnclisten"
);
const
char
*
vncPasswd
=
NULL
;
...
...
@@ -2109,9 +2109,9 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root,
if
(
sexpr_lookup
(
node
,
"usbdevice"
))
{
tmp
=
sexpr_node
(
node
,
"usbdevice"
);
if
(
tmp
&&
*
tmp
)
{
if
(
!
strcmp
(
tmp
,
"tablet"
))
if
(
STREQ
(
tmp
,
"tablet"
))
virBufferAddLit
(
&
buf
,
" <input type='tablet' bus='usb'/>
\n
"
);
else
if
(
!
strcmp
(
tmp
,
"mouse"
))
else
if
(
STREQ
(
tmp
,
"mouse"
))
virBufferAddLit
(
&
buf
,
" <input type='mouse' bus='usb'/>
\n
"
);
}
}
...
...
@@ -2399,7 +2399,7 @@ sexpr_to_xend_topology(virConnectPtr conn,
goto
parse_error
;
cur
++
;
virSkipSpaces
(
&
cur
);
if
(
!
strncmp
(
cur
,
"no cpus"
,
7
))
{
if
(
STREQLEN
(
cur
,
"no cpus"
,
7
))
{
nb_cpus
=
0
;
for
(
cpu
=
0
;
cpu
<
numCpus
;
cpu
++
)
cpuset
[
cpu
]
=
0
;
...
...
@@ -3460,7 +3460,7 @@ xenDaemonDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
for
(
s
=
root
;
s
->
kind
==
SEXPR_CONS
;
s
=
s
->
u
.
s
.
cdr
)
{
if
((
s
->
u
.
s
.
car
->
kind
==
SEXPR_CONS
)
&&
(
s
->
u
.
s
.
car
->
u
.
s
.
car
->
kind
==
SEXPR_VALUE
)
&&
!
strcmp
(
s
->
u
.
s
.
car
->
u
.
s
.
car
->
u
.
value
,
"vcpu"
))
{
STREQ
(
s
->
u
.
s
.
car
->
u
.
s
.
car
->
u
.
value
,
"vcpu"
))
{
t
=
s
->
u
.
s
.
car
;
vcpu
=
ipt
->
number
=
sexpr_int
(
t
,
"vcpu/number"
);
if
((
oln
=
sexpr_int
(
t
,
"vcpu/online"
))
!=
0
)
{
...
...
@@ -3481,7 +3481,7 @@ xenDaemonDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
for
(
t
=
t
->
u
.
s
.
cdr
;
t
->
kind
==
SEXPR_CONS
;
t
=
t
->
u
.
s
.
cdr
)
if
((
t
->
u
.
s
.
car
->
kind
==
SEXPR_CONS
)
&&
(
t
->
u
.
s
.
car
->
u
.
s
.
car
->
kind
==
SEXPR_VALUE
)
&&
!
strcmp
(
t
->
u
.
s
.
car
->
u
.
s
.
car
->
u
.
value
,
"cpumap"
)
&&
STREQ
(
t
->
u
.
s
.
car
->
u
.
s
.
car
->
u
.
value
,
"cpumap"
)
&&
(
t
->
u
.
s
.
car
->
u
.
s
.
cdr
->
kind
==
SEXPR_CONS
))
{
for
(
t
=
t
->
u
.
s
.
car
->
u
.
s
.
cdr
->
u
.
s
.
car
;
t
->
kind
==
SEXPR_CONS
;
t
=
t
->
u
.
s
.
cdr
)
if
(
t
->
u
.
s
.
car
->
kind
==
SEXPR_VALUE
...
...
@@ -3677,7 +3677,7 @@ xenDaemonAttachDevice(virDomainPtr domain, const char *xml)
return
(
-
1
);
str
=
virDomainGetOSType
(
domain
);
if
(
strcmp
(
str
,
"linux
"
))
if
(
STREQ
(
str
,
"hvm
"
))
hvm
=
1
;
free
(
str
);
sexpr
=
virParseXMLDevice
(
domain
->
conn
,
xml
,
hvm
,
priv
->
xendConfigVersion
);
...
...
src/xm_internal.c
浏览文件 @
1d73398e
...
...
@@ -304,7 +304,7 @@ static int xenXMConfigReaper(const void *payload, const char *key ATTRIBUTE_UNUS
is currently mapped as owner of a named domain. */
if
(
xenXMConfigGetString
(
entry
->
conf
,
"name"
,
&
olddomname
)
!=
-
1
)
{
char
*
nameowner
=
(
char
*
)
virHashLookup
(
nameConfigMap
,
olddomname
);
if
(
nameowner
&&
!
strcmp
(
nameowner
,
key
))
{
if
(
nameowner
&&
STREQ
(
nameowner
,
key
))
{
virHashRemoveEntry
(
nameConfigMap
,
olddomname
,
NULL
);
}
}
...
...
@@ -353,19 +353,19 @@ static int xenXMConfigCacheRefresh (virConnectPtr conn) {
*/
/* Like 'dot' files... */
if
(
!
strncmp
(
ent
->
d_name
,
"."
,
1
))
if
(
STREQLEN
(
ent
->
d_name
,
"."
,
1
))
continue
;
/* ...and the XenD server config file */
if
(
!
strncmp
(
ent
->
d_name
,
XEND_CONFIG_FILE
,
strlen
(
XEND_CONFIG_FILE
)))
if
(
STREQLEN
(
ent
->
d_name
,
XEND_CONFIG_FILE
,
strlen
(
XEND_CONFIG_FILE
)))
continue
;
/* ...and random PCI config cruft */
if
(
!
strncmp
(
ent
->
d_name
,
XEND_PCI_CONFIG_PREFIX
,
strlen
(
XEND_PCI_CONFIG_PREFIX
)))
if
(
STREQLEN
(
ent
->
d_name
,
XEND_PCI_CONFIG_PREFIX
,
strlen
(
XEND_PCI_CONFIG_PREFIX
)))
continue
;
/* ...and the example domain configs */
if
(
!
strncmp
(
ent
->
d_name
,
XM_EXAMPLE_PREFIX
,
strlen
(
XM_EXAMPLE_PREFIX
)))
if
(
STREQLEN
(
ent
->
d_name
,
XM_EXAMPLE_PREFIX
,
strlen
(
XM_EXAMPLE_PREFIX
)))
continue
;
/* ...and the QEMU networking script */
if
(
!
strncmp
(
ent
->
d_name
,
QEMU_IF_SCRIPT
,
strlen
(
QEMU_IF_SCRIPT
)))
if
(
STREQLEN
(
ent
->
d_name
,
QEMU_IF_SCRIPT
,
strlen
(
QEMU_IF_SCRIPT
)))
continue
;
/* ...and editor backups */
...
...
@@ -401,7 +401,7 @@ static int xenXMConfigCacheRefresh (virConnectPtr conn) {
re-acquire it later - just in case it was renamed */
if
(
xenXMConfigGetString
(
entry
->
conf
,
"name"
,
&
olddomname
)
!=
-
1
)
{
char
*
nameowner
=
(
char
*
)
virHashLookup
(
nameConfigMap
,
olddomname
);
if
(
nameowner
&&
!
strcmp
(
nameowner
,
path
))
{
if
(
nameowner
&&
STREQ
(
nameowner
,
path
))
{
virHashRemoveEntry
(
nameConfigMap
,
olddomname
,
NULL
);
}
}
...
...
@@ -607,7 +607,7 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
virBufferVSprintf
(
&
buf
,
" <uuid>%s</uuid>
\n
"
,
uuidstr
);
if
((
xenXMConfigGetString
(
conf
,
"builder"
,
&
str
)
==
0
)
&&
!
strcmp
(
str
,
"hvm"
))
STREQ
(
str
,
"hvm"
))
hvm
=
1
;
if
(
hvm
)
{
...
...
@@ -778,7 +778,7 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
}
/* And the source driver sub-type */
if
(
!
strncmp
(
drvName
,
"tap"
,
3
))
{
if
(
STREQLEN
(
drvName
,
"tap"
,
3
))
{
if
(
!
(
tmp1
=
strchr
(
tmp
+
1
,
':'
))
||
!
tmp1
[
0
])
goto
skipdisk
;
strncpy
(
drvType
,
tmp
+
1
,
(
tmp1
-
(
tmp
+
1
)));
...
...
@@ -790,18 +790,18 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
}
/* phy: type indicates a block device */
if
(
!
strcmp
(
drvName
,
"phy"
))
{
if
(
STREQ
(
drvName
,
"phy"
))
{
block
=
1
;
}
/* Remove legacy ioemu: junk */
if
(
!
strncmp
(
dev
,
"ioemu:"
,
6
))
{
if
(
STREQLEN
(
dev
,
"ioemu:"
,
6
))
{
memmove
(
dev
,
dev
+
6
,
strlen
(
dev
)
-
5
);
}
/* Check for a :cdrom/:disk postfix */
if
((
tmp
=
strchr
(
dev
,
':'
))
!=
NULL
)
{
if
(
!
strcmp
(
tmp
,
":cdrom"
))
if
(
STREQ
(
tmp
,
":cdrom"
))
cdrom
=
1
;
tmp
[
0
]
=
'\0'
;
}
...
...
@@ -824,11 +824,11 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
if
(
src
[
0
])
virBufferVSprintf
(
&
buf
,
" <source %s='%s'/>
\n
"
,
block
?
"dev"
:
"file"
,
src
);
virBufferVSprintf
(
&
buf
,
" <target dev='%s' bus='%s'/>
\n
"
,
dev
,
bus
);
if
(
!
strcmp
(
head
,
"r"
)
||
!
strcmp
(
head
,
"ro"
))
if
(
STREQ
(
head
,
"r"
)
||
STREQ
(
head
,
"ro"
))
virBufferAddLit
(
&
buf
,
" <readonly/>
\n
"
);
else
if
((
!
strcmp
(
head
,
"w!"
))
||
(
!
strcmp
(
head
,
"!"
)))
else
if
((
STREQ
(
head
,
"w!"
))
||
(
STREQ
(
head
,
"!"
)))
virBufferAddLit
(
&
buf
,
" <shareable/>
\n
"
);
virBufferAddLit
(
&
buf
,
" </disk>
\n
"
);
...
...
@@ -878,32 +878,32 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
goto
skipnic
;
data
++
;
if
(
!
strncmp
(
key
,
"mac="
,
4
))
{
if
(
STRPREFIX
(
key
,
"mac="
))
{
int
len
=
nextkey
?
(
nextkey
-
data
)
:
17
;
if
(
len
>
17
)
len
=
17
;
strncpy
(
mac
,
data
,
len
);
mac
[
len
]
=
'\0'
;
}
else
if
(
!
strncmp
(
key
,
"bridge="
,
7
))
{
}
else
if
(
STRPREFIX
(
key
,
"bridge="
))
{
int
len
=
nextkey
?
(
nextkey
-
data
)
:
sizeof
(
bridge
)
-
1
;
type
=
1
;
if
(
len
>
(
sizeof
(
bridge
)
-
1
))
len
=
sizeof
(
bridge
)
-
1
;
strncpy
(
bridge
,
data
,
len
);
bridge
[
len
]
=
'\0'
;
}
else
if
(
!
strncmp
(
key
,
"script="
,
7
))
{
}
else
if
(
STRPREFIX
(
key
,
"script="
))
{
int
len
=
nextkey
?
(
nextkey
-
data
)
:
PATH_MAX
-
1
;
if
(
len
>
(
PATH_MAX
-
1
))
len
=
PATH_MAX
-
1
;
strncpy
(
script
,
data
,
len
);
script
[
len
]
=
'\0'
;
}
else
if
(
!
strncmp
(
key
,
"model="
,
6
))
{
}
else
if
(
STRPREFIX
(
key
,
"model="
))
{
int
len
=
nextkey
?
(
nextkey
-
data
)
:
sizeof
(
model
)
-
1
;
if
(
len
>
(
sizeof
(
model
)
-
1
))
len
=
sizeof
(
model
)
-
1
;
strncpy
(
model
,
data
,
len
);
model
[
len
]
=
'\0'
;
}
else
if
(
!
strncmp
(
key
,
"ip="
,
3
))
{
}
else
if
(
STRPREFIX
(
key
,
"ip="
))
{
int
len
=
nextkey
?
(
nextkey
-
data
)
:
15
;
if
(
len
>
15
)
len
=
15
;
...
...
@@ -943,9 +943,9 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
if
(
hvm
)
{
if
(
xenXMConfigGetString
(
conf
,
"usbdevice"
,
&
str
)
==
0
&&
str
)
{
if
(
!
strcmp
(
str
,
"tablet"
))
if
(
STREQ
(
str
,
"tablet"
))
virBufferAddLit
(
&
buf
,
" <input type='tablet' bus='usb'/>
\n
"
);
else
if
(
!
strcmp
(
str
,
"mouse"
))
else
if
(
STREQ
(
str
,
"mouse"
))
virBufferAddLit
(
&
buf
,
" <input type='mouse' bus='usb'/>
\n
"
);
/* Ignore else branch - probably some other non-input device we don't
support in libvirt yet */
...
...
@@ -993,19 +993,19 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
break
;
data
++
;
if
(
!
strncmp
(
key
,
"type=sdl"
,
8
))
{
if
(
STRPREFIX
(
key
,
"type=sdl"
))
{
sdl
=
1
;
}
else
if
(
!
strncmp
(
key
,
"type=vnc"
,
8
))
{
}
else
if
(
STRPREFIX
(
key
,
"type=vnc"
))
{
vnc
=
1
;
}
else
if
(
!
strncmp
(
key
,
"vncunused="
,
10
))
{
}
else
if
(
STRPREFIX
(
key
,
"vncunused="
))
{
vncunused
=
strtol
(
key
+
10
,
NULL
,
10
);
}
else
if
(
!
strncmp
(
key
,
"vnclisten="
,
10
))
{
}
else
if
(
STRPREFIX
(
key
,
"vnclisten="
))
{
vnclisten
=
key
+
10
;
}
else
if
(
!
strncmp
(
key
,
"vncpasswd="
,
10
))
{
}
else
if
(
STRPREFIX
(
key
,
"vncpasswd="
))
{
vncpasswd
=
key
+
10
;
}
else
if
(
!
strncmp
(
key
,
"keymap="
,
7
))
{
}
else
if
(
STRPREFIX
(
key
,
"keymap="
))
{
keymap
=
key
+
7
;
}
else
if
(
!
strncmp
(
key
,
"vncdisplay="
,
11
))
{
}
else
if
(
STRPREFIX
(
key
,
"vncdisplay="
))
{
vncdisplay
=
strtol
(
key
+
11
,
NULL
,
10
);
}
...
...
@@ -1682,7 +1682,7 @@ static int xenXMParseXMLDisk(xmlNodePtr node, int hvm, int xendConfigVersion, ch
}
else
if
((
drvName
==
NULL
)
&&
(
xmlStrEqual
(
cur
->
name
,
BAD_CAST
"driver"
)))
{
drvName
=
xmlGetProp
(
cur
,
BAD_CAST
"name"
);
if
(
drvName
&&
!
strcmp
((
const
char
*
)
drvName
,
"tap"
))
if
(
drvName
&&
STREQ
((
const
char
*
)
drvName
,
"tap"
))
drvType
=
xmlGetProp
(
cur
,
BAD_CAST
"type"
);
}
else
if
(
xmlStrEqual
(
cur
->
name
,
BAD_CAST
"readonly"
))
{
readonly
=
1
;
...
...
@@ -1704,7 +1704,7 @@ static int xenXMParseXMLDisk(xmlNodePtr node, int hvm, int xendConfigVersion, ch
*/
if
(
hvm
&&
device
&&
!
strcmp
((
const
char
*
)
device
,
"floppy"
))
{
STREQ
((
const
char
*
)
device
,
"floppy"
))
{
ret
=
0
;
goto
cleanup
;
}
...
...
@@ -1712,7 +1712,7 @@ static int xenXMParseXMLDisk(xmlNodePtr node, int hvm, int xendConfigVersion, ch
/* Xend <= 3.0.2 doesn't include cdrom config here */
if
(
hvm
&&
device
&&
!
strcmp
((
const
char
*
)
device
,
"cdrom"
))
{
STREQ
((
const
char
*
)
device
,
"cdrom"
))
{
if
(
xendConfigVersion
==
1
)
{
ret
=
0
;
goto
cleanup
;
...
...
@@ -1729,7 +1729,7 @@ static int xenXMParseXMLDisk(xmlNodePtr node, int hvm, int xendConfigVersion, ch
if
(
drvName
)
{
buflen
+=
strlen
((
const
char
*
)
drvName
)
+
1
;
if
(
!
strcmp
((
const
char
*
)
drvName
,
"tap"
))
{
if
(
STREQ
((
const
char
*
)
drvName
,
"tap"
))
{
if
(
drvType
)
buflen
+=
strlen
((
const
char
*
)
drvType
)
+
1
;
else
...
...
@@ -1761,7 +1761,7 @@ static int xenXMParseXMLDisk(xmlNodePtr node, int hvm, int xendConfigVersion, ch
if
(
source
)
{
if
(
drvName
)
{
strcpy
(
buf
,
(
const
char
*
)
drvName
);
if
(
!
strcmp
((
const
char
*
)
drvName
,
"tap"
))
{
if
(
STREQ
((
const
char
*
)
drvName
,
"tap"
))
{
strcat
(
buf
,
":"
);
if
(
drvType
)
strcat
(
buf
,
(
const
char
*
)
drvType
);
...
...
@@ -2024,7 +2024,7 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
obj
=
xmlXPathEval
(
BAD_CAST
"string(/domain/os/type)"
,
ctxt
);
if
((
obj
!=
NULL
)
&&
(
obj
->
type
==
XPATH_STRING
)
&&
(
obj
->
stringval
!=
NULL
)
&&
!
strcmp
((
char
*
)
obj
->
stringval
,
"hvm"
))
(
obj
->
stringval
!=
NULL
)
&&
STREQ
((
char
*
)
obj
->
stringval
,
"hvm"
))
hvm
=
1
;
xmlXPathFreeObject
(
obj
);
...
...
@@ -2043,11 +2043,11 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
obj
=
xmlXPathEval
(
BAD_CAST
"string(/domain/os/boot/@dev)"
,
ctxt
);
if
((
obj
!=
NULL
)
&&
(
obj
->
type
==
XPATH_STRING
)
&&
(
obj
->
stringval
!=
NULL
))
{
if
(
!
strcmp
((
const
char
*
)
obj
->
stringval
,
"fd"
))
if
(
STREQ
((
const
char
*
)
obj
->
stringval
,
"fd"
))
boot
=
"a"
;
else
if
(
!
strcmp
((
const
char
*
)
obj
->
stringval
,
"hd"
))
else
if
(
STREQ
((
const
char
*
)
obj
->
stringval
,
"hd"
))
boot
=
"c"
;
else
if
(
!
strcmp
((
const
char
*
)
obj
->
stringval
,
"cdrom"
))
else
if
(
STREQ
((
const
char
*
)
obj
->
stringval
,
"cdrom"
))
boot
=
"d"
;
}
xmlXPathFreeObject
(
obj
);
...
...
@@ -2069,7 +2069,7 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
obj
=
xmlXPathEval
(
BAD_CAST
"string(/domain/clock/@offset)"
,
ctxt
);
if
((
obj
!=
NULL
)
&&
(
obj
->
type
==
XPATH_STRING
)
&&
(
obj
->
stringval
!=
NULL
))
{
if
(
!
strcmp
((
const
char
*
)
obj
->
stringval
,
"localtime"
))
if
(
STREQ
((
const
char
*
)
obj
->
stringval
,
"localtime"
))
clockLocal
=
1
;
}
xmlXPathFreeObject
(
obj
);
...
...
@@ -2173,15 +2173,15 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
if
(
!
(
type
=
xmlGetProp
(
obj
->
nodesetval
->
nodeTab
[
i
],
BAD_CAST
"type"
)))
{
continue
;
}
if
(
!
strcmp
((
const
char
*
)
type
,
"sdl"
))
{
if
(
STREQ
((
const
char
*
)
type
,
"sdl"
))
{
val
=
strdup
(
"type=sdl"
);
}
else
if
(
!
strcmp
((
const
char
*
)
type
,
"vnc"
))
{
}
else
if
(
STREQ
((
const
char
*
)
type
,
"vnc"
))
{
int
len
=
8
+
1
;
/* type=vnc & NULL */
xmlChar
*
vncport
=
xmlGetProp
(
obj
->
nodesetval
->
nodeTab
[
i
],
BAD_CAST
"port"
);
xmlChar
*
vnclisten
=
xmlGetProp
(
obj
->
nodesetval
->
nodeTab
[
i
],
BAD_CAST
"listen"
);
xmlChar
*
vncpasswd
=
xmlGetProp
(
obj
->
nodesetval
->
nodeTab
[
i
],
BAD_CAST
"passwd"
);
xmlChar
*
keymap
=
xmlGetProp
(
obj
->
nodesetval
->
nodeTab
[
i
],
BAD_CAST
"keymap"
);
int
vncunused
=
vncport
?
(
!
strcmp
((
const
char
*
)
vncport
,
"-1"
)
?
1
:
0
)
:
1
;
int
vncunused
=
vncport
?
(
STREQ
((
const
char
*
)
vncport
,
"-1"
)
?
1
:
0
)
:
1
;
if
(
vncunused
)
len
+=
12
;
else
...
...
@@ -2743,9 +2743,9 @@ xenXMAttachDisk(virDomainPtr domain, xmlXPathContextPtr ctxt, int hvm,
xenXMError
(
domain
->
conn
,
VIR_ERR_XML_ERROR
,
XM_XML_ERROR
);
goto
cleanup
;
}
if
(
!
strcmp
((
const
char
*
)
type
,
"block"
))
if
(
STREQ
((
const
char
*
)
type
,
"block"
))
source
=
xmlGetProp
(
node
,
BAD_CAST
"dev"
);
else
if
(
!
strcmp
((
const
char
*
)
type
,
"file"
))
else
if
(
STREQ
((
const
char
*
)
type
,
"file"
))
source
=
xmlGetProp
(
node
,
BAD_CAST
"file"
);
else
{
xenXMError
(
domain
->
conn
,
VIR_ERR_XML_ERROR
,
XM_XML_ERROR
);
...
...
@@ -2788,7 +2788,7 @@ xenXMAttachDisk(virDomainPtr domain, xmlXPathContextPtr ctxt, int hvm,
head
=
offset
+
1
;
/* Remove legacy ioemu: junk */
if
(
!
strncmp
(
domdev
,
"ioemu:"
,
6
))
{
if
(
STRPREFIX
(
domdev
,
"ioemu:"
))
{
memmove
(
domdev
,
domdev
+
6
,
strlen
(
domdev
)
-
5
);
}
...
...
@@ -2796,7 +2796,7 @@ xenXMAttachDisk(virDomainPtr domain, xmlXPathContextPtr ctxt, int hvm,
if
((
tmp
=
strchr
(
domdev
,
':'
)))
tmp
[
0
]
=
'\0'
;
if
(
!
(
strcmp
(
domdev
,
(
const
char
*
)
target
)
))
if
(
STREQ
(
domdev
,
(
const
char
*
)
target
))
break
;
skip:
prev
=
list_val
;
...
...
@@ -2895,7 +2895,7 @@ xenXMAttachInterface(virDomainPtr domain, xmlXPathContextPtr ctxt, int hvm,
goto
skip
;
data
++
;
if
(
!
strncmp
(
key
,
"mac="
,
4
))
{
if
(
STRPREFIX
(
key
,
"mac="
))
{
int
len
=
nextkey
?
(
nextkey
-
data
)
:
17
;
if
(
len
>
17
)
len
=
17
;
...
...
@@ -3114,7 +3114,7 @@ xenXMDomainDetachDevice(virDomainPtr domain, const char *xml) {
else
if
(
list_ptr
&&
list_ptr
->
type
==
VIR_CONF_LIST
)
{
list_val
=
list_ptr
->
list
;
while
(
list_val
)
{
if
(
!
(
strcmp
(
device
,
"disk"
)
))
{
if
(
STREQ
(
device
,
"disk"
))
{
char
domdev
[
NAME_MAX
];
char
*
head
;
char
*
offset
;
...
...
@@ -3141,7 +3141,7 @@ xenXMDomainDetachDevice(virDomainPtr domain, const char *xml) {
head
=
offset
+
1
;
/* Remove legacy ioemu: junk */
if
(
!
strncmp
(
domdev
,
"ioemu:"
,
6
))
{
if
(
STRPREFIX
(
domdev
,
"ioemu:"
))
{
memmove
(
domdev
,
domdev
+
6
,
strlen
(
domdev
)
-
5
);
}
...
...
@@ -3149,7 +3149,7 @@ xenXMDomainDetachDevice(virDomainPtr domain, const char *xml) {
if
((
tmp
=
strchr
(
domdev
,
':'
)))
tmp
[
0
]
=
'\0'
;
if
(
!
(
strcmp
(
domdev
,
(
const
char
*
)
key
)
))
if
(
STREQ
(
domdev
,
(
const
char
*
)
key
))
break
;
}
else
{
char
dommac
[
18
];
...
...
@@ -3169,7 +3169,7 @@ xenXMDomainDetachDevice(virDomainPtr domain, const char *xml) {
goto
skip
;
data
++
;
if
(
!
strncmp
(
mac
,
"mac="
,
4
))
{
if
(
STRPREFIX
(
mac
,
"mac="
))
{
int
len
=
nextmac
?
(
nextmac
-
data
)
:
17
;
if
(
len
>
17
)
len
=
17
;
...
...
src/xml.c
浏览文件 @
1d73398e
...
...
@@ -1083,9 +1083,9 @@ virDomainParseXMLOSDescHVM(virConnectPtr conn, xmlNodePtr node,
if
(
!
itype
)
{
goto
error
;
}
if
(
!
strcmp
((
const
char
*
)
itype
,
"tablet"
))
if
(
STREQ
((
const
char
*
)
itype
,
"tablet"
))
isMouse
=
0
;
else
if
(
strcmp
((
const
char
*
)
itype
,
"mouse"
))
{
else
if
(
STRNEQ
((
const
char
*
)
itype
,
"mouse"
))
{
xmlFree
(
itype
);
virXMLError
(
conn
,
VIR_ERR_XML_ERROR
,
_
(
"invalid input device"
),
0
);
...
...
@@ -1101,7 +1101,7 @@ virDomainParseXMLOSDescHVM(virConnectPtr conn, xmlNodePtr node,
virBufferAddLit
(
buf
,
"(usbdevice tablet)"
);
}
}
else
{
if
(
!
strcmp
((
const
char
*
)
bus
,
"ps2"
))
{
if
(
STREQ
((
const
char
*
)
bus
,
"ps2"
))
{
if
(
!
isMouse
)
{
xmlFree
(
bus
);
virXMLError
(
conn
,
VIR_ERR_XML_ERROR
,
...
...
@@ -1109,7 +1109,7 @@ virDomainParseXMLOSDescHVM(virConnectPtr conn, xmlNodePtr node,
goto
error
;
}
/* Nothing - implicit ps2 */
}
else
if
(
!
strcmp
((
const
char
*
)
bus
,
"usb"
))
{
}
else
if
(
STREQ
((
const
char
*
)
bus
,
"usb"
))
{
if
(
isMouse
)
virBufferAddLit
(
buf
,
"(usbdevice mouse)"
);
else
...
...
@@ -1320,7 +1320,7 @@ virDomainParseXMLDiskDesc(virConnectPtr conn, xmlNodePtr node,
}
else
if
((
drvName
==
NULL
)
&&
(
xmlStrEqual
(
cur
->
name
,
BAD_CAST
"driver"
)))
{
drvName
=
xmlGetProp
(
cur
,
BAD_CAST
"name"
);
if
(
drvName
&&
!
strcmp
((
const
char
*
)
drvName
,
"tap"
))
if
(
drvName
&&
STREQ
((
const
char
*
)
drvName
,
"tap"
))
drvType
=
xmlGetProp
(
cur
,
BAD_CAST
"type"
);
}
else
if
(
xmlStrEqual
(
cur
->
name
,
BAD_CAST
"readonly"
))
{
ro
=
1
;
...
...
@@ -1335,7 +1335,7 @@ virDomainParseXMLDiskDesc(virConnectPtr conn, xmlNodePtr node,
/* There is a case without the source
* to the CD-ROM device
*/
if
(
hvm
&&
device
&&
!
strcmp
((
const
char
*
)
device
,
"cdrom"
))
{
if
(
hvm
&&
device
&&
STREQ
((
const
char
*
)
device
,
"cdrom"
))
{
isNoSrcCdrom
=
1
;
}
if
(
!
isNoSrcCdrom
)
{
...
...
@@ -1353,12 +1353,12 @@ virDomainParseXMLDiskDesc(virConnectPtr conn, xmlNodePtr node,
/* Xend (all versions) put the floppy device config
* under the hvm (image (os)) block
*/
if
(
hvm
&&
device
&&
!
strcmp
((
const
char
*
)
device
,
"floppy"
))
{
if
(
hvm
&&
device
&&
STREQ
((
const
char
*
)
device
,
"floppy"
))
{
goto
cleanup
;
}
/* Xend <= 3.0.2 doesn't include cdrom config here */
if
(
hvm
&&
device
&&
!
strcmp
((
const
char
*
)
device
,
"cdrom"
))
{
if
(
hvm
&&
device
&&
STREQ
((
const
char
*
)
device
,
"cdrom"
))
{
if
(
xendConfigVersion
==
1
)
goto
cleanup
;
else
...
...
@@ -1370,7 +1370,7 @@ virDomainParseXMLDiskDesc(virConnectPtr conn, xmlNodePtr node,
/* Normally disks are in a (device (vbd ...)) block
* but blktap disks ended up in a differently named
* (device (tap ....)) block.... */
if
(
drvName
&&
!
strcmp
((
const
char
*
)
drvName
,
"tap"
))
{
if
(
drvName
&&
STREQ
((
const
char
*
)
drvName
,
"tap"
))
{
virBufferAddLit
(
buf
,
"(tap "
);
}
else
{
virBufferAddLit
(
buf
,
"(vbd "
);
...
...
@@ -1380,7 +1380,7 @@ virDomainParseXMLDiskDesc(virConnectPtr conn, xmlNodePtr node,
char
*
tmp
=
(
char
*
)
target
;
/* Just in case user mistakenly still puts ioemu: in their XML */
if
(
!
strncmp
((
const
char
*
)
tmp
,
"ioemu:"
,
6
))
if
(
STRPREFIX
((
const
char
*
)
tmp
,
"ioemu:"
))
tmp
+=
6
;
/* Xend <= 3.0.2 wants a ioemu: prefix on devices for HVM */
...
...
@@ -1393,7 +1393,7 @@ virDomainParseXMLDiskDesc(virConnectPtr conn, xmlNodePtr node,
virBufferVSprintf
(
buf
,
"(dev '%s')"
,
(
const
char
*
)
target
);
if
(
drvName
&&
!
isNoSrcCdrom
)
{
if
(
!
strcmp
((
const
char
*
)
drvName
,
"tap"
))
{
if
(
STREQ
((
const
char
*
)
drvName
,
"tap"
))
{
virBufferVSprintf
(
buf
,
"(uname '%s:%s:%s')"
,
(
const
char
*
)
drvName
,
(
drvType
?
(
const
char
*
)
drvType
:
"aio"
),
...
...
src/xmlrpc.c
浏览文件 @
1d73398e
...
...
@@ -429,7 +429,7 @@ static char *xmlRpcCallRaw(const char *url, const char *request)
goto
error
;
}
if
(
contentType
&&
strcmp
(
contentType
,
"text/xml"
)
!=
0
)
{
if
(
contentType
&&
STRNEQ
(
contentType
,
"text/xml"
)
)
{
errno
=
EINVAL
;
xmlRpcError
(
VIR_ERR_POST_FAILED
,
_
(
"unexpected mime type"
),
0
);
goto
error
;
...
...
tests/virshtest.c
浏览文件 @
1d73398e
...
...
@@ -52,8 +52,10 @@ static int testCompareOutput(const char *expect_rel, const char *filter,
printf
(
"Expect %d '%s'
\n
"
,
(
int
)
strlen
(
expectData
),
expectData
);
printf
(
"Actual %d '%s'
\n
"
,
(
int
)
strlen
(
actualData
),
actualData
);
}
if
(
strcmp
(
expectData
,
actualData
))
return
-
1
;
if
(
STRNEQ
(
expectData
,
actualData
))
{
virtTestDifference
(
stderr
,
expectData
,
actualData
);
return
-
1
;
}
return
0
;
}
...
...
tests/xml2sexprtest.c
浏览文件 @
1d73398e
...
...
@@ -43,7 +43,7 @@ static int testCompareFiles(const char *xml, const char *sexpr,
goto
fail
;
}
if
(
strcmp
(
name
,
gotname
))
{
if
(
STRNEQ
(
name
,
gotname
))
{
printf
(
"Got wrong name: expected %s, got %s
\n
"
,
name
,
gotname
);
goto
fail
;
}
...
...
tests/xmlrpctest.c
浏览文件 @
1d73398e
...
...
@@ -108,7 +108,7 @@ checkRequestValue(const char *xmlstr, const char *xpath, int type, void *expecte
break
;
case
XML_RPC_STRING
:
if
((
obj
->
type
!=
XPATH_STRING
)
||
(
strcmp
((
const
char
*
)
obj
->
stringval
,
(
const
char
*
)
expected
)))
(
STRNEQ
((
const
char
*
)
obj
->
stringval
,
(
const
char
*
)
expected
)))
goto
error
;
break
;
default:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录