Re: [PATCH 03/16] uuid: rename uuid types
From: Amir Goldstein
Date: Wed May 10 2017 - 15:15:57 EST
On Wed, May 10, 2017 at 9:02 PM, Christoph Hellwig <hch@xxxxxx> 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@xxxxxx>
> [andy: also updated the UUID_LE/UUID_BE macros including fallout]
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
[...]
>
> -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))