Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
2127b42b
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看板
提交
2127b42b
编写于
4月 03, 2010
作者:
M
Matthias Bolte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
proxy: Remove virConnectPtr from virProxyError
上级
a3884f87
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
40 addition
and
52 deletion
+40
-52
src/xen/proxy_internal.c
src/xen/proxy_internal.c
+40
-52
未找到文件。
src/xen/proxy_internal.c
浏览文件 @
2127b42b
...
...
@@ -93,8 +93,8 @@ struct xenUnifiedDriver xenProxyDriver = {
* *
************************************************************************/
#define virProxyError(co
nn, code, ...)
\
virReportErrorHelper(
conn
, VIR_FROM_PROXY, code, __FILE__, \
#define virProxyError(co
de, ...)
\
virReportErrorHelper(
NULL
, VIR_FROM_PROXY, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
/************************************************************************
...
...
@@ -324,13 +324,13 @@ xenProxyClose(virConnectPtr conn)
xenUnifiedPrivatePtr
priv
;
if
(
conn
==
NULL
)
{
virProxyError
(
NULL
,
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
return
-
1
;
}
priv
=
(
xenUnifiedPrivatePtr
)
conn
->
privateData
;
if
(
!
priv
)
{
virProxyError
(
NULL
,
VIR_ERR_INTERNAL_ERROR
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INTERNAL_ERROR
,
__FUNCTION__
);
return
-
1
;
}
...
...
@@ -350,13 +350,13 @@ xenProxyCommand(virConnectPtr conn, virProxyPacketPtr request,
xenUnifiedPrivatePtr
priv
;
if
(
conn
==
NULL
)
{
virProxyError
(
NULL
,
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
return
-
1
;
}
priv
=
(
xenUnifiedPrivatePtr
)
conn
->
privateData
;
if
(
!
priv
)
{
virProxyError
(
NULL
,
VIR_ERR_INTERNAL_ERROR
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INTERNAL_ERROR
,
__FUNCTION__
);
return
-
1
;
}
...
...
@@ -394,14 +394,14 @@ retry:
goto
error
;
}
if
(
ret
!=
sizeof
(
virProxyPacket
))
{
virProxyError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
virProxyError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Communication error with proxy: got %d bytes of %d"
),
ret
,
(
int
)
sizeof
(
virProxyPacket
));
goto
error
;
}
res
=
request
;
if
(
res
->
len
!=
sizeof
(
virProxyPacket
))
{
virProxyError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
virProxyError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Communication error with proxy: expected %d bytes got %d"
),
(
int
)
sizeof
(
virProxyPacket
),
res
->
len
);
goto
error
;
...
...
@@ -417,7 +417,7 @@ retry:
goto
error
;
}
if
(
ret
!=
sizeof
(
virProxyPacket
))
{
virProxyError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
virProxyError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Communication error with proxy: got %d bytes of %d"
),
ret
,
(
int
)
sizeof
(
virProxyPacket
));
goto
error
;
...
...
@@ -425,7 +425,7 @@ retry:
res
=
(
virProxyPacketPtr
)
answer
;
if
((
res
->
len
<
sizeof
(
virProxyPacket
))
||
(
res
->
len
>
sizeof
(
virProxyFullPacket
)))
{
virProxyError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
virProxyError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Communication error with proxy: got %d bytes packet"
),
res
->
len
);
goto
error
;
...
...
@@ -435,7 +435,7 @@ retry:
(
char
*
)
&
(
answer
->
extra
.
arg
[
0
]),
res
->
len
-
ret
);
if
(
ret
!=
(
int
)
(
res
->
len
-
sizeof
(
virProxyPacket
)))
{
virProxyError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
virProxyError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Communication error with proxy: got %d bytes of %d"
),
ret
,
(
int
)
sizeof
(
virProxyPacket
));
goto
error
;
...
...
@@ -447,7 +447,7 @@ retry:
*/
if
((
res
->
version
!=
PROXY_PROTO_VERSION
)
||
(
res
->
len
<
sizeof
(
virProxyPacket
)))
{
virProxyError
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
virProxyError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Communication error with proxy: malformed packet"
));
goto
error
;
}
...
...
@@ -494,7 +494,7 @@ xenProxyOpen(virConnectPtr conn,
fd
=
virProxyOpenClientSocket
(
PROXY_SOCKET_PATH
);
if
(
fd
<
0
)
{
virProxyError
(
NULL
,
VIR_ERR_NO_XEN
,
PROXY_SOCKET_PATH
);
virProxyError
(
VIR_ERR_NO_XEN
,
PROXY_SOCKET_PATH
);
return
(
-
1
);
}
priv
->
proxy
=
fd
;
...
...
@@ -504,7 +504,7 @@ xenProxyOpen(virConnectPtr conn,
req
.
len
=
sizeof
(
req
);
ret
=
xenProxyCommand
(
conn
,
&
req
,
NULL
,
1
);
if
((
ret
<
0
)
||
(
req
.
command
!=
VIR_PROXY_NONE
))
{
virProxyError
(
NULL
,
VIR_ERR_OPERATION_FAILED
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_OPERATION_FAILED
,
__FUNCTION__
);
return
(
-
1
);
}
return
(
0
);
...
...
@@ -534,11 +534,11 @@ xenProxyGetVersion(virConnectPtr conn, unsigned long *hvVer)
int
ret
;
if
(
!
VIR_IS_CONNECT
(
conn
))
{
virProxyError
(
conn
,
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
return
(
-
1
);
}
if
(
hvVer
==
NULL
)
{
virProxyError
(
conn
,
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
return
(
-
1
);
}
memset
(
&
req
,
0
,
sizeof
(
req
));
...
...
@@ -571,11 +571,11 @@ xenProxyListDomains(virConnectPtr conn, int *ids, int maxids)
int
nb
;
if
(
!
VIR_IS_CONNECT
(
conn
))
{
virProxyError
(
conn
,
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
return
(
-
1
);
}
if
((
ids
==
NULL
)
||
(
maxids
<=
0
))
{
virProxyError
(
conn
,
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
return
(
-
1
);
}
memset
(
&
req
,
0
,
sizeof
(
req
));
...
...
@@ -589,7 +589,7 @@ xenProxyListDomains(virConnectPtr conn, int *ids, int maxids)
if
((
nb
>
1020
)
||
(
nb
<=
0
)
||
(
ans
.
len
<=
sizeof
(
virProxyPacket
))
||
(
ans
.
len
>
sizeof
(
virProxyFullPacket
)))
{
virProxyError
(
conn
,
VIR_ERR_OPERATION_FAILED
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_OPERATION_FAILED
,
__FUNCTION__
);
return
(
-
1
);
}
if
(
nb
>
maxids
)
...
...
@@ -614,7 +614,7 @@ xenProxyNumOfDomains(virConnectPtr conn)
int
ret
;
if
(
!
VIR_IS_CONNECT
(
conn
))
{
virProxyError
(
conn
,
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
return
(
-
1
);
}
memset
(
&
req
,
0
,
sizeof
(
req
));
...
...
@@ -644,7 +644,7 @@ xenProxyDomainGetDomMaxMemory(virConnectPtr conn, int id)
int
ret
;
if
(
!
VIR_IS_CONNECT
(
conn
))
{
virProxyError
(
conn
,
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
return
(
0
);
}
memset
(
&
req
,
0
,
sizeof
(
req
));
...
...
@@ -670,10 +670,7 @@ static unsigned long
xenProxyDomainGetMaxMemory
(
virDomainPtr
domain
)
{
if
(
!
VIR_IS_CONNECTED_DOMAIN
(
domain
))
{
if
(
domain
==
NULL
)
virProxyError
(
NULL
,
VIR_ERR_INVALID_DOMAIN
,
__FUNCTION__
);
else
virProxyError
(
domain
->
conn
,
VIR_ERR_INVALID_DOMAIN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_DOMAIN
,
__FUNCTION__
);
return
(
0
);
}
if
(
domain
->
id
<
0
)
...
...
@@ -699,16 +696,13 @@ xenProxyDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
int
ret
;
if
(
!
VIR_IS_CONNECTED_DOMAIN
(
domain
))
{
if
(
domain
==
NULL
)
virProxyError
(
NULL
,
VIR_ERR_INVALID_DOMAIN
,
__FUNCTION__
);
else
virProxyError
(
domain
->
conn
,
VIR_ERR_INVALID_DOMAIN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_DOMAIN
,
__FUNCTION__
);
return
(
-
1
);
}
if
(
domain
->
id
<
0
)
return
(
-
1
);
if
(
info
==
NULL
)
{
virProxyError
(
domain
->
conn
,
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
return
(
-
1
);
}
memset
(
&
req
,
0
,
sizeof
(
req
));
...
...
@@ -720,7 +714,7 @@ xenProxyDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
return
(
-
1
);
}
if
(
ans
.
len
!=
sizeof
(
virProxyPacket
)
+
sizeof
(
virDomainInfo
))
{
virProxyError
(
domain
->
conn
,
VIR_ERR_OPERATION_FAILED
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_OPERATION_FAILED
,
__FUNCTION__
);
return
(
-
1
);
}
memmove
(
info
,
&
ans
.
extra
.
dinfo
,
sizeof
(
virDomainInfo
));
...
...
@@ -748,11 +742,11 @@ xenProxyLookupByID(virConnectPtr conn, int id)
virDomainPtr
res
;
if
(
!
VIR_IS_CONNECT
(
conn
))
{
virProxyError
(
conn
,
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
return
(
NULL
);
}
if
(
id
<
0
)
{
virProxyError
(
conn
,
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
return
(
NULL
);
}
memset
(
&
req
,
0
,
sizeof
(
req
));
...
...
@@ -791,11 +785,11 @@ xenProxyLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
virDomainPtr
res
;
if
(
!
VIR_IS_CONNECT
(
conn
))
{
virProxyError
(
conn
,
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
return
(
NULL
);
}
if
(
uuid
==
NULL
)
{
virProxyError
(
conn
,
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
return
(
NULL
);
}
memset
(
&
req
,
0
,
sizeof
(
virProxyPacket
));
...
...
@@ -833,16 +827,16 @@ xenProxyLookupByName(virConnectPtr conn, const char *name)
virDomainPtr
res
;
if
(
!
VIR_IS_CONNECT
(
conn
))
{
virProxyError
(
conn
,
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
return
(
NULL
);
}
if
(
name
==
NULL
)
{
virProxyError
(
conn
,
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
return
(
NULL
);
}
len
=
strlen
(
name
);
if
(
len
>
1000
)
{
virProxyError
(
conn
,
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
return
(
NULL
);
}
memset
(
&
req
,
0
,
sizeof
(
virProxyPacket
));
...
...
@@ -877,11 +871,11 @@ xenProxyNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) {
int
ret
;
if
(
!
VIR_IS_CONNECT
(
conn
))
{
virProxyError
(
conn
,
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
return
(
-
1
);
}
if
(
info
==
NULL
)
{
virProxyError
(
conn
,
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
return
(
-
1
);
}
memset
(
&
req
,
0
,
sizeof
(
req
));
...
...
@@ -920,7 +914,7 @@ xenProxyGetCapabilities (virConnectPtr conn)
char
*
xml
;
if
(
!
VIR_IS_CONNECT
(
conn
))
{
virProxyError
(
conn
,
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_CONN
,
__FUNCTION__
);
return
NULL
;
}
memset
(
&
req
,
0
,
sizeof
(
req
));
...
...
@@ -935,7 +929,7 @@ xenProxyGetCapabilities (virConnectPtr conn)
return
NULL
;
if
(
ans
.
len
<=
sizeof
(
virProxyPacket
)
||
ans
.
len
>
sizeof
(
ans
)
-
sizeof
(
virProxyPacket
))
{
virProxyError
(
conn
,
VIR_ERR_OPERATION_FAILED
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_OPERATION_FAILED
,
__FUNCTION__
);
return
NULL
;
}
...
...
@@ -969,10 +963,7 @@ xenProxyDomainDumpXML(virDomainPtr domain, int flags ATTRIBUTE_UNUSED)
char
*
xml
;
if
(
!
VIR_IS_CONNECTED_DOMAIN
(
domain
))
{
if
(
domain
==
NULL
)
virProxyError
(
NULL
,
VIR_ERR_INVALID_DOMAIN
,
__FUNCTION__
);
else
virProxyError
(
domain
->
conn
,
VIR_ERR_INVALID_DOMAIN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_DOMAIN
,
__FUNCTION__
);
return
(
NULL
);
}
if
(
domain
->
id
<
0
)
...
...
@@ -987,7 +978,7 @@ xenProxyDomainDumpXML(virDomainPtr domain, int flags ATTRIBUTE_UNUSED)
}
if
(
ans
.
len
<=
sizeof
(
virProxyPacket
)
||
ans
.
len
>
sizeof
(
ans
)
-
sizeof
(
virProxyPacket
))
{
virProxyError
(
domain
->
conn
,
VIR_ERR_OPERATION_FAILED
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_OPERATION_FAILED
,
__FUNCTION__
);
return
(
NULL
);
}
xmllen
=
ans
.
len
-
sizeof
(
virProxyPacket
);
...
...
@@ -1020,10 +1011,7 @@ xenProxyDomainGetOSType(virDomainPtr domain)
char
*
ostype
;
if
(
!
VIR_IS_CONNECTED_DOMAIN
(
domain
))
{
if
(
domain
==
NULL
)
virProxyError
(
NULL
,
VIR_ERR_INVALID_DOMAIN
,
__FUNCTION__
);
else
virProxyError
(
domain
->
conn
,
VIR_ERR_INVALID_DOMAIN
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_INVALID_DOMAIN
,
__FUNCTION__
);
return
(
NULL
);
}
memset
(
&
req
,
0
,
sizeof
(
req
));
...
...
@@ -1043,7 +1031,7 @@ xenProxyDomainGetOSType(virDomainPtr domain)
if
(
ans
.
len
<=
sizeof
(
virProxyPacket
)
||
ans
.
len
>
sizeof
(
ans
)
-
sizeof
(
virProxyPacket
))
{
virProxyError
(
domain
->
conn
,
VIR_ERR_OPERATION_FAILED
,
__FUNCTION__
);
virProxyError
(
VIR_ERR_OPERATION_FAILED
,
__FUNCTION__
);
return
(
NULL
);
}
oslen
=
ans
.
len
-
sizeof
(
virProxyPacket
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录