[libvirt] [PATCHv2 3/5] qemu: Implement bulk stats API and one of the stats groups to return
Peter Krempa
pkrempa at redhat.com
Tue Aug 26 19:06:20 UTC 2014
On 08/26/14 21:02, Eric Blake wrote:
> On 08/26/2014 08:14 AM, Peter Krempa wrote:
>> Implement the API function for virDomainListGetStats and
>> virConnectGetAllDomainStats in a modular way and implement the
>> VIR_DOMAIN_STATS_STATE group of statistics.
>> ---
>> src/qemu/qemu_driver.c | 175 +++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 175 insertions(+)
>>
>
>> + cleanup:
>> + if (dom)
>> + virObjectUnlock(dom);
>> +
>
> Useless if. virObjectUnlock(NULL) is safe. (Hmm, why isn't
> syntax-check catching it?)
>
Actually not useless. virObjectUnlock should not be called with NULL.
This doesn't crash but spews warnings:
/**
* virObjectUnlock:
* @anyobj: any instance of virObjectLockablePtr
*
* Release a lock on @anyobj. The lock must have been
* acquired by virObjectLock.
*/
void virObjectUnlock(void *anyobj)
{
virObjectLockablePtr obj = anyobj;
if (!virObjectIsClass(obj, virObjectLockableClass)) {
VIR_WARN("Object %p (%s) is not a virObjectLockable instance",
obj, obj ? obj->parent.klass->name : "(unknown)");
return;
}
virMutexUnlock(&obj->lock);
}
/**
* virObjectIsClass:
* @anyobj: any instance of virObjectPtr
* @klass: the class to check
*
* Checks whether @anyobj is an instance of
* @klass
*
* Returns true if @anyobj is an instance of @klass
*/
bool virObjectIsClass(void *anyobj,
virClassPtr klass)
{
virObjectPtr obj = anyobj;
if (!obj)
return false;
return virClassIsDerivedFrom(obj->klass, klass);
}
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140826/86bee696/attachment-0001.sig>
More information about the libvir-list
mailing list