[libvirt] [PATCH v4 2/9] New functions for virBitmap
Eric Blake
eblake at redhat.com
Tue Sep 18 14:29:15 UTC 2012
On 09/18/2012 01:27 AM, Osier Yang wrote:
> On 2012年09月14日 15:46, Hu Tao wrote:
>> In many places we store bitmap info in a chunk of data
>> (pointed to by a char *), and have redundant codes to
>> set/unset bits. This patch extends virBitmap, and convert
>> those codes to use virBitmap in subsequent patches.
>> ---
>> +
>> + memcpy(bitmap->map, data, len);
>> + for (i = 0; i< bitmap->map_len; i++)
>> + bitmap->map[i] = le64toh(bitmap->map[i]);
>
>
> le64toh is not portable. Such as on mingw platform.
Agreed - gnulib does not yet provide it, so we need to open-code this
ourselves instead of relying on a non-standard function.
>> + l = (unsigned long *)*data;
>> + for (i = 0; i< bitmap->map_len; i++, l++)
>> + *l = htole64(*l);
>
> Likewise.
Same here.
>> +
>> + return ffsl(bits) - 1 + nl * VIR_BITMAP_BITS_PER_UNIT;
>
> And ffsl.
But here, gnulib guarantees ffsl. We just need to modify bootstrap.conf
to pull it in.
--
Eric Blake eblake at 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: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120918/650d16b2/attachment-0001.sig>
More information about the libvir-list
mailing list