[libvirt] [PATCH] rpc: Make the dispatch generator handle 'void name(void)' style procedures

Daniel P. Berrange berrange at redhat.com
Tue Jul 19 12:49:43 UTC 2011


On Tue, Jul 19, 2011 at 02:22:10PM +0200, Matthias Bolte wrote:
> Currently there are no such procedures in the protocol, but programming
> errors like a missing _args or _ret suffix on the structs in the .x files
> can create such a situation by accident. Making the generator aware of
> this avoids bogus errors from the generator such as:
> 
>   Use of uninitialized value in exists at ./rpc/gendispatch.pl line 967.
> 
> Reported by Michal Privoznik
> ---
>  src/rpc/gendispatch.pl |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
> index e068b53..e6a4a1c 100755
> --- a/src/rpc/gendispatch.pl
> +++ b/src/rpc/gendispatch.pl
> @@ -143,6 +143,20 @@ while (<PROTOCOL>) {
>          $flags = $3;
>          $ProcName = name_to_ProcName ($name);
>  
> +        if (!exists $calls{$name}) {
> +            # that the argument and return value cases have not yet added
> +            # this procedure to the calls hash means that it has no arguments
> +            # and no return value. add it to the calls hash now because all
> +            # procedures have to be listed in the calls hash
> +            $calls{$name} = {
> +                name => $name,
> +                ProcName => $ProcName,
> +                UC_NAME => uc $name,
> +                args => "void",
> +                ret => "void"
> +            }
> +        }
> +

Looks fine, but we currently have a evil hack in the generator


# only generate a close method if -c was passed
if ($opt_c) {
    # REMOTE_PROC_CLOSE has no args or ret.
    $calls{close} = {
        name => "close",
        ProcName => "Close",
        UC_NAME => "CLOSE",
        args => "void",
        ret => "void",
    };
}

it seems like your patch would let us remove this -c arg and the
corresponding code ?

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




More information about the libvir-list mailing list