lkml.org 
[lkml]   [2017]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 03/16] uuid: rename uuid types
On Wed, May 10, 2017 at 9:02 PM, Christoph Hellwig <hch@lst.de> wrote:
> Our "little endian" UUID really is a Wintel GUID, so rename it and its
> helpers such (guid_t). The big endian UUID is the only true one, so
> give it the name uuid_t. The uuid_le and uuid_be names are retained for,
> but will hopefully go away soon.
>
> Also remove the existing typedef in XFS that's now been superceeded by
> the generic type name.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> [andy: also updated the UUID_LE/UUID_BE macros including fallout]
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
[...]

>
> -static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
> +static inline int guid_cmp(const guid_t u1, const guid_t u2)
> {
> - return memcmp(&u1, &u2, sizeof(uuid_le));
> + return memcmp(&u1, &u2, sizeof(guid_t));
> }
>
> -static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
> +static inline int uuid_cmp(const uuid_t u1, const uuid_t u2)
> {
> - return memcmp(&u1, &u2, sizeof(uuid_be));
> + return memcmp(&u1, &u2, sizeof(uuid_t));
> }
>


I think we should use this opportunity to change these to (uuid_t *, uuid_t *)
which is more in line with the rest of the helpers including the new helpers
hoisted from xfs.

[...]

> +/* backwards compatibility, don't use in new code */
> +#define uuid_le_cmp(u1, u2) guid_cmp(u1, u2)
> +#define uuid_be_cmp(u1, u2) uuid_cmp(u1, u2)

Therefore:
#define uuid_le_cmp(u1, u2) guid_cmp(&(u1), &(u2))
#define uuid_be_cmp(u1, u2) uuid_cmp(&(u1), &(u2))

\
 
 \ /
  Last update: 2017-05-10 21:22    [W:0.123 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site