[PATCH 2/2] sadump: convert the first three fields of EFI GUID from little-endian into big-endian

HATAYAMA Daisuke d.hatayama at jp.fujitsu.com
Fri Sep 13 06:53:32 EDT 2013


Although RFC 4122 recommends network byte order for all fields of
UUID, EFI GUID uses little-endian for the first three fields TimeLow,
TimeMid and TimeHighAndVersion. Thus, in text representation of the
GUID, converting the three fields from little-endian into big-endian
is needed.

Signed-off-by: HATAYAMA Daisuke <d.hatayama at jp.fujitsu.com>
---
 sadump_info.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sadump_info.c b/sadump_info.c
index e563180..84126b1 100644
--- a/sadump_info.c
+++ b/sadump_info.c
@@ -23,6 +23,8 @@
 #include "print_info.h"
 #include "sadump_mod.h"
 
+#include <arpa/inet.h> /* htonl, htons */
+
 #define SADUMP_EFI_GUID_TEXT_REPR_LEN 36
 
 #ifdef __x86__
@@ -334,7 +336,7 @@ guid_to_str(efi_guid_t *guid, char *buf, size_t buflen)
 {
 	snprintf(buf, buflen,
 		 "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-		 guid->data1, guid->data2, guid->data3,
+		 htonl(guid->data1), htons(guid->data2), htons(guid->data3),
 		 guid->data4[0], guid->data4[1], guid->data4[2],
 		 guid->data4[3], guid->data4[4], guid->data4[5],
 		 guid->data4[6], guid->data4[7]);




More information about the kexec mailing list