[libvirt] [PATCH 3/5] remote generator: Unify unsigned int notation in .x files

Matthias Bolte matthias.bolte at googlemail.com
Tue May 10 18:50:17 UTC 2011


2011/5/9 Eric Blake <eblake at redhat.com>:
> On 05/07/2011 06:28 AM, Matthias Bolte wrote:
>> Rename u_int and unsigned to unsigned int. This gets rid of some special
>> case code in the generator.
>> ---
>>  daemon/remote_generator.pl   |   10 +++---
>>  src/remote/remote_protocol.x |   72 +++++++++++++++++++++---------------------
>>  2 files changed, 41 insertions(+), 41 deletions(-)
>>
>> diff --git a/daemon/remote_generator.pl b/daemon/remote_generator.pl
>> index 8d62c37..e6a0e2c 100755
>> --- a/daemon/remote_generator.pl
>> +++ b/daemon/remote_generator.pl
>> @@ -878,13 +878,13 @@ elsif ($opt_k) {
>>                      push(@setters_list, "args.$1.${1}_val = (char *)$1;");
>>                      push(@setters_list, "args.$1.${1}_len = ${1}len;");
>>                      push(@args_check_list, { name => "\"$1\"", arg => "${1}len", limit => $2 });
>> -                } elsif ($args_member =~ m/^(.*) (\S+);/) {
>> -                    my $type_name = $1;
>> -                    my $arg_name = $2;
>> +                } elsif ($args_member =~ m/^(unsigned )?(int|hyper) (\S+);/) {
>> +                    my $type_name;
>> +                    my $arg_name = $3;
>>
>> +                    $type_name = $1 if ($1);
>> +                    $type_name .= $2;
>>                      $type_name =~ s/hyper/long/;
>> -                    $type_name =~ s/^unsigned$/unsigned int/;
>> -                    $type_name =~ s/u_int/unsigned int/;
>
> Makes sense.  Certainly makes life stricter for $type_name, which is a
> good thing for maintenance.
>
>> +++ b/src/remote/remote_protocol.x
>> @@ -541,8 +541,8 @@ struct remote_domain_interface_stats_ret {
>>
>>  struct remote_domain_memory_stats_args {
>>      remote_nonnull_domain dom;
>> -    u_int maxStats;
>> -    u_int flags;
>> +    unsigned int maxStats;
>> +    unsigned int flags;
>
> Good change; http://www.ietf.org/rfc/rfc4506.txt only documents
> 'unsigned int identifier' [4.2], and not 'u_int' nor 'unsigned' for
> declaring unsigned 32-bit values.  rpcgen may have accepted those other
> aliases as an extension (or via an intermediate typedef), but we might
> as well stick as close to the specs as possible, especially if it makes
> life easier for our generator.
>
> ACK.
>

Thanks, pushed.

Matthias




More information about the libvir-list mailing list