[libvirt] [PATCH 1/2] interface: Introduce netcfInterfaceObjIsActive

Eric Blake eblake at redhat.com
Wed Dec 11 19:03:34 UTC 2013


On 12/11/2013 05:41 AM, Michal Privoznik wrote:

>>> +static int
>>> +netcfInterfaceObjIsActive(struct netcf_if *iface,
>>> +                          bool *active)
>>> +{
>>> +    int ret = -1;
>>> +    unsigned int flags = 0;
>>> +
>>> +    virObjectRef(driverState);
>>
>> What's the ref / unref of driverState for ? The code you're
>> replacing doesn't do that, and AFAICT this shouldn't be
>> required since we're always calling this from public API
>> context
> 
> Well, for now it is not required, true. But I was thinking if somebody
> rewrites something this part wouldn't need any change as it's already
> foolproof. But I don't mind dropping ref and unref.

Spurious locking now for future code patches is counter-productive; if
someone adds code that needs locking, we can add the locking at that
point (and ideally keeping things lockless is the better approach).  So
yes, let's drop the ref and unref.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131211/26302ead/attachment-0001.sig>


More information about the libvir-list mailing list