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

Re: [libvirt] [PATCH] Add domain type checking

On 07/11/2011 11:58 AM, Matthias Bolte wrote:
> 2011/7/11 Eric Blake <eblake redhat com>:
>> On 07/11/2011 10:16 AM, Matthias Bolte wrote:
>>>>> My only regret here is that we can't really suggest the value expected
>>>>> because QEmu accepts more than one, but for other drivers we should be
>>>>> able to provide what type is expected.
>>> Yes, we can do that even for QEMU. See attached diff between v2 and v3
>>> for easier review.
>>> +++ b/src/conf/domain_conf.c
>>> @@ -29,6 +29,7 @@
>>>  #include <fcntl.h>
>>>  #include <dirent.h>
>>>  #include <sys/time.h>
>>> +#include <math.h>
>> What was this needed for?
> For log2 to convert 1 << x back to x in case only one bit is set in
> expectedVirtTypes.

log2(), including -lm, is rather heavyweight.  It should be possible to
use ffs() from <strings.h> to do the same thing, and then we don't have
to worry about dragging in -lm.

I'll work up a patch tomorrow, if no one beats me to it tonight.

Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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