From 8b9e7578a7ec0f8ae8757255ffed39ccfbb3c98f Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 15 Dec 2009 02:17:28 +0100 Subject: [PATCH] libblkid: fix Adaptec RAID detection Signed-off-by: Karel Zak --- shlibs/blkid/src/superblocks/adaptec_raid.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shlibs/blkid/src/superblocks/adaptec_raid.c b/shlibs/blkid/src/superblocks/adaptec_raid.c index d7a42a67..c6b175b4 100644 --- a/shlibs/blkid/src/superblocks/adaptec_raid.c +++ b/shlibs/blkid/src/superblocks/adaptec_raid.c @@ -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; -- 2.39.5