linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] modpost: Mark uuid_le type only for MEI
@ 2020-10-30 18:49 Andy Shevchenko
  2020-10-30 18:49 ` [PATCH v2 2/2] uuid: Make guid_t completely internal type to the kernel Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2020-10-30 18:49 UTC (permalink / raw)
  To: Christoph Hellwig, linux-kernel, Masahiro Yamada, Michal Marek,
	linux-kbuild
  Cc: Andy Shevchenko

The uuid_le type is used only for MEI ABI, do not advertise it for others.
Due to above, bury add_uuid() in its only user.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no changes
 scripts/mod/file2alias.c | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 8a438c94dcd9..fefff92b33ef 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -34,19 +34,22 @@ typedef Elf64_Addr	kernel_ulong_t;
 typedef uint32_t	__u32;
 typedef uint16_t	__u16;
 typedef unsigned char	__u8;
+
 typedef struct {
 	__u8 b[16];
 } guid_t;
 
-/* backwards compatibility, don't use in new code */
-typedef struct {
-	__u8 b[16];
-} uuid_le;
 typedef struct {
 	__u8 b[16];
 } uuid_t;
+
 #define	UUID_STRING_LEN		36
 
+/* MEI UUID type, don't use anywhere else */
+typedef struct {
+	__u8 b[16];
+} uuid_le;
+
 /* Big exception to the "don't include kernel headers into userspace, which
  * even potentially has different endianness and word sizes, since
  * we handle those differences explicitly below */
@@ -104,17 +107,6 @@ static inline void add_wildcard(char *str)
 		strcat(str + len, "*");
 }
 
-static inline void add_uuid(char *str, uuid_le uuid)
-{
-	int len = strlen(str);
-
-	sprintf(str + len, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-		uuid.b[3], uuid.b[2], uuid.b[1], uuid.b[0],
-		uuid.b[5], uuid.b[4], uuid.b[7], uuid.b[6],
-		uuid.b[8], uuid.b[9], uuid.b[10], uuid.b[11],
-		uuid.b[12], uuid.b[13], uuid.b[14], uuid.b[15]);
-}
-
 /**
  * Check that sizeof(device_id type) are consistent with size of section
  * in .o file. If in-consistent then userspace and kernel does not agree
@@ -1198,12 +1190,16 @@ static int do_mei_entry(const char *filename, void *symval,
 			char *alias)
 {
 	DEF_FIELD_ADDR(symval, mei_cl_device_id, name);
-	DEF_FIELD_ADDR(symval, mei_cl_device_id, uuid);
+	DEF_FIELD(symval, mei_cl_device_id, uuid);
 	DEF_FIELD(symval, mei_cl_device_id, version);
 
 	sprintf(alias, MEI_CL_MODULE_PREFIX);
 	sprintf(alias + strlen(alias), "%s:",  (*name)[0]  ? *name : "*");
-	add_uuid(alias, *uuid);
+	sprintf(alias + strlen(alias), "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+		uuid.b[3], uuid.b[2], uuid.b[1], uuid.b[0],
+		uuid.b[5], uuid.b[4], uuid.b[7], uuid.b[6],
+		uuid.b[8], uuid.b[9], uuid.b[10], uuid.b[11],
+		uuid.b[12], uuid.b[13], uuid.b[14], uuid.b[15]);
 	ADD(alias, ":", version != MEI_CL_VERSION_ANY, version);
 
 	strcat(alias, ":*");
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] uuid: Make guid_t completely internal type to the kernel
  2020-10-30 18:49 [PATCH v2 1/2] modpost: Mark uuid_le type only for MEI Andy Shevchenko
@ 2020-10-30 18:49 ` Andy Shevchenko
  2020-11-16 11:40   ` Andy Shevchenko
  2020-11-24 13:39   ` Christoph Hellwig
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-10-30 18:49 UTC (permalink / raw)
  To: Christoph Hellwig, linux-kernel, Masahiro Yamada, Michal Marek,
	linux-kbuild
  Cc: Andy Shevchenko

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>
---
v2: converted uuid_le_cmp() to old type
 include/linux/uuid.h      | 20 ++++++++++++++++----
 include/uapi/linux/uuid.h | 14 +++++---------
 2 files changed, 21 insertions(+), 13 deletions(-)

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_ */
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] uuid: Make guid_t completely internal type to the kernel
  2020-10-30 18:49 ` [PATCH v2 2/2] uuid: Make guid_t completely internal type to the kernel Andy Shevchenko
@ 2020-11-16 11:40   ` Andy Shevchenko
  2020-11-24 13:39   ` Christoph Hellwig
  1 sibling, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-11-16 11:40 UTC (permalink / raw)
  To: Christoph Hellwig, linux-kernel, Masahiro Yamada, Michal Marek,
	linux-kbuild

On Fri, Oct 30, 2020 at 08:49:50PM +0200, 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.

Any comments on this series?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] uuid: Make guid_t completely internal type to the kernel
  2020-10-30 18:49 ` [PATCH v2 2/2] uuid: Make guid_t completely internal type to the kernel Andy Shevchenko
  2020-11-16 11:40   ` Andy Shevchenko
@ 2020-11-24 13:39   ` Christoph Hellwig
  2020-11-24 14:07     ` Andy Shevchenko
  1 sibling, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2020-11-24 13:39 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Christoph Hellwig, linux-kernel, Masahiro Yamada, Michal Marek,
	linux-kbuild

On Fri, Oct 30, 2020 at 08:49:50PM +0200, Andy Shevchenko wrote:
> 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;

IMHO we should kill this header entirely and move the definition to
<uapi/linux/mei.h> under a new name so that no one picks up the
definition by accident.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] uuid: Make guid_t completely internal type to the kernel
  2020-11-24 13:39   ` Christoph Hellwig
@ 2020-11-24 14:07     ` Andy Shevchenko
  2020-11-24 14:38       ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2020-11-24 14:07 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-kernel, Masahiro Yamada, Michal Marek, linux-kbuild

On Tue, Nov 24, 2020 at 02:39:45PM +0100, Christoph Hellwig wrote:
> On Fri, Oct 30, 2020 at 08:49:50PM +0200, Andy Shevchenko wrote:
> > 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;
> 
> IMHO we should kill this header entirely and move the definition to
> <uapi/linux/mei.h> under a new name so that no one picks up the
> definition by accident.

I would like to do that in a separate series. Here I don't change the status
quo about using it, but for moving it will require to touch MEI code.


-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] uuid: Make guid_t completely internal type to the kernel
  2020-11-24 14:07     ` Andy Shevchenko
@ 2020-11-24 14:38       ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2020-11-24 14:38 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Christoph Hellwig, linux-kernel, Masahiro Yamada, Michal Marek,
	linux-kbuild

On Tue, Nov 24, 2020 at 04:07:45PM +0200, Andy Shevchenko wrote:
> > 
> > IMHO we should kill this header entirely and move the definition to
> > <uapi/linux/mei.h> under a new name so that no one picks up the
> > definition by accident.
> 
> I would like to do that in a separate series. Here I don't change the status
> quo about using it, but for moving it will require to touch MEI code.

Maybe just keep a dummy empty uapi/linux/uuid.h if that is so much
of a problem.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-11-24 14:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30 18:49 [PATCH v2 1/2] modpost: Mark uuid_le type only for MEI Andy Shevchenko
2020-10-30 18:49 ` [PATCH v2 2/2] uuid: Make guid_t completely internal type to the kernel Andy Shevchenko
2020-11-16 11:40   ` Andy Shevchenko
2020-11-24 13:39   ` Christoph Hellwig
2020-11-24 14:07     ` Andy Shevchenko
2020-11-24 14:38       ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).