Re: [Xen-devel] [PATCH v4 03/11] public: xen.h: add definitions for UUID handling

2017-08-31 Thread Jan Beulich
>>> On 31.08.17 at 15:21, wrote: > So, will it be acceptable to use my approach with that union? As per Ian's reply, go with just the containerized uint8_t[]. Jan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel

Re: [Xen-devel] [PATCH v4 03/11] public: xen.h: add definitions for UUID handling

2017-08-31 Thread Ian Jackson
Volodymyr Babchuk writes ("Re: [PATCH v4 03/11] public: xen.h: add definitions for UUID handling"): > Do you have any ideas how to indicate endianess of the fields, then? I > can just write it in the comments. But I fear of misuse. I definitely prefer your approach of providing only an array. (

Re: [Xen-devel] [PATCH v4 03/11] public: xen.h: add definitions for UUID handling

2017-08-31 Thread Volodymyr Babchuk
On 31.08.17 15:53, Jan Beulich wrote: On 31.08.17 at 14:24, wrote: Hi Jan, On 31.08.17 10:34, Jan Beulich wrote: On 30.08.17 at 18:20, wrote: My first intention was to declare union with all possible representations, so it would be possible to access the same UUID as an array of bytes or,

Re: [Xen-devel] [PATCH v4 03/11] public: xen.h: add definitions for UUID handling

2017-08-31 Thread Jan Beulich
>>> On 31.08.17 at 14:24, wrote: > Hi Jan, > > On 31.08.17 10:34, Jan Beulich wrote: > On 30.08.17 at 18:20, wrote: >>> My first intention was to declare union with all possible >>> representations, so it would be possible to access the same UUID as an >>> array of bytes or, for example, as

Re: [Xen-devel] [PATCH v4 03/11] public: xen.h: add definitions for UUID handling

2017-08-31 Thread Volodymyr Babchuk
Hi Jan, On 31.08.17 10:34, Jan Beulich wrote: On 30.08.17 at 18:20, wrote: My first intention was to declare union with all possible representations, so it would be possible to access the same UUID as an array of bytes or, for example, as Microsoft GUID. Like this: typedef union { /* UU

Re: [Xen-devel] [PATCH v4 03/11] public: xen.h: add definitions for UUID handling

2017-08-31 Thread Jan Beulich
>>> On 30.08.17 at 18:20, wrote: > My first intention was to declare union with all possible > representations, so it would be possible to access the same UUID as an > array of bytes or, for example, as Microsoft GUID. Like this: > > typedef union { > /* UUID represented as a 128-bit objec

Re: [Xen-devel] [PATCH v4 03/11] public: xen.h: add definitions for UUID handling

2017-08-30 Thread Volodymyr Babchuk
Hi Jan, On 23.08.17 14:29, Jan Beulich wrote: On 23.08.17 at 13:08, wrote: On 23.08.17 11:10, Jan Beulich wrote: On 22.08.17 at 16:37, wrote: I can't see why you want to map UUID to a certain structure. This is so that the type cannot mistakenly be passed to a function taking unsigned cha

Re: [Xen-devel] [PATCH v4 03/11] public: xen.h: add definitions for UUID handling

2017-08-23 Thread Jan Beulich
>>> On 23.08.17 at 13:08, wrote: > On 23.08.17 11:10, Jan Beulich wrote: > On 22.08.17 at 16:37, wrote: >>> I can't see why you want to map UUID to a certain structure. >> >> This is so that the type cannot mistakenly be passed to a function >> taking unsigned char *, or be assigned to a var

Re: [Xen-devel] [PATCH v4 03/11] public: xen.h: add definitions for UUID handling

2017-08-23 Thread Volodymyr Babchuk
Hello Jan On 23.08.17 11:10, Jan Beulich wrote: On 22.08.17 at 16:37, wrote: I can't see why you want to map UUID to a certain structure. This is so that the type cannot mistakenly be passed to a function taking unsigned char *, or be assigned to a variable of that type. Right, I see the po

Re: [Xen-devel] [PATCH v4 03/11] public: xen.h: add definitions for UUID handling

2017-08-23 Thread Jan Beulich
>>> On 22.08.17 at 16:37, wrote: > I can't see why you want to map UUID to a certain structure. This is so that the type cannot mistakenly be passed to a function taking unsigned char *, or be assigned to a variable of that type. Please see our TYPE_SAFE() macro which we use to specifically enclo

Re: [Xen-devel] [PATCH v4 03/11] public: xen.h: add definitions for UUID handling

2017-08-22 Thread Volodymyr Babchuk
Hi Jan, On 22.08.17 10:26, Jan Beulich wrote: On 21.08.17 at 22:27, wrote: --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -930,6 +930,15 @@ __DEFINE_XEN_GUEST_HANDLE(uint16, uint16_t); __DEFINE_XEN_GUEST_HANDLE(uint32, uint32_t); __DEFINE_XEN_GUEST_HANDLE(uint64, uint64_t

Re: [Xen-devel] [PATCH v4 03/11] public: xen.h: add definitions for UUID handling

2017-08-22 Thread Jan Beulich
>>> On 21.08.17 at 22:27, wrote: > --- a/xen/include/public/xen.h > +++ b/xen/include/public/xen.h > @@ -930,6 +930,15 @@ __DEFINE_XEN_GUEST_HANDLE(uint16, uint16_t); > __DEFINE_XEN_GUEST_HANDLE(uint32, uint32_t); > __DEFINE_XEN_GUEST_HANDLE(uint64, uint64_t); > > +typedef uint8_t xen_uuid_t[1

[Xen-devel] [PATCH v4 03/11] public: xen.h: add definitions for UUID handling

2017-08-21 Thread Volodymyr Babchuk
Added type xen_uuid_t. This type represents UUID as an array of 16 bytes in big endian format. Added macro XEN_DEFINE_UUID that constructs UUID in the usual way: XEN_DEFINE_UUID(00112233, 4455, 6677, 8899, aabbccddeeff) will construct UUID 00112233-4455-6677-8899-aabbccddeeff presented as {0x0