mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 06:25:19 +00:00
remote generator, client: Handle functions with wrapped return values
This commit is contained in:
parent
9de503f957
commit
a1c891ec1e
@ -756,82 +756,44 @@ elsif ($opt_k) {
|
|||||||
"CPUBaseline",
|
"CPUBaseline",
|
||||||
"DomainBlockStats",
|
"DomainBlockStats",
|
||||||
"DomainCreate",
|
"DomainCreate",
|
||||||
"DomainCreateXML",
|
|
||||||
"DomainDefineXML",
|
|
||||||
"DomainDestroy",
|
"DomainDestroy",
|
||||||
"DomainGetAutostart",
|
"DomainGetAutostart",
|
||||||
"DomainGetBlockInfo",
|
"DomainGetBlockInfo",
|
||||||
"DomainGetInfo",
|
"DomainGetInfo",
|
||||||
"StoragePoolLookupByUUID",
|
|
||||||
"NodeDeviceCreateXML",
|
|
||||||
"DomainGetJobInfo",
|
"DomainGetJobInfo",
|
||||||
"DomainInterfaceStats",
|
"DomainInterfaceStats",
|
||||||
"DomainLookupByID",
|
|
||||||
"DomainLookupByName",
|
|
||||||
"DomainLookupByUIID",
|
|
||||||
"DomainMigrateFinish",
|
"DomainMigrateFinish",
|
||||||
"NWFilterDefineXML",
|
"NWFilterDefineXML", # public API and XDR protocol mismatch
|
||||||
"NWFilterLookupByName",
|
|
||||||
"NWFilterLookupByUUID",
|
|
||||||
"SecretLookupByUUID",
|
|
||||||
"SecretLookupByUsage",
|
|
||||||
"StoragePoolCreateXML",
|
|
||||||
"DomainLookupByUUID",
|
|
||||||
"DomainMigratePerform",
|
"DomainMigratePerform",
|
||||||
"DomainMigrateFinish2",
|
"DomainMigrateFinish2",
|
||||||
"DomainSnapshotCreateXML",
|
|
||||||
"DomainSnapshotCurrent",
|
|
||||||
"DomainSnapshotListNames",
|
"DomainSnapshotListNames",
|
||||||
"GetLibVersion",
|
"GetLibVersion",
|
||||||
"GetMaxVcpus",
|
|
||||||
"DomainSnapshotLookupByName",
|
|
||||||
"DomainXMLFromNative",
|
|
||||||
"FindStoragePoolSources",
|
"FindStoragePoolSources",
|
||||||
"GetVersion",
|
"GetVersion",
|
||||||
"GetLibVersion",
|
|
||||||
"InterfaceDefineXML",
|
|
||||||
"InterfaceLookupByName",
|
|
||||||
"IsSecure",
|
"IsSecure",
|
||||||
"ListDefinedDomains",
|
"ListDefinedDomains",
|
||||||
"ListDefinedInterfaces",
|
"ListDefinedInterfaces",
|
||||||
"ListNWFilters",
|
"ListNWFilters",
|
||||||
"NetworkCreateXML",
|
|
||||||
"SupportsFeature",
|
"SupportsFeature",
|
||||||
"StorageVolLookupByPath",
|
|
||||||
"StorageVolGetInfo",
|
"StorageVolGetInfo",
|
||||||
"StorageVolCreateXML",
|
|
||||||
"StorageVolLookupByName",
|
|
||||||
"StorageVolLookupByKey",
|
|
||||||
"StoragePoolGetInfo",
|
"StoragePoolGetInfo",
|
||||||
"StorageVolCreateXMLFrom",
|
|
||||||
"StoragePoolLookupByName",
|
|
||||||
"NodeListDevices",
|
"NodeListDevices",
|
||||||
"NodeGetCellsFreeMemory",
|
"NodeGetCellsFreeMemory",
|
||||||
"ListDefinedNetworks",
|
"ListDefinedNetworks",
|
||||||
"DomainXMLToNative",
|
|
||||||
"StoragePoolListVolumes",
|
"StoragePoolListVolumes",
|
||||||
"SecretDefineXML",
|
|
||||||
"ListDomains",
|
"ListDomains",
|
||||||
"ListStoragePools",
|
"ListStoragePools",
|
||||||
"NetworkGetAutostart",
|
"NetworkGetAutostart",
|
||||||
"StoragePoolLookupByVolume",
|
|
||||||
"StoragePoolGetAutostart",
|
"StoragePoolGetAutostart",
|
||||||
"SecretSetValue",
|
"SecretSetValue",
|
||||||
"StoragePoolDefineXML",
|
|
||||||
"NodeGetInfo",
|
"NodeGetInfo",
|
||||||
"GetURI",
|
"GetURI",
|
||||||
"InterfaceLookupByMACString",
|
|
||||||
"ListInterfaces",
|
"ListInterfaces",
|
||||||
"NetworkDefineXML",
|
|
||||||
"NetworkLookupByName",
|
|
||||||
"ListDefinedStoragePools",
|
"ListDefinedStoragePools",
|
||||||
"NodeDeviceDettach",
|
"NodeDeviceDettach",
|
||||||
"NodeDeviceLookupByName",
|
|
||||||
"NodeGetFreeMemory",
|
|
||||||
"ListNetworks",
|
"ListNetworks",
|
||||||
"NodeDeviceListCaps",
|
"NodeDeviceListCaps",
|
||||||
"NodeDeviceReset",
|
"NodeDeviceReset",
|
||||||
"NetworkLookupByUUID",
|
|
||||||
"NodeDeviceReAttach",
|
"NodeDeviceReAttach",
|
||||||
"ListSecrets",
|
"ListSecrets",
|
||||||
|
|
||||||
@ -892,7 +854,9 @@ elsif ($opt_k) {
|
|||||||
my $has_node_device = 0;
|
my $has_node_device = 0;
|
||||||
|
|
||||||
# node device is special
|
# node device is special
|
||||||
if ($call->{args} =~ m/^remote_node_/) {
|
if ($call->{args} =~ m/^remote_node_/ and
|
||||||
|
!($call->{args} =~ m/^remote_node_device_lookup_by_name_/) and
|
||||||
|
!($call->{args} =~ m/^remote_node_device_create_xml_/)) {
|
||||||
$has_node_device = 1;
|
$has_node_device = 1;
|
||||||
$priv_name = "devMonPrivateData";
|
$priv_name = "devMonPrivateData";
|
||||||
}
|
}
|
||||||
@ -904,13 +868,14 @@ elsif ($opt_k) {
|
|||||||
push(@setters_list, "args.name = dev->name;");
|
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+);/) {
|
} elsif ($args_member =~ m/^remote_nonnull_(domain|network|storage_pool|storage_vol|interface|secret|nwfilter|domain_snapshot) (\S+);/) {
|
||||||
my $name = $1;
|
my $name = $1;
|
||||||
|
my $arg_name = $2;
|
||||||
my $type_name = name_to_ProcName($name);
|
my $type_name = name_to_ProcName($name);
|
||||||
|
|
||||||
if ($is_first_arg) {
|
if ($is_first_arg) {
|
||||||
if ($name eq "domain_snapshot") {
|
if ($name eq "domain_snapshot") {
|
||||||
$priv_src = "$2->domain->conn";
|
$priv_src = "$arg_name->domain->conn";
|
||||||
} else {
|
} else {
|
||||||
$priv_src = "$2->conn";
|
$priv_src = "$arg_name->conn";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($name =~ m/^storage_/) {
|
if ($name =~ m/^storage_/) {
|
||||||
@ -920,8 +885,11 @@ elsif ($opt_k) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
push(@args_list, "vir${type_name}Ptr $2");
|
push(@args_list, "vir${type_name}Ptr $arg_name");
|
||||||
push(@setters_list, "make_nonnull_$1(&args.$2, $2);");
|
push(@setters_list, "make_nonnull_$1(&args.$arg_name, $arg_name);");
|
||||||
|
} elsif ($args_member =~ m/^remote_uuid (\S+);/) {
|
||||||
|
push(@args_list, "const unsigned char *$1");
|
||||||
|
push(@setters_list, "memcpy(args.$1, $1, VIR_UUID_BUFLEN);");
|
||||||
} elsif ($args_member =~ m/^remote_string (\S+);/) {
|
} elsif ($args_member =~ m/^remote_string (\S+);/) {
|
||||||
push(@args_list, "const char *$1");
|
push(@args_list, "const char *$1");
|
||||||
push(@setters_list, "args.$1 = $1 ? (char **)&$1 : NULL;");
|
push(@setters_list, "args.$1 = $1 ? (char **)&$1 : NULL;");
|
||||||
@ -991,14 +959,42 @@ elsif ($opt_k) {
|
|||||||
push(@ret_list, "rv = ret.$1;");
|
push(@ret_list, "rv = ret.$1;");
|
||||||
$single_ret_var = "char *rv = NULL";
|
$single_ret_var = "char *rv = NULL";
|
||||||
$single_ret_type = "char *";
|
$single_ret_type = "char *";
|
||||||
|
} elsif ($ret_member =~ m/remote_nonnull_(domain|network|storage_pool|storage_vol|node_device|interface|secret|nwfilter|domain_snapshot) (\S+);/) {
|
||||||
|
my $name = $1;
|
||||||
|
my $arg_name = $2;
|
||||||
|
my $type_name = name_to_ProcName($name);
|
||||||
|
|
||||||
|
if ($name eq "node_device") {
|
||||||
|
$priv_name = "devMonPrivateData";
|
||||||
|
} elsif ($name =~ m/^storage_/) {
|
||||||
|
$priv_name = "storagePrivateData";
|
||||||
|
} elsif (!($name =~ m/^domain/)) {
|
||||||
|
$priv_name = "${name}PrivateData";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($name eq "domain_snapshot") {
|
||||||
|
push(@ret_list, "rv = get_nonnull_$name(dom, ret.$arg_name);");
|
||||||
|
} else {
|
||||||
|
push(@ret_list, "rv = get_nonnull_$name($priv_src, ret.$arg_name);");
|
||||||
|
}
|
||||||
|
|
||||||
|
push(@ret_list, "xdr_free((xdrproc_t)xdr_$call->{ret}, (char *)&ret);");
|
||||||
|
$single_ret_var = "vir${type_name}Ptr rv = NULL";
|
||||||
|
$single_ret_type = "vir${type_name}Ptr";
|
||||||
} elsif ($ret_member =~ m/^int (\S+);/) {
|
} elsif ($ret_member =~ m/^int (\S+);/) {
|
||||||
push(@ret_list, "rv = ret.$1;");
|
push(@ret_list, "rv = ret.$1;");
|
||||||
$single_ret_var = "int rv = -1";
|
$single_ret_var = "int rv = -1";
|
||||||
$single_ret_type = "int";
|
$single_ret_type = "int";
|
||||||
} elsif ($ret_member =~ m/hyper (\S+);/) {
|
} elsif ($ret_member =~ m/hyper (\S+);/) {
|
||||||
push(@ret_list, "rv = ret.$1;");
|
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";
|
||||||
|
} else {
|
||||||
$single_ret_var = "unsigned long rv = 0";
|
$single_ret_var = "unsigned long rv = 0";
|
||||||
$single_ret_type = "unsigned long";
|
$single_ret_type = "unsigned long";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
die "unhandled type for return value: $ret_member";
|
die "unhandled type for return value: $ret_member";
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user