public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
To: kumagai-atsushi@mxc.nes.nec.co.jp
Cc: kexec@lists.infradead.org
Subject: [PATCH 2/2] sadump: convert the first three fields of EFI GUID from little-endian into big-endian
Date: Fri, 13 Sep 2013 19:53:32 +0900	[thread overview]
Message-ID: <20130913105332.2332.34743.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20130913105216.2332.8060.stgit@localhost6.localdomain6>

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@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]);


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2013-09-13 10:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13 10:53 [PATCH 0/2] makedumpfile, sadump: fix two GUID print bugs HATAYAMA Daisuke
2013-09-13 10:53 ` [PATCH 1/2] sadump: correct buffer size for GUID EFI text representation HATAYAMA Daisuke
2013-09-13 10:53 ` HATAYAMA Daisuke [this message]
2013-09-17  6:20 ` [PATCH 0/2] makedumpfile, sadump: fix two GUID print bugs Atsushi Kumagai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130913105332.2332.34743.stgit@localhost6.localdomain6 \
    --to=d.hatayama@jp.fujitsu.com \
    --cc=kexec@lists.infradead.org \
    --cc=kumagai-atsushi@mxc.nes.nec.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox