Re: [Qemu-devel] [PATCH v3 1/9] util: Add UUID API

2016-08-10 Thread Fam Zheng
On Wed, 08/10 16:25, Richard Henderson wrote: > On 08/09/2016 12:19 PM, Fam Zheng wrote: > >+/* Version 4 UUID (pseudo random numbers), RFC4122 4.4. */ > >+ > >+typedef struct { > >+unsigned char data[16]; > >+} QemuUUID; > ... > >+void qemu_uuid_generate(QemuUUID *uuid) > >+{ > >+int i; >

Re: [Qemu-devel] [PATCH v3 1/9] util: Add UUID API

2016-08-10 Thread Richard Henderson
On 08/09/2016 12:19 PM, Fam Zheng wrote: +/* Version 4 UUID (pseudo random numbers), RFC4122 4.4. */ + +typedef struct { +unsigned char data[16]; +} QemuUUID; ... +void qemu_uuid_generate(QemuUUID *uuid) +{ +int i; +uint32_t *out = (uint32_t *)&uuid->data[0]; You can't do this cas

Re: [Qemu-devel] [PATCH v3 1/9] util: Add UUID API

2016-08-09 Thread Fam Zheng
On Tue, 08/09 15:46, Jeff Cody wrote: > So the short of it: I think this new function should be explicitly called > something like "qemu_uuid_bswap()", and do blind bswaps. That makes it a > drop in replacement for VDI. Right, I should make it bswap. Fam

Re: [Qemu-devel] [PATCH v3 1/9] util: Add UUID API

2016-08-09 Thread Jeff Cody
On Tue, Aug 09, 2016 at 02:49:59PM +0800, Fam Zheng wrote: > A number of different places across the code base use CONFIG_UUID. Some > of them are soft dependency, some are not built if libuuid is not > available, some come with dummy fallback, some throws runtime error. > > It is hard to maintain

Re: [Qemu-devel] [PATCH v3 1/9] util: Add UUID API

2016-08-09 Thread Jeff Cody
On Tue, Aug 09, 2016 at 02:49:59PM +0800, Fam Zheng wrote: > A number of different places across the code base use CONFIG_UUID. Some > of them are soft dependency, some are not built if libuuid is not > available, some come with dummy fallback, some throws runtime error. > > It is hard to maintain

[Qemu-devel] [PATCH v3 1/9] util: Add UUID API

2016-08-08 Thread Fam Zheng
A number of different places across the code base use CONFIG_UUID. Some of them are soft dependency, some are not built if libuuid is not available, some come with dummy fallback, some throws runtime error. It is hard to maintain, and hard to reason for users. Since UUID is a simple standard with