From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWb1t-00024l-8g for qemu-devel@nongnu.org; Sun, 07 Aug 2016 23:15:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWb1s-0000ko-6Q for qemu-devel@nongnu.org; Sun, 07 Aug 2016 23:15:05 -0400 Date: Mon, 8 Aug 2016 11:07:54 +0800 From: Fam Zheng Message-ID: <20160808030754.GC18330@al.usersys.redhat.com> References: <1470129518-21087-1-git-send-email-famz@redhat.com> <1470129518-21087-2-git-send-email-famz@redhat.com> <20160804153300.GA2950@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160804153300.GA2950@localhost.localdomain> Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 1/7] util: Add UUID API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody Cc: qemu-devel@nongnu.org, kwolf@redhat.com, berrange@redhat.com, qemu-block@nongnu.org, armbru@redhat.com, mdroth@linux.vnet.ibm.com, mreitz@redhat.com, pbonzini@redhat.com, sw@weilnetz.de 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