Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
58b6a5c4
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,发现更多精彩内容 >>
提交
58b6a5c4
编写于
4月 23, 2011
作者:
M
Matthias Bolte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remote generator, client: Handle functions with optional return values
上级
abd05a07
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
152 addition
and
149 deletion
+152
-149
daemon/remote_generator.pl
daemon/remote_generator.pl
+28
-16
src/remote/remote_client_bodies.c
src/remote/remote_client_bodies.c
+124
-5
src/remote/remote_driver.c
src/remote/remote_driver.c
+0
-128
未找到文件。
daemon/remote_generator.pl
浏览文件 @
58b6a5c4
...
...
@@ -476,9 +476,7 @@ elsif ($opt_b) {
push
(
@ret_list
,
"
ret->$1 = $1;
");
$single_ret_var
=
$
1
;
if
(
$calls
{
$_
}
->
{
ProcName
}
eq
"
DomainGetAutostart
"
or
$calls
{
$_
}
->
{
ProcName
}
eq
"
NetworkGetAutostart
"
or
$calls
{
$_
}
->
{
ProcName
}
eq
"
StoragePoolGetAutostart
")
{
if
(
$calls
{
$_
}
->
{
ProcName
}
=~
m/GetAutostart$/
)
{
$single_ret_by_ref
=
1
;
}
else
{
$single_ret_by_ref
=
0
;
...
...
@@ -756,15 +754,12 @@ elsif ($opt_k) {
"
CPUBaseline
",
"
DomainCreate
",
"
DomainDestroy
",
"
DomainGetAutostart
",
"
DomainMigrateFinish
",
"
NWFilterDefineXML
",
# public API and XDR protocol mismatch
"
DomainMigratePerform
",
"
DomainMigrateFinish2
",
"
DomainSnapshotListNames
",
"
GetLibVersion
",
"
FindStoragePoolSources
",
"
GetVersion
",
"
IsSecure
",
"
ListDefinedDomains
",
"
ListDefinedInterfaces
",
...
...
@@ -776,8 +771,6 @@ elsif ($opt_k) {
"
StoragePoolListVolumes
",
"
ListDomains
",
"
ListStoragePools
",
"
NetworkGetAutostart
",
"
StoragePoolGetAutostart
",
"
SecretSetValue
",
"
GetURI
",
"
ListInterfaces
",
...
...
@@ -998,18 +991,37 @@ elsif ($opt_k) {
$single_ret_var
=
"
vir
${type_name}
Ptr rv = NULL
";
$single_ret_type
=
"
vir
${type_name}
Ptr
";
}
elsif
(
$ret_member
=~
m/^int (\S+);/
)
{
push
(
@ret_list
,
"
rv = ret.$1;
");
my
$arg_name
=
$
1
;
if
(
$call
->
{
ProcName
}
=~
m/GetAutostart$/
)
{
push
(
@args_list
,
"
int *
$arg_name
");
push
(
@ret_list
,
"
if (
$arg_name
) *
$arg_name
= ret.
$arg_name
;
");
push
(
@ret_list
,
"
rv = 0;
");
}
else
{
push
(
@ret_list
,
"
rv = ret.
$arg_name
;
");
}
$single_ret_var
=
"
int rv = -1
";
$single_ret_type
=
"
int
";
}
elsif
(
$ret_member
=~
m/hyper (\S+);/
)
{
push
(
@ret_list
,
"
rv = ret.$1;
");
if
(
$call
->
{
ProcName
}
eq
"
NodeGetFreeMemory
")
{
$single_ret_var
=
"
unsigned long long rv = 0
";
$single_ret_type
=
"
unsigned long long
";
my
$arg_name
=
$
1
;
if
(
$call
->
{
ProcName
}
=~
m/Get(Lib)?Version/
)
{
push
(
@args_list
,
"
unsigned long *
$arg_name
");
push
(
@ret_list
,
"
if (
$arg_name
) *
$arg_name
= ret.
$arg_name
;
");
push
(
@ret_list
,
"
rv = 0;
");
$single_ret_var
=
"
int rv = -1
";
$single_ret_type
=
"
int
";
}
else
{
$single_ret_var
=
"
unsigned long rv = 0
";
$single_ret_type
=
"
unsigned long
";
push
(
@ret_list
,
"
rv = ret.
$arg_name
;
");
if
(
$call
->
{
ProcName
}
eq
"
NodeGetFreeMemory
")
{
$single_ret_var
=
"
unsigned long long rv = 0
";
$single_ret_type
=
"
unsigned long long
";
}
else
{
$single_ret_var
=
"
unsigned long rv = 0
";
$single_ret_type
=
"
unsigned long
";
}
}
}
else
{
die
"
unhandled type for return value:
$ret_member
";
...
...
src/remote/remote_client_bodies.c
浏览文件 @
58b6a5c4
...
...
@@ -319,7 +319,32 @@ done:
/* remoteDispatchDomainEventsRegisterAny has to be implemented manually */
/* remoteDispatchDomainGetAutostart has to be implemented manually */
static
int
remoteDomainGetAutostart
(
virDomainPtr
dom
,
int
*
autostart
)
{
int
rv
=
-
1
;
struct
private_data
*
priv
=
dom
->
conn
->
privateData
;
remote_domain_get_autostart_args
args
;
remote_domain_get_autostart_ret
ret
;
remoteDriverLock
(
priv
);
make_nonnull_domain
(
&
args
.
dom
,
dom
);
memset
(
&
ret
,
0
,
sizeof
ret
);
if
(
call
(
dom
->
conn
,
priv
,
0
,
REMOTE_PROC_DOMAIN_GET_AUTOSTART
,
(
xdrproc_t
)
xdr_remote_domain_get_autostart_args
,
(
char
*
)
&
args
,
(
xdrproc_t
)
xdr_remote_domain_get_autostart_ret
,
(
char
*
)
&
ret
)
==
-
1
)
goto
done
;
if
(
autostart
)
*
autostart
=
ret
.
autostart
;
rv
=
0
;
done:
remoteDriverUnlock
(
priv
);
return
rv
;
}
/* remoteDispatchDomainGetBlkioParameters has to be implemented manually */
...
...
@@ -1538,7 +1563,29 @@ done:
return
rv
;
}
/* remoteDispatchGetLibVersion has to be implemented manually */
static
int
remoteGetLibVersion
(
virConnectPtr
conn
,
unsigned
long
*
lib_ver
)
{
int
rv
=
-
1
;
struct
private_data
*
priv
=
conn
->
privateData
;
remote_get_lib_version_ret
ret
;
remoteDriverLock
(
priv
);
memset
(
&
ret
,
0
,
sizeof
ret
);
if
(
call
(
conn
,
priv
,
0
,
REMOTE_PROC_GET_LIB_VERSION
,
(
xdrproc_t
)
xdr_void
,
(
char
*
)
NULL
,
(
xdrproc_t
)
xdr_remote_get_lib_version_ret
,
(
char
*
)
&
ret
)
==
-
1
)
goto
done
;
if
(
lib_ver
)
*
lib_ver
=
ret
.
lib_ver
;
rv
=
0
;
done:
remoteDriverUnlock
(
priv
);
return
rv
;
}
static
int
remoteGetMaxVcpus
(
virConnectPtr
conn
,
const
char
*
type
)
...
...
@@ -1596,7 +1643,29 @@ done:
/* remoteDispatchGetURI has to be implemented manually */
/* remoteDispatchGetVersion has to be implemented manually */
static
int
remoteGetVersion
(
virConnectPtr
conn
,
unsigned
long
*
hv_ver
)
{
int
rv
=
-
1
;
struct
private_data
*
priv
=
conn
->
privateData
;
remote_get_version_ret
ret
;
remoteDriverLock
(
priv
);
memset
(
&
ret
,
0
,
sizeof
ret
);
if
(
call
(
conn
,
priv
,
0
,
REMOTE_PROC_GET_VERSION
,
(
xdrproc_t
)
xdr_void
,
(
char
*
)
NULL
,
(
xdrproc_t
)
xdr_remote_get_version_ret
,
(
char
*
)
&
ret
)
==
-
1
)
goto
done
;
if
(
hv_ver
)
*
hv_ver
=
ret
.
hv_ver
;
rv
=
0
;
done:
remoteDriverUnlock
(
priv
);
return
rv
;
}
static
int
remoteInterfaceCreate
(
virInterfacePtr
iface
,
unsigned
int
flags
)
...
...
@@ -1953,7 +2022,32 @@ done:
return
rv
;
}
/* remoteDispatchNetworkGetAutostart has to be implemented manually */
static
int
remoteNetworkGetAutostart
(
virNetworkPtr
net
,
int
*
autostart
)
{
int
rv
=
-
1
;
struct
private_data
*
priv
=
net
->
conn
->
networkPrivateData
;
remote_network_get_autostart_args
args
;
remote_network_get_autostart_ret
ret
;
remoteDriverLock
(
priv
);
make_nonnull_network
(
&
args
.
net
,
net
);
memset
(
&
ret
,
0
,
sizeof
ret
);
if
(
call
(
net
->
conn
,
priv
,
0
,
REMOTE_PROC_NETWORK_GET_AUTOSTART
,
(
xdrproc_t
)
xdr_remote_network_get_autostart_args
,
(
char
*
)
&
args
,
(
xdrproc_t
)
xdr_remote_network_get_autostart_ret
,
(
char
*
)
&
ret
)
==
-
1
)
goto
done
;
if
(
autostart
)
*
autostart
=
ret
.
autostart
;
rv
=
0
;
done:
remoteDriverUnlock
(
priv
);
return
rv
;
}
static
char
*
remoteNetworkGetBridgeName
(
virNetworkPtr
net
)
...
...
@@ -3015,7 +3109,32 @@ done:
return
rv
;
}
/* remoteDispatchStoragePoolGetAutostart has to be implemented manually */
static
int
remoteStoragePoolGetAutostart
(
virStoragePoolPtr
pool
,
int
*
autostart
)
{
int
rv
=
-
1
;
struct
private_data
*
priv
=
pool
->
conn
->
storagePrivateData
;
remote_storage_pool_get_autostart_args
args
;
remote_storage_pool_get_autostart_ret
ret
;
remoteDriverLock
(
priv
);
make_nonnull_storage_pool
(
&
args
.
pool
,
pool
);
memset
(
&
ret
,
0
,
sizeof
ret
);
if
(
call
(
pool
->
conn
,
priv
,
0
,
REMOTE_PROC_STORAGE_POOL_GET_AUTOSTART
,
(
xdrproc_t
)
xdr_remote_storage_pool_get_autostart_args
,
(
char
*
)
&
args
,
(
xdrproc_t
)
xdr_remote_storage_pool_get_autostart_ret
,
(
char
*
)
&
ret
)
==
-
1
)
goto
done
;
if
(
autostart
)
*
autostart
=
ret
.
autostart
;
rv
=
0
;
done:
remoteDriverUnlock
(
priv
);
return
rv
;
}
static
int
remoteStoragePoolGetInfo
(
virStoragePoolPtr
pool
,
virStoragePoolInfoPtr
result
)
...
...
src/remote/remote_driver.c
浏览文件 @
58b6a5c4
...
...
@@ -1698,53 +1698,6 @@ done:
return
rv
;
}
static
int
remoteGetVersion
(
virConnectPtr
conn
,
unsigned
long
*
hvVer
)
{
int
rv
=
-
1
;
remote_get_version_ret
ret
;
struct
private_data
*
priv
=
conn
->
privateData
;
remoteDriverLock
(
priv
);
memset
(
&
ret
,
0
,
sizeof
ret
);
if
(
call
(
conn
,
priv
,
0
,
REMOTE_PROC_GET_VERSION
,
(
xdrproc_t
)
xdr_void
,
(
char
*
)
NULL
,
(
xdrproc_t
)
xdr_remote_get_version_ret
,
(
char
*
)
&
ret
)
==
-
1
)
goto
done
;
if
(
hvVer
)
*
hvVer
=
ret
.
hv_ver
;
rv
=
0
;
done:
remoteDriverUnlock
(
priv
);
return
rv
;
}
static
int
remoteGetLibVersion
(
virConnectPtr
conn
,
unsigned
long
*
libVer
)
{
int
rv
=
-
1
;
remote_get_lib_version_ret
ret
;
struct
private_data
*
priv
=
conn
->
privateData
;
remoteDriverLock
(
priv
);
memset
(
&
ret
,
0
,
sizeof
ret
);
if
(
call
(
conn
,
priv
,
0
,
REMOTE_PROC_GET_LIB_VERSION
,
(
xdrproc_t
)
xdr_void
,
(
char
*
)
NULL
,
(
xdrproc_t
)
xdr_remote_get_lib_version_ret
,
(
char
*
)
&
ret
)
==
-
1
)
goto
done
;
if
(
libVer
)
*
libVer
=
ret
.
lib_ver
;
rv
=
0
;
done:
remoteDriverUnlock
(
priv
);
return
rv
;
}
static
int
remoteIsSecure
(
virConnectPtr
conn
)
{
int
rv
=
-
1
;
...
...
@@ -2783,32 +2736,6 @@ done:
return
rv
;
}
static
int
remoteDomainGetAutostart
(
virDomainPtr
domain
,
int
*
autostart
)
{
int
rv
=
-
1
;
remote_domain_get_autostart_args
args
;
remote_domain_get_autostart_ret
ret
;
struct
private_data
*
priv
=
domain
->
conn
->
privateData
;
remoteDriverLock
(
priv
);
make_nonnull_domain
(
&
args
.
dom
,
domain
);
memset
(
&
ret
,
0
,
sizeof
ret
);
if
(
call
(
domain
->
conn
,
priv
,
0
,
REMOTE_PROC_DOMAIN_GET_AUTOSTART
,
(
xdrproc_t
)
xdr_remote_domain_get_autostart_args
,
(
char
*
)
&
args
,
(
xdrproc_t
)
xdr_remote_domain_get_autostart_ret
,
(
char
*
)
&
ret
)
==
-
1
)
goto
done
;
if
(
autostart
)
*
autostart
=
ret
.
autostart
;
rv
=
0
;
done:
remoteDriverUnlock
(
priv
);
return
rv
;
}
static
char
*
remoteDomainGetSchedulerType
(
virDomainPtr
domain
,
int
*
nparams
)
{
...
...
@@ -3300,33 +3227,6 @@ done:
return
rv
;
}
static
int
remoteNetworkGetAutostart
(
virNetworkPtr
network
,
int
*
autostart
)
{
int
rv
=
-
1
;
remote_network_get_autostart_args
args
;
remote_network_get_autostart_ret
ret
;
struct
private_data
*
priv
=
network
->
conn
->
networkPrivateData
;
remoteDriverLock
(
priv
);
make_nonnull_network
(
&
args
.
net
,
network
);
memset
(
&
ret
,
0
,
sizeof
ret
);
if
(
call
(
network
->
conn
,
priv
,
0
,
REMOTE_PROC_NETWORK_GET_AUTOSTART
,
(
xdrproc_t
)
xdr_remote_network_get_autostart_args
,
(
char
*
)
&
args
,
(
xdrproc_t
)
xdr_remote_network_get_autostart_ret
,
(
char
*
)
&
ret
)
==
-
1
)
goto
done
;
if
(
autostart
)
*
autostart
=
ret
.
autostart
;
rv
=
0
;
done:
remoteDriverUnlock
(
priv
);
return
rv
;
}
/*----------------------------------------------------------------------*/
static
virDrvOpenStatus
ATTRIBUTE_NONNULL
(
1
)
...
...
@@ -3732,34 +3632,6 @@ done:
return
rv
;
}
static
int
remoteStoragePoolGetAutostart
(
virStoragePoolPtr
pool
,
int
*
autostart
)
{
int
rv
=
-
1
;
remote_storage_pool_get_autostart_args
args
;
remote_storage_pool_get_autostart_ret
ret
;
struct
private_data
*
priv
=
pool
->
conn
->
storagePrivateData
;
remoteDriverLock
(
priv
);
make_nonnull_storage_pool
(
&
args
.
pool
,
pool
);
memset
(
&
ret
,
0
,
sizeof
ret
);
if
(
call
(
pool
->
conn
,
priv
,
0
,
REMOTE_PROC_STORAGE_POOL_GET_AUTOSTART
,
(
xdrproc_t
)
xdr_remote_storage_pool_get_autostart_args
,
(
char
*
)
&
args
,
(
xdrproc_t
)
xdr_remote_storage_pool_get_autostart_ret
,
(
char
*
)
&
ret
)
==
-
1
)
goto
done
;
if
(
autostart
)
*
autostart
=
ret
.
autostart
;
rv
=
0
;
done:
remoteDriverUnlock
(
priv
);
return
rv
;
}
static
int
remoteStoragePoolListVolumes
(
virStoragePoolPtr
pool
,
char
**
const
names
,
int
maxnames
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录