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. As wulf suggested, the type is linux_uuid_t behind a uuid_t macro, to stay clear of the other uuid_t types in the tree. Used by drm/virtio for dma-buf UUID export.
Details
- Reviewers
wulf manu - Commits
- rGfce354b0e9eb: linuxkpi: add uuid_t and helpers
Built on main with this applied: linuxkpi (linux_acpi.c and linux_compat.c include linux/uuid.h), linuxkpi_wlan, mlx5, iwlwifi and ath10k (both include linux/uuid.h) for aarch64 and amd64, and drm-kmod's virtio-gpu (freebsd/drm-kmod#517) without its interim copy.
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Careful! We already have a native uuid_t! Someone should check if (a) we can use that and (b) possible conflict potential.
sys/sys/uuid.h:typedef struct uuid uuid_t;
FreeBSD uses native uuid_t only in ACPI and GEOM(EFI) subsystems.
We can rename uuid_t to linux_uuid_t and add #define uuid_t linux_uuid_t to aoid possible namespace collisions.
Updated as wulf suggested: the definition sits next to guid_t, and uuid_t is linux_uuid_t behind a macro.
@bz: (a) The native type can't be reused. It is struct uuid, with time_low/time_mid/... fields, which ACPI and GEOM use, while Linux's uuid_t is a raw 16-byte array (.b[]) that drivers index and memcpy. (b) In the kernel, sys/uuid.h provides only struct uuid; its uuid_t typedef is userland-only. OpenZFS's SPL defines its own kernel uuid_t, but ZFS never includes LinuxKPI headers, so nothing clashes today.