803fb7
From d1c32b69edc7f0f62a7c3f65691c2cb9fedcb112 Mon Sep 17 00:00:00 2001
803fb7
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
803fb7
Date: Wed, 22 Jul 2015 00:23:47 -0400
803fb7
Subject: [PATCH] ata_id: unreverse WWN identifier
803fb7
803fb7
An endianness conversion was lost in 6024a6e302bad6bcf073fa84a41a6123305dc845.
803fb7
Restore it. Now ata_id and scsi_id output match.
803fb7
803fb7
https://bugzilla.redhat.com/show_bug.cgi?id=1227503
803fb7
803fb7
Cherry-picked from: 01f61d331bb5038f0c877ac03c54333328b6ea28
803fb7
Resolves: #1273306
803fb7
---
803fb7
 src/udev/ata_id/ata_id.c | 14 ++++++++++++--
803fb7
 1 file changed, 12 insertions(+), 2 deletions(-)
803fb7
803fb7
diff --git a/src/udev/ata_id/ata_id.c b/src/udev/ata_id/ata_id.c
803fb7
index b6f28c6f5..4adec4496 100644
803fb7
--- a/src/udev/ata_id/ata_id.c
803fb7
+++ b/src/udev/ata_id/ata_id.c
803fb7
@@ -638,10 +638,20 @@ int main(int argc, char *argv[])
803fb7
                  * All other values are reserved.
803fb7
                  */
803fb7
                 word = identify.wyde[108];
803fb7
-                if ((word & 0xf000) == 0x5000)
803fb7
+                if ((word & 0xf000) == 0x5000) {
803fb7
+                        uint64_t wwwn;
803fb7
+
803fb7
+                        wwwn   = identify.wyde[108];
803fb7
+                        wwwn <<= 16;
803fb7
+                        wwwn  |= identify.wyde[109];
803fb7
+                        wwwn <<= 16;
803fb7
+                        wwwn  |= identify.wyde[110];
803fb7
+                        wwwn <<= 16;
803fb7
+                        wwwn  |= identify.wyde[111];
803fb7
                         printf("ID_WWN=0x%1$" PRIx64 "\n"
803fb7
                                "ID_WWN_WITH_EXTENSION=0x%1$" PRIx64 "\n",
803fb7
-                               identify.octa[108/4]);
803fb7
+                               wwwn);
803fb7
+                }
803fb7
 
803fb7
                 /* from Linux's include/linux/ata.h */
803fb7
                 if (identify.wyde[0] == 0x848a ||