[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] remote: remove special case for getting version



On Wed, May 11, 2011 at 04:50:28PM -0600, Eric Blake wrote:
> * src/remote/remote_protocol.x (remote_get_version_ret)
> (remote_get_lib_version_ret): Match public API.
> * daemon/remote_generator.pl: Drop special case.
> ---
> 
> By the way, the previous patch and this one both assume that
> Matthias' generator whitelist patch is applied.
> 
>  daemon/remote_generator.pl   |   23 +++++++++--------------
>  src/remote/remote_protocol.x |    4 ++--
>  2 files changed, 11 insertions(+), 16 deletions(-)
> 
> diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
> index c53ebc8..6d91d15 100755
> --- a/daemon/remote_generator.pl
> +++ b/daemon/remote_generator.pl
> @@ -504,13 +504,6 @@ elsif ($opt_b) {
>                      $type_name = $1 if ($1);
>                      $type_name .= "long";
> 
> -                    if ($type_name eq "long" and
> -                        $calls{$_}->{ProcName} =~ m/^Get(Lib)?Version$/) {
> -                        # SPECIAL: virConnectGet(Lib)?Version uses unsigned long
> -                        #          in public API but hyper in XDR protocol
> -                        $type_name = "unsigned long";
> -                    }
> -
>                      push(@vars_list, "$type_name $ret_name");
>                      push(@ret_list, "ret->$ret_name = $ret_name;");
>                      $single_ret_var = $ret_name;
> @@ -990,19 +983,21 @@ elsif ($opt_k) {
>                      $single_ret_type = "int";
>                  } elsif ($ret_member =~ m/^unsigned hyper (\S+);/) {
>                      my $arg_name = $1;
> -                    push(@ret_list, "rv = ret.$arg_name;");
> -                    $single_ret_var = "unsigned long rv = 0";
> -                    $single_ret_type = "unsigned long";
> -                } elsif ($ret_member =~ m/^hyper (\S+);/) {
> -                    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";
> -                    } elsif ($call->{ProcName} eq "NodeGetFreeMemory") {
> +                    } else {
> +                        push(@ret_list, "rv = ret.$arg_name;");
> +                        $single_ret_var = "unsigned long rv = 0";
> +                        $single_ret_type = "unsigned long";
> +                    }
> +                } elsif ($ret_member =~ m/^hyper (\S+);/) {
> +                    my $arg_name = $1;
> +
> +                    if ($call->{ProcName} eq "NodeGetFreeMemory") {
>                          push(@ret_list, "rv = ret.$arg_name;");
>                          $single_ret_var = "unsigned long long rv = 0";
>                          $single_ret_type = "unsigned long long";
> diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
> index 0b88353..04937e2 100644
> --- a/src/remote/remote_protocol.x
> +++ b/src/remote/remote_protocol.x
> @@ -391,11 +391,11 @@ struct remote_get_type_ret {
>  };
> 
>  struct remote_get_version_ret {
> -    hyper hv_ver;
> +    unsigned hyper hv_ver;
>  };
> 
>  struct remote_get_lib_version_ret {
> -    hyper lib_ver;
> +    unsigned hyper lib_ver;
>  };

Is this signed/unsigned change definitely compatible on the wire ?


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 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]