qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH 1/7] util: Add UUID API


From: Fam Zheng
Subject: Re: [Qemu-block] [PATCH 1/7] util: Add UUID API
Date: Mon, 8 Aug 2016 11:07:54 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, 08/04 11:33, Jeff Cody wrote:
> > +void qemu_uuid_generate(qemu_uuid_t out)
> > +{
> > +    /* Version 4 UUID, RFC4122 4.4. */
> > +    QEMU_BUILD_BUG_ON(sizeof(qemu_uuid_t) != 16);
> > +    *((guint32 *)out + 0) = g_random_int();
> > +    *((guint32 *)out + 1) = g_random_int();
> > +    *((guint32 *)out + 2) = g_random_int();
> > +    *((guint32 *)out + 3) = g_random_int();
> > +    out[7] = (out[7] & 0xf) | 0x40;
> 
> Hi Fam,
> 
> I think this gets the endianness wrong of the time_hi_and_version field.
> 
> I believe this should be:
>     out[6] = (out[6] & 0xf) | 0x40;
> 
> (but I don't think we should generate it this way, see below)

Right, I'm using a wrong endianness. Will fix this.

Fam



reply via email to

[Prev in Thread] Current Thread [Next in Thread]