[libvirt] [PATCH v4] npiv: Auto-generate WWN if it's not specified
Eric Blake
eblake at redhat.com
Fri Feb 3 18:13:24 UTC 2012
On 02/03/2012 11:05 AM, Eric Blake wrote:
>> + if (virAsprintf(wwn, "%x%s%x%02x%02x%02x%02x", 0x5, QUMRANET_OUI,
>
> Why not just:
>
> if (virAsprintf(wwn, "5" QUMRANET_OUI "%010llx",
> (unsigned long long) virRandomBits(36)) < 0)
Correction - %09llx, for 36 bits of output from your random number.
I suppose you could also use
"5" QUMRANET_OUI "%09" PRIx64, virRandomBits(36)
to avoid the cast.
--
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: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120203/a6bc2b16/attachment-0001.sig>
More information about the libvir-list
mailing list