Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
900b18f4
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看板
提交
900b18f4
编写于
4月 23, 2011
作者:
M
Matthias Bolte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remote generator: Refactor duplicate code
上级
33148050
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
150 deletion
+18
-150
daemon/remote_generator.pl
daemon/remote_generator.pl
+18
-150
未找到文件。
daemon/remote_generator.pl
浏览文件 @
900b18f4
...
...
@@ -355,69 +355,17 @@ elsif ($opt_b) {
if
(
$args_member
=~
m/^remote_nonnull_string name;/
and
$has_node_device
)
{
# ignore the name arg for node devices
next
}
elsif
(
$args_member
=~
m/^remote_nonnull_domain (\S+);/
)
{
push
(
@vars_list
,
"
virDomainPtr $1 = NULL
");
push
(
@getters_list
,
"
if (!($1 = get_nonnull_domain(conn, args->$1)))
\n
"
.
"
goto cleanup;
\n
");
push
(
@args_list
,
"
$1
");
push
(
@free_list
,
"
if ($1)
\n
"
.
"
virDomainFree($1);
");
}
elsif
(
$args_member
=~
m/^remote_nonnull_network (\S+);/
)
{
push
(
@vars_list
,
"
virNetworkPtr $1 = NULL
");
push
(
@getters_list
,
"
if (!($1 = get_nonnull_network(conn, args->$1)))
\n
"
.
"
goto cleanup;
\n
");
push
(
@args_list
,
"
$1
");
push
(
@free_list
,
"
if ($1)
\n
"
.
"
virNetworkFree($1);
");
}
elsif
(
$args_member
=~
m/^remote_nonnull_storage_pool (\S+);/
)
{
push
(
@vars_list
,
"
virStoragePoolPtr $1 = NULL
");
push
(
@getters_list
,
"
if (!($1 = get_nonnull_storage_pool(conn, args->$1)))
\n
"
.
"
goto cleanup;
\n
");
push
(
@args_list
,
"
$1
");
push
(
@free_list
,
"
if ($1)
\n
"
.
"
virStoragePoolFree($1);
");
}
elsif
(
$args_member
=~
m/^remote_nonnull_storage_vol (\S+);/
)
{
push
(
@vars_list
,
"
virStorageVolPtr $1 = NULL
");
push
(
@getters_list
,
"
if (!($1 = get_nonnull_storage_vol(conn, args->$1)))
\n
"
.
"
goto cleanup;
\n
");
push
(
@args_list
,
"
$1
");
push
(
@free_list
,
"
if ($1)
\n
"
.
"
virStorageVolFree($1);
");
}
elsif
(
$args_member
=~
m/^remote_nonnull_interface (\S+);/
)
{
push
(
@vars_list
,
"
virInterfacePtr $1 = NULL
");
push
(
@getters_list
,
"
if (!($1 = get_nonnull_interface(conn, args->$1)))
\n
"
.
"
goto cleanup;
\n
");
push
(
@args_list
,
"
$1
");
push
(
@free_list
,
"
if ($1)
\n
"
.
"
virInterfaceFree($1);
");
}
elsif
(
$args_member
=~
m/^remote_nonnull_secret (\S+);/
)
{
push
(
@vars_list
,
"
virSecretPtr $1 = NULL
");
push
(
@getters_list
,
"
if (!($1 = get_nonnull_secret(conn, args->$1)))
\n
"
.
"
goto cleanup;
\n
");
push
(
@args_list
,
"
$1
");
push
(
@free_list
,
"
if ($1)
\n
"
.
"
virSecretFree($1);
");
}
elsif
(
$args_member
=~
m/^remote_nonnull_nwfilter (\S+);/
)
{
push
(
@vars_list
,
"
virNWFilterPtr $1 = NULL
");
}
elsif
(
$args_member
=~
m/^remote_nonnull_(domain|network|storage_pool|storage_vol|interface|secret|nwfilter) (\S+);/
)
{
my
$type_name
=
name_to_ProcName
(
$
1
);
push
(
@vars_list
,
"
vir
${type_name}
Ptr $2 = NULL
");
push
(
@getters_list
,
"
if (!($
1 = get_nonnull_nwfilter(conn, args->$1
)))
\n
"
.
"
if (!($
2 = get_nonnull_$1(conn, args->$2
)))
\n
"
.
"
goto cleanup;
\n
");
push
(
@args_list
,
"
$
1
");
push
(
@args_list
,
"
$
2
");
push
(
@free_list
,
"
if ($
1
)
\n
"
.
"
vir
NWFilterFree($1
);
");
"
if ($
2
)
\n
"
.
"
vir
${type_name}
Free($2
);
");
}
elsif
(
$args_member
=~
m/^remote_nonnull_domain_snapshot /
)
{
push
(
@vars_list
,
"
virDomainPtr dom = NULL
");
push
(
@vars_list
,
"
virDomainSnapshotPtr snapshot = NULL
");
...
...
@@ -504,85 +452,15 @@ elsif ($opt_b) {
$single_ret_var
=
$
1
;
$single_ret_by_ref
=
0
;
$single_ret_check
=
"
== NULL
";
}
elsif
(
$ret_member
=~
m/remote_nonnull_domain (\S+);/
)
{
push
(
@vars_list
,
"
virDomainPtr $1 = NULL
");
push
(
@ret_list
,
"
make_nonnull_domain(&ret->$1, $1);
");
push
(
@free_list
,
"
if ($1)
\n
"
.
"
virDomainFree($1);
");
$single_ret_var
=
$
1
;
$single_ret_by_ref
=
0
;
$single_ret_check
=
"
== NULL
";
}
elsif
(
$ret_member
=~
m/remote_nonnull_network (\S+);/
)
{
push
(
@vars_list
,
"
virNetworkPtr $1 = NULL
");
push
(
@ret_list
,
"
make_nonnull_network(&ret->$1, $1);
");
push
(
@free_list
,
"
if ($1)
\n
"
.
"
virNetworkFree($1);
");
$single_ret_var
=
$
1
;
$single_ret_by_ref
=
0
;
$single_ret_check
=
"
== NULL
";
}
elsif
(
$ret_member
=~
m/remote_nonnull_storage_pool (\S+);/
)
{
push
(
@vars_list
,
"
virStoragePoolPtr $1 = NULL
");
push
(
@ret_list
,
"
make_nonnull_storage_pool(&ret->$1, $1);
");
push
(
@free_list
,
"
if ($1)
\n
"
.
"
virStoragePoolFree($1);
");
$single_ret_var
=
$
1
;
$single_ret_by_ref
=
0
;
$single_ret_check
=
"
== NULL
";
}
elsif
(
$ret_member
=~
m/remote_nonnull_storage_vol (\S+);/
)
{
push
(
@vars_list
,
"
virStorageVolPtr $1 = NULL
");
push
(
@ret_list
,
"
make_nonnull_storage_vol(&ret->$1, $1);
");
push
(
@free_list
,
"
if ($1)
\n
"
.
"
virStorageVolFree($1);
");
$single_ret_var
=
$
1
;
$single_ret_by_ref
=
0
;
$single_ret_check
=
"
== NULL
";
}
elsif
(
$ret_member
=~
m/remote_nonnull_interface (\S+);/
)
{
push
(
@vars_list
,
"
virInterfacePtr $1 = NULL
");
push
(
@ret_list
,
"
make_nonnull_interface(&ret->$1, $1);
");
push
(
@free_list
,
"
if ($1)
\n
"
.
"
virInterfaceFree($1);
");
$single_ret_var
=
$
1
;
$single_ret_by_ref
=
0
;
$single_ret_check
=
"
== NULL
";
}
elsif
(
$ret_member
=~
m/remote_nonnull_node_device (\S+);/
)
{
push
(
@vars_list
,
"
virNodeDevicePtr $1 = NULL
");
push
(
@ret_list
,
"
make_nonnull_node_device(&ret->$1, $1);
");
push
(
@free_list
,
"
if ($1)
\n
"
.
"
virNodeDeviceFree($1);
");
$single_ret_var
=
$
1
;
$single_ret_by_ref
=
0
;
$single_ret_check
=
"
== NULL
";
}
elsif
(
$ret_member
=~
m/remote_nonnull_secret (\S+);/
)
{
push
(
@vars_list
,
"
virSecretPtr $1 = NULL
");
push
(
@ret_list
,
"
make_nonnull_secret(&ret->$1, $1);
");
push
(
@free_list
,
"
if ($1)
\n
"
.
"
virSecretFree($1);
");
$single_ret_var
=
$
1
;
$single_ret_by_ref
=
0
;
$single_ret_check
=
"
== NULL
";
}
elsif
(
$ret_member
=~
m/remote_nonnull_nwfilter (\S+);/
)
{
push
(
@vars_list
,
"
virNWFilterPtr $1 = NULL
");
push
(
@ret_list
,
"
make_nonnull_nwfilter(&ret->$1, $1);
");
push
(
@free_list
,
"
if ($1)
\n
"
.
"
virNWFilterFree($1);
");
$single_ret_var
=
$
1
;
$single_ret_by_ref
=
0
;
$single_ret_check
=
"
== NULL
";
}
elsif
(
$ret_member
=~
m/remote_nonnull_domain_snapshot (\S+);/
)
{
push
(
@vars_list
,
"
virDomainSnapshotPtr $1 = NULL
");
push
(
@ret_list
,
"
make_nonnull_domain_snapshot(&ret->$1, $1);
");
}
elsif
(
$ret_member
=~
m/remote_nonnull_(domain|network|storage_pool|storage_vol|interface|node_device|secret|nwfilter|domain_snapshot) (\S+);/
)
{
my
$type_name
=
name_to_ProcName
(
$
1
);
push
(
@vars_list
,
"
vir
${type_name}
Ptr $2 = NULL
");
push
(
@ret_list
,
"
make_nonnull_$1(&ret->$2, $2);
");
push
(
@free_list
,
"
if ($
1
)
\n
"
.
"
vir
DomainSnapshotFree($1
);
");
$single_ret_var
=
$
1
;
"
if ($
2
)
\n
"
.
"
vir
${type_name}
Free($2
);
");
$single_ret_var
=
$
2
;
$single_ret_by_ref
=
0
;
$single_ret_check
=
"
== NULL
";
}
elsif
(
$ret_member
=~
m/int (\S+)<(\S+)>;/
)
{
...
...
@@ -717,18 +595,8 @@ elsif ($opt_b) {
$prefix
=
"
Connect
"
}
elsif
(
$calls
{
$_
}
->
{
ProcName
}
eq
"
SupportsFeature
")
{
$prefix
=
"
Drv
"
}
elsif
(
$calls
{
$_
}
->
{
ProcName
}
eq
"
DomainDumpXML
")
{
$proc_name
=
"
DomainGetXMLDesc
"
}
elsif
(
$calls
{
$_
}
->
{
ProcName
}
eq
"
NetworkDumpXML
")
{
$proc_name
=
"
NetworkGetXMLDesc
"
}
elsif
(
$calls
{
$_
}
->
{
ProcName
}
eq
"
StoragePoolDumpXML
")
{
$proc_name
=
"
StoragePoolGetXMLDesc
"
}
elsif
(
$calls
{
$_
}
->
{
ProcName
}
eq
"
StorageVolDumpXML
")
{
$proc_name
=
"
StorageVolGetXMLDesc
"
}
elsif
(
$calls
{
$_
}
->
{
ProcName
}
eq
"
NodeDeviceDumpXML
")
{
$proc_name
=
"
NodeDeviceGetXMLDesc
"
}
elsif
(
$calls
{
$_
}
->
{
ProcName
}
eq
"
DomainSnapshotDumpXML
")
{
$proc_name
=
"
DomainSnapshotGetXMLDesc
"
}
elsif
(
$calls
{
$_
}
->
{
ProcName
}
=~
m/^(\S+)DumpXML$/
)
{
$proc_name
=
"
${
1
}
GetXMLDesc
"
}
elsif
(
$calls
{
$_
}
->
{
ProcName
}
eq
"
DomainGetOsType
")
{
$proc_name
=
"
DomainGetOSType
"
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录