On Mon, May 23, 2011 at 07:36:09PM +0200, Matthias Bolte wrote:
In most cases this affects flags parameters that are unsigned in the
public and driver API but signed in the XDR protocol. Switch the
XDR protocol to unsigned for those.
A counterexample is virNWFilterGetXMLDesc. Its flags parameter is signed
in the public API and XDR protocol, but unsigned in the driver API.
---
daemon/remote_generator.pl | 16 ----------------
src/driver.h | 2 +-
src/nwfilter/nwfilter_driver.c | 2 +-
src/remote/remote_protocol.x | 30 +++++++++++++++---------------
src/remote_protocol-structs | 30 +++++++++++++++---------------
5 files changed, 32 insertions(+), 48 deletions(-)
diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
index 9143b3a..ac808fb 100755
--- a/daemon/remote_generator.pl
+++ b/daemon/remote_generator.pl
@@ -896,22 +896,6 @@ elsif ($opt_k) {
$type_name .= $2;
$type_name =~ s/hyper/long/;
- if ($type_name eq "int") {
- # fix bad decisions in the xdr protocol
- if ($arg_name eq "flags" and
- $call->{ProcName} ne "DomainCoreDump" and
- $call->{ProcName} ne "DomainGetXMLDesc" and
- $call->{ProcName} ne "NetworkGetXMLDesc") {
- $type_name = "unsigned int";
- } elsif ($arg_name eq "nvcpus" and
- $call->{ProcName} eq "DomainSetVcpus") {
- $type_name = "unsigned int";
- } elsif ($arg_name eq "vcpu" and
- $call->{ProcName} eq "DomainPinVcpu") {
- $type_name = "unsigned int";
- }
- }
-
# SPECIAL: some hyper parameters map to long longs
if (($call->{ProcName} eq "DomainMigrateSetMaxDowntime"
and
$arg_name eq "downtime") or
diff --git a/src/driver.h b/src/driver.h
index 450dd53..58e8f02 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -1282,7 +1282,7 @@ typedef int
typedef char *
(*virDrvNWFilterGetXMLDesc) (virNWFilterPtr nwfilter,
- unsigned int flags);
+ int flags);
typedef struct _virNWFilterDriver virNWFilterDriver;
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index db3d789..d9ac17e 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -407,7 +407,7 @@ cleanup:
static char *
nwfilterGetXMLDesc(virNWFilterPtr obj,
- unsigned int flags) {
+ int flags) {
virNWFilterDriverStatePtr driver = obj->conn->nwfilterPrivateData;
virNWFilterObjPtr nwfilter;
char *ret = NULL;
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index f5218cd..2b9f9de 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -430,7 +430,7 @@ struct remote_get_max_vcpus_ret {
struct remote_node_get_info_ret {
char model[32];
- hyper memory;
+ unsigned hyper memory;
int cpus;
int mhz;
int nodes;
@@ -612,7 +612,7 @@ struct remote_num_of_domains_ret {
struct remote_domain_create_xml_args {
remote_nonnull_string xml_desc;
- int flags;
+ unsigned int flags;
};
struct remote_domain_create_xml_ret {
@@ -657,7 +657,7 @@ struct remote_domain_shutdown_args {
struct remote_domain_reboot_args {
remote_nonnull_domain dom;
- int flags;
+ unsigned int flags;
};
struct remote_domain_destroy_args {
@@ -843,7 +843,7 @@ struct remote_domain_inject_nmi_args {
struct remote_domain_set_vcpus_args {
remote_nonnull_domain dom;
- int nvcpus;
+ unsigned int nvcpus;
};
struct remote_domain_set_vcpus_flags_args {
@@ -863,7 +863,7 @@ struct remote_domain_get_vcpus_flags_ret {
struct remote_domain_pin_vcpu_args {
remote_nonnull_domain dom;
- int vcpu;
+ unsigned int vcpu;
opaque cpumap<REMOTE_CPUMAP_MAX>;
};
@@ -1527,7 +1527,7 @@ struct remote_node_device_reset_args {
struct remote_node_device_create_xml_args {
remote_nonnull_string xml_desc;
- int flags;
+ unsigned int flags;
};
struct remote_node_device_create_xml_ret {
@@ -1871,7 +1871,7 @@ struct remote_domain_managed_save_remove_args {
struct remote_domain_snapshot_create_xml_args {
remote_nonnull_domain dom;
remote_nonnull_string xml_desc;
- int flags;
+ unsigned int flags;
};
struct remote_domain_snapshot_create_xml_ret {
@@ -1880,7 +1880,7 @@ struct remote_domain_snapshot_create_xml_ret {
struct remote_domain_snapshot_get_xml_desc_args {
remote_nonnull_domain_snapshot snap;
- int flags;
+ unsigned int flags;
};
struct remote_domain_snapshot_get_xml_desc_ret {
@@ -1889,7 +1889,7 @@ struct remote_domain_snapshot_get_xml_desc_ret {
struct remote_domain_snapshot_num_args {
remote_nonnull_domain dom;
- int flags;
+ unsigned int flags;
};
struct remote_domain_snapshot_num_ret {
@@ -1899,7 +1899,7 @@ struct remote_domain_snapshot_num_ret {
struct remote_domain_snapshot_list_names_args {
remote_nonnull_domain dom;
int maxnames;
- int flags;
+ unsigned int flags;
};
struct remote_domain_snapshot_list_names_ret {
@@ -1909,7 +1909,7 @@ struct remote_domain_snapshot_list_names_ret {
struct remote_domain_snapshot_lookup_by_name_args {
remote_nonnull_domain dom;
remote_nonnull_string name;
- int flags;
+ unsigned int flags;
};
struct remote_domain_snapshot_lookup_by_name_ret {
@@ -1918,7 +1918,7 @@ struct remote_domain_snapshot_lookup_by_name_ret {
struct remote_domain_has_current_snapshot_args {
remote_nonnull_domain dom;
- int flags;
+ unsigned int flags;
};
struct remote_domain_has_current_snapshot_ret {
@@ -1927,7 +1927,7 @@ struct remote_domain_has_current_snapshot_ret {
struct remote_domain_snapshot_current_args {
remote_nonnull_domain dom;
- int flags;
+ unsigned int flags;
};
struct remote_domain_snapshot_current_ret {
@@ -1936,12 +1936,12 @@ struct remote_domain_snapshot_current_ret {
struct remote_domain_revert_to_snapshot_args {
remote_nonnull_domain_snapshot snap;
- int flags;
+ unsigned int flags;
};
struct remote_domain_snapshot_delete_args {
remote_nonnull_domain_snapshot snap;
- int flags;
+ unsigned int flags;
};
struct remote_domain_open_console_args {
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index fd23fa0..04f36ca 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -140,7 +140,7 @@ struct remote_get_max_vcpus_ret {
};
struct remote_node_get_info_ret {
char model[32];
- int64_t memory;
+ uint64_t memory;
int cpus;
int mhz;
int nodes;
@@ -325,7 +325,7 @@ struct remote_num_of_domains_ret {
};
struct remote_domain_create_xml_args {
remote_nonnull_string xml_desc;
- int flags;
+ u_int flags;
};
struct remote_domain_create_xml_ret {
remote_nonnull_domain dom;
@@ -359,7 +359,7 @@ struct remote_domain_shutdown_args {
};
struct remote_domain_reboot_args {
remote_nonnull_domain dom;
- int flags;
+ u_int flags;
};
struct remote_domain_destroy_args {
remote_nonnull_domain dom;
@@ -526,7 +526,7 @@ struct remote_domain_inject_nmi_args {
};
struct remote_domain_set_vcpus_args {
remote_nonnull_domain dom;
- int nvcpus;
+ u_int nvcpus;
};
struct remote_domain_set_vcpus_flags_args {
remote_nonnull_domain dom;
@@ -542,7 +542,7 @@ struct remote_domain_get_vcpus_flags_ret {
};
struct remote_domain_pin_vcpu_args {
remote_nonnull_domain dom;
- int vcpu;
+ u_int vcpu;
struct {
u_int cpumap_len;
char * cpumap_val;
@@ -1103,7 +1103,7 @@ struct remote_node_device_reset_args {
};
struct remote_node_device_create_xml_args {
remote_nonnull_string xml_desc;
- int flags;
+ u_int flags;
};
struct remote_node_device_create_xml_ret {
remote_nonnull_node_device dev;
@@ -1370,21 +1370,21 @@ struct remote_domain_managed_save_remove_args {
struct remote_domain_snapshot_create_xml_args {
remote_nonnull_domain dom;
remote_nonnull_string xml_desc;
- int flags;
+ u_int flags;
};
struct remote_domain_snapshot_create_xml_ret {
remote_nonnull_domain_snapshot snap;
};
struct remote_domain_snapshot_get_xml_desc_args {
remote_nonnull_domain_snapshot snap;
- int flags;
+ u_int flags;
};
struct remote_domain_snapshot_get_xml_desc_ret {
remote_nonnull_string xml;
};
struct remote_domain_snapshot_num_args {
remote_nonnull_domain dom;
- int flags;
+ u_int flags;
};
struct remote_domain_snapshot_num_ret {
int num;
@@ -1392,7 +1392,7 @@ struct remote_domain_snapshot_num_ret {
struct remote_domain_snapshot_list_names_args {
remote_nonnull_domain dom;
int maxnames;
- int flags;
+ u_int flags;
};
struct remote_domain_snapshot_list_names_ret {
struct {
@@ -1403,32 +1403,32 @@ struct remote_domain_snapshot_list_names_ret {
struct remote_domain_snapshot_lookup_by_name_args {
remote_nonnull_domain dom;
remote_nonnull_string name;
- int flags;
+ u_int flags;
};
struct remote_domain_snapshot_lookup_by_name_ret {
remote_nonnull_domain_snapshot snap;
};
struct remote_domain_has_current_snapshot_args {
remote_nonnull_domain dom;
- int flags;
+ u_int flags;
};
struct remote_domain_has_current_snapshot_ret {
int result;
};
struct remote_domain_snapshot_current_args {
remote_nonnull_domain dom;
- int flags;
+ u_int flags;
};
struct remote_domain_snapshot_current_ret {
remote_nonnull_domain_snapshot snap;
};
struct remote_domain_revert_to_snapshot_args {
remote_nonnull_domain_snapshot snap;
- int flags;
+ u_int flags;
};
struct remote_domain_snapshot_delete_args {
remote_nonnull_domain_snapshot snap;
- int flags;
+ u_int flags;
};
struct remote_domain_open_console_args {
remote_nonnull_domain dom;
ACK
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|