Re: [PATCH v2 01/10] conf: Introduce readonly to hostdev and change helper function

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

 



On 04/05/2013 05:10 AM, Han Cheng wrote:
> On 04/02/2013 10:15 AM, Hu Tao wrote:
>> On Mon, Apr 01, 2013 at 08:00:53PM +0800, Han Cheng wrote:
>>> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
>>> index edddf25..f8e3973 100644
>>> --- a/src/conf/domain_conf.h
>>> +++ b/src/conf/domain_conf.h
>>> @@ -439,6 +439,8 @@ struct _virDomainHostdevDef {
>>>       } source;
>>>       virDomainHostdevOrigStates origstates;
>>>       virDomainDeviceInfoPtr info; /* Guest address */
>>> +    /* readonly is only used for scsi hostdev */
>>> +    unsigned int readonly;
>>
>> bool readonly;
>>
>>>   };
>>>
>>>   /* Two types of disk backends */
>
> How about:
> struct _virDomainHostdevDef {
>     ...
>     unsigned int managed : 1;
>     unsigned int missing : 1;
>     unsigned int readonly : 1; /* readonly is only used for scsi
> hostdev */
>     ...
> };

Actually the use of bitfields for booleans has kind of fallen out of
favor in libvirt, and those left in the code seem to be there just
because nobody has thought it was important enough to change it. If you
want consistency, I think it would be more appropriate to make a patch
that changed managed and missing from bitfields into bool, then add
readonly as a bool too.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]