[libvirt] [PATCHv3 01/12] lib: Add public api to enable atomic listing of guest

Peter Krempa pkrempa at redhat.com
Mon Jun 18 19:26:04 UTC 2012


On 06/14/12 17:35, Eric Blake wrote:
> On 06/11/2012 04:33 AM, Peter Krempa wrote:
>> This patch adds a new public api that lists domains. The new approach is
>> different from those used before. There are key points to this:
>>
>
>> +int
>> +virConnectListAllDomains(virConnectPtr conn,
>> +                         virDomainPtr **domains,
>> +                         unsigned int flags)
>> +{
>> +    VIR_DEBUG("conn=%p, domains=%p, flags=%x", conn, domains, flags);
>> +
>> +    virResetLastError();
>> +
>> +    if (!VIR_IS_CONNECT(conn)) {
>> +        virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
>> +        virDispatchError(NULL);
>> +        return -1;
>> +    }
>> +
>> +    if (domains)
>> +        *domains = NULL;
>
> If we are going to guarantee that *domains is NULL on error, then you
> need to hoist this statement above the !VIR_IS_CONNECT(conn) clause.
>

Moved and pushed; Thanks.

Peter




More information about the libvir-list mailing list