git: fce354b0e9eb - main - linuxkpi: add uuid_t and helpers
Date: Sat, 17 Oct 2026 19:56:02 UTC
The branch main has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=fce354b0e9ebd682b251de17bc743d8d855e0cdd
commit fce354b0e9ebd682b251de17bc743d8d855e0cdd
Author: Denis Borovikov <denis.borovikov@gmail.com>
AuthorDate: 2026-10-17 19:55:17 +0000
Commit: Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2026-10-17 19:55:17 +0000
linuxkpi: add uuid_t and helpers
linux/uuid.h has only the guid_t family. Add uuid_t, next to guid_t,
with uuid_equal(), uuid_copy(), import_uuid() and export_uuid(),
mirroring the guid_ versions.
Used by drm/virtio for dma-buf UUID export.
Signed-off-by: Denis Borovikov <denis.borovikov@gmail.com>
Reviewed by: wulf
Differential Revision: https://reviews.freebsd.org/D60199
---
sys/compat/linuxkpi/common/include/linux/uuid.h | 30 +++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/uuid.h b/sys/compat/linuxkpi/common/include/linux/uuid.h
index 0765ef4dcc1e..2296cc9b881f 100644
--- a/sys/compat/linuxkpi/common/include/linux/uuid.h
+++ b/sys/compat/linuxkpi/common/include/linux/uuid.h
@@ -60,6 +60,12 @@ typedef struct {
char x[16];
} guid_t;
+/* Renamed to stay clear of the other uuid_t types in the tree. */
+typedef struct {
+ uint8_t b[UUID_SIZE];
+} linux_uuid_t;
+#define uuid_t linux_uuid_t
+
extern const guid_t guid_null;
static inline void
@@ -101,4 +107,28 @@ guid_is_null(const guid_t *guid)
return (guid_equal(guid, &guid_null));
}
+static inline bool
+uuid_equal(const linux_uuid_t *u1, const linux_uuid_t *u2)
+{
+ return (memcmp(u1, u2, sizeof(linux_uuid_t)) == 0);
+}
+
+static inline void
+uuid_copy(linux_uuid_t *dst, const linux_uuid_t *src)
+{
+ memcpy(dst, src, sizeof(linux_uuid_t));
+}
+
+static inline void
+import_uuid(linux_uuid_t *dst, const uint8_t *src)
+{
+ memcpy(dst, src, sizeof(linux_uuid_t));
+}
+
+static inline void
+export_uuid(uint8_t *dst, const linux_uuid_t *src)
+{
+ memcpy(dst, src, sizeof(linux_uuid_t));
+}
+
#endif /* _LINUXKPI_LINUX_UUID_H */