Message ID | 20211001113747.64040-2-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v3,1/4] modpost: Mark uuid_le type only for MEI | expand |
On Fri, Oct 01, 2021 at 02:37:45PM +0300, Andy Shevchenko wrote: > The guid_t type was defined in UAPI by mistake. > Keep it an internal type and leave uuid_le UAPI > for it's only user, i.e. MEI. It's used in they hyper-v drivers as a uapi between the kernel and the hypervisor, so isn't that something valid here? As I didn't see a 0/4 for this series, I'm confused as to your end-goal here. What are you trying to do with this series? thanks, greg k-h
On Fri, Oct 01, 2021 at 02:01:15PM +0200, Greg Kroah-Hartman wrote: > On Fri, Oct 01, 2021 at 02:37:45PM +0300, Andy Shevchenko wrote: > > The guid_t type was defined in UAPI by mistake. > > Keep it an internal type and leave uuid_le UAPI > > for it's only user, i.e. MEI. > > It's used in they hyper-v drivers as a uapi between the kernel and the > hypervisor, so isn't that something valid here? I'm not sure I see that interface defined in the kernel. As far as I remember the guid_t is used solely inside kernel by Hyper-V code and the rest is using raw buffers. Can you point out to the specific place(s)? > As I didn't see a 0/4 for this series, I'm confused as to your end-goal > here. What are you trying to do with this series? End goal is to decouple internal type, which is guid_t, from ABI, where should be something else in use, like __u8[16] or so. We have two internal types, i.e. uuid_t and guid_t that are differs by byte ordering (when represented as human-readable string). uuid_t is provided by libuuid in the user space and its definition may be quite different to what we have inside kernel. Kernel already hide that one. guid_t is a leftover. I will create a cover letter for next version.
On Fri, Oct 01, 2021 at 04:15:44PM +0300, Andy Shevchenko wrote: > On Fri, Oct 01, 2021 at 02:01:15PM +0200, Greg Kroah-Hartman wrote: > > On Fri, Oct 01, 2021 at 02:37:45PM +0300, Andy Shevchenko wrote: > > > The guid_t type was defined in UAPI by mistake. > > > Keep it an internal type and leave uuid_le UAPI > > > for it's only user, i.e. MEI. > > > > It's used in they hyper-v drivers as a uapi between the kernel and the > > hypervisor, so isn't that something valid here? > > I'm not sure I see that interface defined in the kernel. As far as I remember > the guid_t is used solely inside kernel by Hyper-V code and the rest is using > raw buffers. Can you point out to the specific place(s)? Ah, it's a leftover inclusion in the uapi! Thanks for noticing. I will add a patch to replace it.
diff --git a/include/linux/uuid.h b/include/linux/uuid.h index 8cdc0d3567cd..5be158a49e11 100644 --- a/include/linux/uuid.h +++ b/include/linux/uuid.h @@ -8,15 +8,25 @@ #ifndef _LINUX_UUID_H_ #define _LINUX_UUID_H_ -#include <uapi/linux/uuid.h> #include <linux/string.h> #define UUID_SIZE 16 +typedef struct { + __u8 b[UUID_SIZE]; +} guid_t; + typedef struct { __u8 b[UUID_SIZE]; } uuid_t; +#define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ +((guid_t) \ +{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ + (b) & 0xff, ((b) >> 8) & 0xff, \ + (c) & 0xff, ((c) >> 8) & 0xff, \ + (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) + #define UUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ ((uuid_t) \ {{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \ @@ -97,10 +107,12 @@ extern const u8 uuid_index[16]; int guid_parse(const char *uuid, guid_t *u); int uuid_parse(const char *uuid, uuid_t *u); -/* backwards compatibility, don't use in new code */ -static inline int uuid_le_cmp(const guid_t u1, const guid_t u2) +/* MEI UUID type, don't use anywhere else */ +#include <uapi/linux/uuid.h> + +static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2) { - return memcmp(&u1, &u2, sizeof(guid_t)); + return memcmp(&u1, &u2, sizeof(uuid_le)); } #endif diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h index e5a7eecef7c3..c3e175f686f4 100644 --- a/include/uapi/linux/uuid.h +++ b/include/uapi/linux/uuid.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* - * UUID/GUID definition + * MEI UUID definition * * Copyright (C) 2010, Intel Corp. * Huang Ying <ying.huang@intel.com> @@ -22,21 +22,17 @@ typedef struct { __u8 b[16]; -} guid_t; +} uuid_le; -#define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ -((guid_t) \ +#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ +((uuid_le) \ {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ (b) & 0xff, ((b) >> 8) & 0xff, \ (c) & 0xff, ((c) >> 8) & 0xff, \ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) -/* backwards compatibility, don't use in new code */ -typedef guid_t uuid_le; -#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ - GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) #define NULL_UUID_LE \ UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00) + 0x00, 0x00, 0x00, 0x00) #endif /* _UAPI_LINUX_UUID_H_ */
The guid_t type was defined in UAPI by mistake. Keep it an internal type and leave uuid_le UAPI for it's only user, i.e. MEI. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- v3: no change include/linux/uuid.h | 20 ++++++++++++++++---- include/uapi/linux/uuid.h | 14 +++++--------- 2 files changed, 21 insertions(+), 13 deletions(-)