]> err.no Git - util-linux/commitdiff
libblkid: fix Adaptec RAID detection
authorKarel Zak <kzak@redhat.com>
Tue, 15 Dec 2009 01:17:28 +0000 (02:17 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 15 Dec 2009 01:17:28 +0000 (02:17 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/blkid/src/superblocks/adaptec_raid.c

index d7a42a67ab8a4d95e8b1de370d46dec94a2bdc4a..c6b175b44a5ac1bbbc393c8e75c423de26d0c77d 100644 (file)
@@ -16,6 +16,7 @@
 #include "superblocks.h"
 
 struct adaptec_metadata {
+
        uint32_t        b0idcode;
        uint8_t         lunsave[8];
        uint16_t        sdtype;
@@ -63,13 +64,13 @@ struct adaptec_metadata {
        uint32_t        fwTestMagic;
        uint32_t        fwTestSeqNum;
        uint8_t         fwTestRes[8];
-       uint8_t         smagic[4];
+       uint32_t        smagic;
        uint32_t        raidtbl;
        uint16_t        raidline;
        uint8_t         res9[0xF6];
 } __attribute__((packed));
 
-#define AD_SIGNATURE   "DPTM"
+#define AD_SIGNATURE   0x4450544D      /* "DPTM" */
 #define AD_MAGIC       0x37FC4D1E
 
 static int probe_adraid(blkid_probe pr, const struct blkid_idmag *mag)
@@ -87,7 +88,7 @@ static int probe_adraid(blkid_probe pr, const struct blkid_idmag *mag)
                                        sizeof(struct adaptec_metadata));
        if (!ad)
                return -1;
-       if (memcmp(ad->smagic, AD_SIGNATURE, sizeof(AD_SIGNATURE)) != 0)
+       if (ad->smagic != be32_to_cpu(AD_SIGNATURE))
                return -1;
        if (ad->b0idcode != be32_to_cpu(AD_MAGIC))
                return -1;