<linux/uuid.h> pulls in <linux/string.h> for its helpers, which makes it
unusable from headers low in the include chain. The next patches embed
UUIDs and GUIDs in kuid_t and kgid_t, whose <linux/uidgid_types.h> is
included by <linux/sched.h>.

Move the two types and UUID_SIZE into a header of their own that only
needs <linux/types.h>. <linux/uuid.h> includes it, so no user changes.

No functional change.

Assisted-by: Claude:claude-opus-5-5

Signed-off-by: Jan Koester <[email protected]>
---
 include/linux/uuid.h       | 11 +----------
 include/linux/uuid_types.h | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 10 deletions(-)
 create mode 100644 include/linux/uuid_types.h

diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 43d4a79b27..cbdaf0ca45 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -9,16 +9,7 @@
 #define _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;
+#include <linux/uuid_types.h>
 
 #define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)                     
\
 ((guid_t)                                                              \
diff --git a/include/linux/uuid_types.h b/include/linux/uuid_types.h
new file mode 100644
index 0000000000..1e45b69571
--- /dev/null
+++ b/include/linux/uuid_types.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * UUID/GUID types, without the helpers of <linux/uuid.h>, for headers
+ * low in the include chain (such as <linux/uidgid_types.h>)
+ */
+#ifndef _LINUX_UUID_TYPES_H_
+#define _LINUX_UUID_TYPES_H_
+
+#include <linux/types.h>
+
+#define UUID_SIZE 16
+
+typedef struct {
+       __u8 b[UUID_SIZE];
+} guid_t;
+
+typedef struct {
+       __u8 b[UUID_SIZE];
+} uuid_t;
+
+#endif /* _LINUX_UUID_TYPES_H_ */
-- 
2.56.0


Reply via email to