Re: [PATCH v4] npiv: Auto-generate WWN if it's not specified

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

 



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@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]