|
@@ -9,6 +9,7 @@
|
9
|
9
|
FILE_LICENCE ( GPL2_OR_LATER );
|
10
|
10
|
|
11
|
11
|
#include <stdint.h>
|
|
12
|
+#include <byteswap.h>
|
12
|
13
|
|
13
|
14
|
/** A universally unique ID */
|
14
|
15
|
union uuid {
|
|
@@ -28,6 +29,24 @@ union uuid {
|
28
|
29
|
uint8_t raw[16];
|
29
|
30
|
};
|
30
|
31
|
|
|
32
|
+/**
|
|
33
|
+ * Change UUID endianness
|
|
34
|
+ *
|
|
35
|
+ * @v uuid UUID
|
|
36
|
+ *
|
|
37
|
+ * RFC4122 defines UUIDs as being encoded in network byte order, but
|
|
38
|
+ * leaves some wriggle room for "explicit application or presentation
|
|
39
|
+ * protocol specification to the contrary". PXE, EFI and SMBIOS
|
|
40
|
+ * (versions 2.6 and above) treat the first three fields as being
|
|
41
|
+ * little-endian.
|
|
42
|
+ */
|
|
43
|
+static inline void uuid_mangle ( union uuid *uuid ) {
|
|
44
|
+
|
|
45
|
+ __bswap_32s ( &uuid->canonical.a );
|
|
46
|
+ __bswap_16s ( &uuid->canonical.b );
|
|
47
|
+ __bswap_16s ( &uuid->canonical.c );
|
|
48
|
+}
|
|
49
|
+
|
31
|
50
|
extern char * uuid_ntoa ( const union uuid *uuid );
|
32
|
51
|
|
33
|
52
|
#endif /* _IPXE_UUID_H */
|