dcavalca / rpms / systemd

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