git: 97009980c492 - main - LinuxKPI: add UUID_STRING_LEN and GUID_INIT to uuid.h

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 14 Feb 2022 23:52:49 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=97009980c492f5bc44a942cee09ac1ccfe4ae00a

commit 97009980c492f5bc44a942cee09ac1ccfe4ae00a
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-02-09 12:10:59 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-02-14 23:51:51 +0000

    LinuxKPI: add UUID_STRING_LEN and GUID_INIT to uuid.h
    
    Add a definition for UUID_STRING_LEN to uuid.h as needed by a driver.
    Also add GUID_INIT for drm-kmod [1].
    
    Submitted by:   wulf [1]
    MFC after:      3 days
    Reviewed by:    hselasky (earlier), wulf
    Differential Revision: https://reviews.freebsd.org/D34235
---
 sys/compat/linuxkpi/common/include/linux/uuid.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/uuid.h b/sys/compat/linuxkpi/common/include/linux/uuid.h
index a1f878b311a5..31a018497f78 100644
--- a/sys/compat/linuxkpi/common/include/linux/uuid.h
+++ b/sys/compat/linuxkpi/common/include/linux/uuid.h
@@ -33,6 +33,28 @@
 #ifndef	_LINUXKPI_LINUX_UUID_H
 #define	_LINUXKPI_LINUX_UUID_H
 
+#define	UUID_STRING_LEN	36
+
+#define	GUID_INIT(x0_3, x4_5, x6_7, x8, x9, x10, x11, x12, x13, x14, x15) \
+	((guid_t) { .x = { 						\
+		[0]  =  (x0_3)        & 0xff,				\
+		[1]  = ((x0_3) >> 8)  & 0xff,				\
+		[2]  = ((x0_3) >> 16) & 0xff,				\
+		[3]  = ((x0_3) >> 24) & 0xff,				\
+		[4]  =  (x4_5)        & 0xff,				\
+		[5]  = ((x4_5) >> 8)  & 0xff,				\
+		[6]  =  (x6_7)        & 0xff,				\
+		[7]  = ((x6_7) >> 8)  & 0xff,				\
+		[8]  =  (x8),						\
+		[9]  =  (x9),						\
+		[10] =  (x10),						\
+		[11] =  (x11),						\
+		[12] =  (x12),						\
+		[13] =  (x13),						\
+		[14] =  (x14),						\
+		[15] =  (x15)						\
+}})
+
 typedef struct {
 	char	x[16];
 } guid_t;