mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-20 19:45:22 +00:00
remote generator, client: Handle simple remote driver functions
Rename remoteSecretListSecrets to remoteListSecrets to match the normal naming pattern.
This commit is contained in:
parent
2c4105f112
commit
f68bb4edb3
8
cfg.mk
8
cfg.mk
@ -611,7 +611,7 @@ exclude_file_name_regexp--sc_prohibit_close = \
|
|||||||
exclude_file_name_regexp--sc_prohibit_doubled_word = ^po/
|
exclude_file_name_regexp--sc_prohibit_doubled_word = ^po/
|
||||||
|
|
||||||
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
|
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
|
||||||
(^docs/api_extension/|^tests/qemuhelpdata/|\.(gif|ico|png)$$|daemon/.*_dispatch_bodies\.c$$)
|
(^docs/api_extension/|^tests/qemuhelpdata/|\.(gif|ico|png)$$|^daemon/.*_dispatch_bodies\.c$$|^src/remote/.*_client_bodies\.c$$)
|
||||||
|
|
||||||
_src2=src/(util/util|libvirt|lxc/lxc_controller)
|
_src2=src/(util/util|libvirt|lxc/lxc_controller)
|
||||||
exclude_file_name_regexp--sc_prohibit_fork_wrappers = \
|
exclude_file_name_regexp--sc_prohibit_fork_wrappers = \
|
||||||
@ -633,9 +633,11 @@ exclude_file_name_regexp--sc_prohibit_strncpy = \
|
|||||||
|
|
||||||
exclude_file_name_regexp--sc_prohibit_xmlGetProp = ^src/util/xml\.c$$
|
exclude_file_name_regexp--sc_prohibit_xmlGetProp = ^src/util/xml\.c$$
|
||||||
|
|
||||||
exclude_file_name_regexp--sc_require_config_h = ^(examples/|daemon/.*_dispatch_bodies\.c$$)
|
exclude_file_name_regexp--sc_require_config_h = \
|
||||||
|
^(examples/|daemon/.*_dispatch_bodies\.c$$|src/remote/.*_client_bodies\.c$$)
|
||||||
|
|
||||||
exclude_file_name_regexp--sc_require_config_h_first = ^(examples/|daemon/.*_dispatch_bodies\.c$$)
|
exclude_file_name_regexp--sc_require_config_h_first = \
|
||||||
|
^(examples/|daemon/.*_dispatch_bodies\.c$$|src/remote/.*_client_bodies\.c$$)
|
||||||
|
|
||||||
exclude_file_name_regexp--sc_trailing_blank = (^docs/|\.(fig|gif|ico|png)$$)
|
exclude_file_name_regexp--sc_trailing_blank = (^docs/|\.(fig|gif|ico|png)$$)
|
||||||
|
|
||||||
|
@ -2,5 +2,4 @@
|
|||||||
* Do not edit this file. Any changes you make will be lost.
|
* Do not edit this file. Any changes you make will be lost.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* qemuDispatchMonitorCommand has to be implemented manually */
|
/* qemuDispatchMonitorCommand has to be implemented manually */
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
* Do not edit this file. Any changes you make will be lost.
|
* Do not edit this file. Any changes you make will be lost.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* remoteDispatchAuthList has to be implemented manually */
|
/* remoteDispatchAuthList has to be implemented manually */
|
||||||
|
|
||||||
/* remoteDispatchAuthPolkit has to be implemented manually */
|
/* remoteDispatchAuthPolkit has to be implemented manually */
|
||||||
|
@ -20,8 +20,8 @@ use strict;
|
|||||||
use Getopt::Std;
|
use Getopt::Std;
|
||||||
|
|
||||||
# Command line options.
|
# Command line options.
|
||||||
our ($opt_p, $opt_t, $opt_a, $opt_r, $opt_d, $opt_c, $opt_b);
|
our ($opt_p, $opt_t, $opt_a, $opt_r, $opt_d, $opt_c, $opt_b, $opt_k);
|
||||||
getopts ('ptardcb');
|
getopts ('ptardcbk');
|
||||||
|
|
||||||
my $structprefix = $ARGV[0];
|
my $structprefix = $ARGV[0];
|
||||||
my $procprefix = uc $structprefix;
|
my $procprefix = uc $structprefix;
|
||||||
@ -146,9 +146,12 @@ print <<__EOF__;
|
|||||||
/* Automatically generated by remote_generator.pl.
|
/* Automatically generated by remote_generator.pl.
|
||||||
* Do not edit this file. Any changes you make will be lost.
|
* Do not edit this file. Any changes you make will be lost.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
__EOF__
|
__EOF__
|
||||||
|
|
||||||
|
if (!$opt_b and !$opt_k) {
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
|
||||||
# Debugging.
|
# Debugging.
|
||||||
if ($opt_d) {
|
if ($opt_d) {
|
||||||
my @keys = sort (keys %calls);
|
my @keys = sort (keys %calls);
|
||||||
@ -724,3 +727,334 @@ elsif ($opt_b) {
|
|||||||
print "}\n";
|
print "}\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Bodies for client functions ("remote_client_bodies.c").
|
||||||
|
elsif ($opt_k) {
|
||||||
|
# list of functions that currently are not generatable
|
||||||
|
my @ungeneratable;
|
||||||
|
|
||||||
|
if ($structprefix eq "remote") {
|
||||||
|
@ungeneratable = ("Close",
|
||||||
|
"DomainEventsDeregisterAny",
|
||||||
|
"DomainEventsRegisterAny",
|
||||||
|
"DomainMigratePrepareTunnel",
|
||||||
|
"DomainOpenConsole",
|
||||||
|
"DomainPinVcpu",
|
||||||
|
"DomainSetSchedulerParameters",
|
||||||
|
"DomainSetMemoryParameters",
|
||||||
|
"DomainSetBlkioParameters",
|
||||||
|
"Open",
|
||||||
|
"StorageVolUpload",
|
||||||
|
"StorageVolDownload",
|
||||||
|
|
||||||
|
"AuthList",
|
||||||
|
"AuthSaslInit",
|
||||||
|
"AuthSaslStart",
|
||||||
|
"AuthSaslStep",
|
||||||
|
"AuthPolkit",
|
||||||
|
|
||||||
|
"CPUBaseline",
|
||||||
|
"CPUCompare",
|
||||||
|
"DomainBlockStats",
|
||||||
|
"DomainCreate",
|
||||||
|
"DomainCreateXML",
|
||||||
|
"DomainDefineXML",
|
||||||
|
"DomainDestroy",
|
||||||
|
"DomainDumpXML",
|
||||||
|
"DomainGetAutostart",
|
||||||
|
"DomainGetBlockInfo",
|
||||||
|
"DomainGetInfo",
|
||||||
|
"StoragePoolLookupByUUID",
|
||||||
|
"StoragePoolNumOfVolumes",
|
||||||
|
"NodeDeviceCreateXML",
|
||||||
|
"DomainGetJobInfo",
|
||||||
|
"DomainGetMaxMemory",
|
||||||
|
"DomainGetOSType",
|
||||||
|
"DomainGetVcpusFlags",
|
||||||
|
"HasCurrentSnapshot",
|
||||||
|
"DomainInterfaceStats",
|
||||||
|
"DomainIsActive",
|
||||||
|
"DomainIsPersistent",
|
||||||
|
"DomainIsUpdated",
|
||||||
|
"DomainLookupByID",
|
||||||
|
"DomainLookupByName",
|
||||||
|
"DomainLookupByUIID",
|
||||||
|
"DomainMigrateFinish",
|
||||||
|
"DomainGetMaxVcpus",
|
||||||
|
"DomainHasCurrentSnapshot",
|
||||||
|
"NWFilterDefineXML",
|
||||||
|
"NumOfStoragePools",
|
||||||
|
"NWFilterLookupByName",
|
||||||
|
"NWFilterLookupByUUID",
|
||||||
|
"SecretLookupByUUID",
|
||||||
|
"SecretLookupByUsage",
|
||||||
|
"StoragePoolCreateXML",
|
||||||
|
"StoragePoolIsActive",
|
||||||
|
"DomainHasManagedSaveImage",
|
||||||
|
"DomainLookupByUUID",
|
||||||
|
"DomainMigratePerform",
|
||||||
|
"DomainMigrateFinish2",
|
||||||
|
"DomainSnapshotCreateXML",
|
||||||
|
"DomainSnapshotDumpXML",
|
||||||
|
"DomainSnapshotNum",
|
||||||
|
"DomainSnapshotCurrent",
|
||||||
|
"DomainSnapshotListNames",
|
||||||
|
"GetCapabilities",
|
||||||
|
"GetHostname",
|
||||||
|
"GetLibVersion",
|
||||||
|
"GetMaxVcpus",
|
||||||
|
"DomainSnapshotLookupByName",
|
||||||
|
"DomainXMLFromNative",
|
||||||
|
"FindStoragePoolSources",
|
||||||
|
"GetSysinfo",
|
||||||
|
"GetVersion",
|
||||||
|
"GetLibVersion",
|
||||||
|
"InterfaceDefineXML",
|
||||||
|
"InterfaceGetXMLDesc",
|
||||||
|
"InterfaceLookupByName",
|
||||||
|
"IsSecure",
|
||||||
|
"ListDefinedDomains",
|
||||||
|
"ListDefinedInterfaces",
|
||||||
|
"ListNWFilters",
|
||||||
|
"NetworkCreateXML",
|
||||||
|
"SupportsFeature",
|
||||||
|
"StorageVolLookupByPath",
|
||||||
|
"StorageVolGetInfo",
|
||||||
|
"StorageVolCreateXML",
|
||||||
|
"StorageVolLookupByName",
|
||||||
|
"StorageVolLookupByKey",
|
||||||
|
"StoragePoolIsPersistent",
|
||||||
|
"StoragePoolGetInfo",
|
||||||
|
"StorageVolGetPath",
|
||||||
|
"StorageVolCreateXMLFrom",
|
||||||
|
"StoragePoolLookupByName",
|
||||||
|
"SecretGetXMLDesc",
|
||||||
|
"NWFilterGetXMLDesc",
|
||||||
|
"NumOfNWFilters",
|
||||||
|
"NumOfInterfaces",
|
||||||
|
"NumOfDomains",
|
||||||
|
"NumOfDefinedStoragePools",
|
||||||
|
"NodeListDevices",
|
||||||
|
"NodeGetCellsFreeMemory",
|
||||||
|
"NodeDeviceDumpXML",
|
||||||
|
"NetworkIsActive",
|
||||||
|
"ListDefinedNetworks",
|
||||||
|
"DomainXMLToNative",
|
||||||
|
"StorageVolDumpXML",
|
||||||
|
"StoragePoolListVolumes",
|
||||||
|
"StoragePoolDumpXML",
|
||||||
|
"SecretDefineXML",
|
||||||
|
"NumOfDefinedNetworks",
|
||||||
|
"InterfaceIsActive",
|
||||||
|
"ListDomains",
|
||||||
|
"ListStoragePools",
|
||||||
|
"NetworkDumpXML",
|
||||||
|
"NetworkGetAutostart",
|
||||||
|
"NetworkGetBridgeName",
|
||||||
|
"StoragePoolLookupByVolume",
|
||||||
|
"StoragePoolGetAutostart",
|
||||||
|
"SecretSetValue",
|
||||||
|
"NumOfDefinedInterfaces",
|
||||||
|
"StoragePoolDefineXML",
|
||||||
|
"NodeNumOfDevices",
|
||||||
|
"NodeGetInfo",
|
||||||
|
"GetURI",
|
||||||
|
"InterfaceLookupByMACString",
|
||||||
|
"ListInterfaces",
|
||||||
|
"NetworkDefineXML",
|
||||||
|
"NetworkLookupByName",
|
||||||
|
"ListDefinedStoragePools",
|
||||||
|
"NetworkIsPersistent",
|
||||||
|
"NodeDeviceDettach",
|
||||||
|
"NodeDeviceLookupByName",
|
||||||
|
"NodeGetFreeMemory",
|
||||||
|
"NumOfDefinedDomains",
|
||||||
|
"ListNetworks",
|
||||||
|
"NodeDeviceListCaps",
|
||||||
|
"NodeDeviceReset",
|
||||||
|
"NumOfNetworks",
|
||||||
|
"NetworkLookupByUUID",
|
||||||
|
"NodeDeviceNumOfCaps",
|
||||||
|
"NumOfSecrets",
|
||||||
|
"NodeDeviceReAttach",
|
||||||
|
"ListSecrets",
|
||||||
|
|
||||||
|
"DomainBlockPeek",
|
||||||
|
"DomainCreateWithFlags",
|
||||||
|
"DomainEventsDeregister",
|
||||||
|
"DomainEventsRegister",
|
||||||
|
"DomainGetBlkioParameters",
|
||||||
|
"DomainGetMemoryParameters",
|
||||||
|
"DomainGetSchedulerParameters",
|
||||||
|
"DomainGetSchedulerType",
|
||||||
|
"DomainGetSecurityLabel",
|
||||||
|
"DomainGetVcpus",
|
||||||
|
"DomainMemoryPeek",
|
||||||
|
"DomainMemoryStats",
|
||||||
|
"DomainMigratePrepare",
|
||||||
|
"DomainMigratePrepare2",
|
||||||
|
"GetType",
|
||||||
|
"NodeDeviceGetParent",
|
||||||
|
"NodeGetSecurityModel",
|
||||||
|
"SecretGetValue");
|
||||||
|
} elsif ($structprefix eq "qemu") {
|
||||||
|
@ungeneratable = ("MonitorCommand");
|
||||||
|
}
|
||||||
|
|
||||||
|
my %ug = map { $_ => 1 } @ungeneratable;
|
||||||
|
my @keys = sort (keys %calls);
|
||||||
|
|
||||||
|
foreach (@keys) {
|
||||||
|
my $call = $calls{$_};
|
||||||
|
|
||||||
|
# skip things which are REMOTE_MESSAGE
|
||||||
|
next if $call->{msg};
|
||||||
|
|
||||||
|
if (exists($ug{$call->{ProcName}})) {
|
||||||
|
print "\n/* ${structprefix}Dispatch$call->{ProcName} has to " .
|
||||||
|
"be implemented manually */\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @args_list = ();
|
||||||
|
my @vars_list = ();
|
||||||
|
my @setters_list = ();
|
||||||
|
my $priv_src = "conn";
|
||||||
|
my $priv_name = "privateData";
|
||||||
|
my $args = "&args";
|
||||||
|
my $ret = "&ret";
|
||||||
|
|
||||||
|
if ($call->{args} eq "void") {
|
||||||
|
$args = "NULL";
|
||||||
|
} else {
|
||||||
|
push(@vars_list, "$call->{args} args");
|
||||||
|
|
||||||
|
my $is_first_arg = 1;
|
||||||
|
my $has_node_device = 0;
|
||||||
|
|
||||||
|
# node device is special
|
||||||
|
if ($call->{args} =~ m/^remote_node_device_/) {
|
||||||
|
$has_node_device = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $args_member (@{$call->{args_members}}) {
|
||||||
|
if ($args_member =~ m/^remote_nonnull_string name;/ and $has_node_device) {
|
||||||
|
$priv_src = "dev->conn";
|
||||||
|
$priv_name = "devMonPrivateData";
|
||||||
|
push(@args_list, "virNodeDevicePtr dev");
|
||||||
|
push(@setters_list, "args.name = dev->name;");
|
||||||
|
} elsif ($args_member =~ m/^remote_nonnull_(domain|network|storage_pool|storage_vol|interface|secret|nwfilter|domain_snapshot) (\S+);/) {
|
||||||
|
my $name = $1;
|
||||||
|
my $type_name = name_to_ProcName($name);
|
||||||
|
|
||||||
|
if ($is_first_arg) {
|
||||||
|
if ($name eq "domain_snapshot") {
|
||||||
|
$priv_src = "$2->domain->conn";
|
||||||
|
} else {
|
||||||
|
$priv_src = "$2->conn";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($name =~ m/^storage_/) {
|
||||||
|
$priv_name = "storagePrivateData";
|
||||||
|
} elsif (!($name =~ m/^domain/)) {
|
||||||
|
$priv_name = "${name}PrivateData";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
push(@args_list, "vir${type_name}Ptr $2");
|
||||||
|
push(@setters_list, "make_nonnull_$1(&args.$2, $2);");
|
||||||
|
} elsif ($args_member =~ m/^remote_nonnull_string (\S+);/) {
|
||||||
|
push(@args_list, "const char *$1");
|
||||||
|
push(@setters_list, "args.$1 = (char *)$1;");
|
||||||
|
} elsif ($args_member =~ m/(\S+)<\S+>;/) {
|
||||||
|
# ignored for now
|
||||||
|
} elsif ($args_member =~ m/^(.*) (\S+);/) {
|
||||||
|
my $type_name = $1;
|
||||||
|
my $arg_name = $2;
|
||||||
|
|
||||||
|
$type_name =~ s/hyper/long/;
|
||||||
|
$type_name =~ s/^unsigned$/unsigned int/;
|
||||||
|
$type_name =~ s/u_int/unsigned int/;
|
||||||
|
|
||||||
|
if ($type_name eq "int") {
|
||||||
|
# fix bad decisions in the xdr protocol
|
||||||
|
if ($arg_name eq "flags" and
|
||||||
|
$call->{ProcName} ne "DomainCoreDump") {
|
||||||
|
$type_name = "unsigned int";
|
||||||
|
} elsif ($arg_name eq "nvcpus" and
|
||||||
|
$call->{ProcName} eq "DomainSetVcpus") {
|
||||||
|
$type_name = "unsigned int";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($call->{ProcName} eq "DomainMigrateSetMaxDowntime" and
|
||||||
|
$arg_name eq "downtime") {
|
||||||
|
$type_name = "unsigned long long";
|
||||||
|
}
|
||||||
|
|
||||||
|
push(@args_list, "$type_name $arg_name");
|
||||||
|
push(@setters_list, "args.$arg_name = $arg_name;");
|
||||||
|
} elsif ($args_member =~ m/^\/*/) {
|
||||||
|
# ignore comments
|
||||||
|
} else {
|
||||||
|
die "unhandled type for argument value: $args_member";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_first_arg and $priv_src eq "conn") {
|
||||||
|
unshift(@args_list, "virConnectPtr conn");
|
||||||
|
}
|
||||||
|
|
||||||
|
$is_first_arg = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($call->{ret} eq "void") {
|
||||||
|
$ret = "NULL";
|
||||||
|
} else {
|
||||||
|
push(@vars_list, "$call->{ret} ret");
|
||||||
|
}
|
||||||
|
|
||||||
|
# print function
|
||||||
|
print "\n";
|
||||||
|
print "static int\n";
|
||||||
|
print "remote$call->{ProcName}(";
|
||||||
|
|
||||||
|
print join(", ", @args_list);
|
||||||
|
|
||||||
|
print ")\n";
|
||||||
|
print "{\n";
|
||||||
|
print " int rv = -1;\n";
|
||||||
|
print " struct private_data *priv = $priv_src->$priv_name;\n";
|
||||||
|
|
||||||
|
foreach my $var (@vars_list) {
|
||||||
|
print " $var;\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\n";
|
||||||
|
print " remoteDriverLock(priv);\n";
|
||||||
|
print "\n";
|
||||||
|
|
||||||
|
if (@setters_list) {
|
||||||
|
print " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
print join("\n ", @setters_list);
|
||||||
|
|
||||||
|
if (@setters_list) {
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\n";
|
||||||
|
print " if (call($priv_src, priv, 0, ${procprefix}_PROC_$call->{UC_NAME},\n";
|
||||||
|
print " (xdrproc_t)xdr_$call->{args}, (char *)$args,\n";
|
||||||
|
print " (xdrproc_t)xdr_$call->{ret}, (char *)$ret) == -1)\n";
|
||||||
|
print " goto done;\n";
|
||||||
|
print "\n";
|
||||||
|
print " rv = 0;\n";
|
||||||
|
print "\n";
|
||||||
|
print "done:\n";
|
||||||
|
print " remoteDriverUnlock(priv);\n";
|
||||||
|
print " return rv;\n";
|
||||||
|
print "}\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -162,8 +162,19 @@ REMOTE_DRIVER_SOURCES = \
|
|||||||
remote/qemu_protocol.c \
|
remote/qemu_protocol.c \
|
||||||
remote/qemu_protocol.h
|
remote/qemu_protocol.h
|
||||||
|
|
||||||
|
remote/remote_driver.c: remote/remote_client_bodies.c remote/qemu_client_bodies.c
|
||||||
|
|
||||||
|
REMOTE_PROTOCOL = $(top_srcdir)/src/remote/remote_protocol.x
|
||||||
|
QEMU_PROTOCOL = $(top_srcdir)/src/remote/qemu_protocol.x
|
||||||
|
|
||||||
|
remote/remote_client_bodies.c: $(top_srcdir)/daemon/remote_generator.pl $(REMOTE_PROTOCOL)
|
||||||
|
$(AM_V_GEN)perl -w $(top_srcdir)/daemon/remote_generator.pl -c -k remote $(REMOTE_PROTOCOL) > $@
|
||||||
|
|
||||||
|
remote/qemu_client_bodies.c: $(top_srcdir)/daemon/remote_generator.pl $(QEMU_PROTOCOL)
|
||||||
|
$(AM_V_GEN)perl -w $(top_srcdir)/daemon/remote_generator.pl -k remote $(QEMU_PROTOCOL) > $@
|
||||||
|
|
||||||
EXTRA_DIST += remote/remote_protocol.x remote/qemu_protocol.x \
|
EXTRA_DIST += remote/remote_protocol.x remote/qemu_protocol.x \
|
||||||
remote/rpcgen_fix.pl
|
remote/rpcgen_fix.pl remote/remote_client_bodies.c remote/qemu_client_bodies.c
|
||||||
|
|
||||||
# Ensure that we don't change the struct or member names or member ordering
|
# Ensure that we don't change the struct or member names or member ordering
|
||||||
# in remote_protocol.x The embedded perl below needs a few comments, and
|
# in remote_protocol.x The embedded perl below needs a few comments, and
|
||||||
|
3
src/remote/qemu_client_bodies.c
Normal file
3
src/remote/qemu_client_bodies.c
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/* Automatically generated by remote_generator.pl.
|
||||||
|
* Do not edit this file. Any changes you make will be lost.
|
||||||
|
*/
|
1390
src/remote/remote_client_bodies.c
Normal file
1390
src/remote/remote_client_bodies.c
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user