[libvirt] [PATCH 3/5] net: use virDomainNICModelType{From|To}String functions

Guannan Ren gren at redhat.com
Tue Jan 15 08:41:03 UTC 2013


On 01/14/2013 10:25 PM, John Ferlan wrote:
> oops - one more ...
>
> On 01/13/2013 10:34 AM, Guannan Ren wrote:
>> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
>> index 661cc0f..a5ce119 100644
>> --- a/src/conf/domain_conf.h
>> +++ b/src/conf/domain_conf.h
>> @@ -878,7 +878,7 @@ struct _virDomainActualNetDef {
>>   struct _virDomainNetDef {
>>       enum virDomainNetType type;
>>       virMacAddr mac;
>> -    char *model;
>> +    int model;
> Should this be?
>
>      enum virDomainNICModel model;
>
> for consistency.
>
>

     Some places where we write code like this:
     if ((net->model = virDomainNICModelTypeFromString(model)) < 0)
         ...

     If the model is type of enum and compile it with gcc option 
-Werror=type-limits
     gcc will report like:

     error: comparison of unsigned expression < 0 is always false 
[-Werror=type-limits]

     so we still need int type here.




More information about the libvir-list mailing list