From: Karel Zak Date: Tue, 9 Sep 2008 09:01:26 +0000 (+0200) Subject: blkid: Promise raid X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e86961bac1260d9e108957744619efd2163fd26d;p=util-linux blkid: Promise raid Signed-off-by: Karel Zak --- diff --git a/libs/blkid/src/probe.c b/libs/blkid/src/probe.c index 47b70841..e54c528b 100644 --- a/libs/blkid/src/probe.c +++ b/libs/blkid/src/probe.c @@ -43,7 +43,8 @@ static const struct blkid_idinfo *idinfos[] = &iswraid_idinfo, &jmicron_idinfo, &lsi_idinfo, - &nvraid_idinfo + &nvraid_idinfo, + &pdcraid_idinfo }; #ifndef ARRAY_SIZE diff --git a/libs/blkid/src/probers/Makefile.am b/libs/blkid/src/probers/Makefile.am index 09738bcc..c866fa50 100644 --- a/libs/blkid/src/probers/Makefile.am +++ b/libs/blkid/src/probers/Makefile.am @@ -12,6 +12,7 @@ libprobers_a_SOURCES = probers.h \ isw_raid.c \ jmicron_raid.c \ lsi_raid.c \ - nvidia_raid.c + nvidia_raid.c \ + promise_raid.c all-local: $(lib_LIBRARIES) diff --git a/libs/blkid/src/probers/probers.h b/libs/blkid/src/probers/probers.h index e7e13e1f..86028098 100644 --- a/libs/blkid/src/probers/probers.h +++ b/libs/blkid/src/probers/probers.h @@ -24,5 +24,6 @@ extern const struct blkid_idinfo iswraid_idinfo; extern const struct blkid_idinfo jmicron_idinfo; extern const struct blkid_idinfo lsi_idinfo; extern const struct blkid_idinfo nvraid_idinfo; +extern const struct blkid_idinfo pdcraid_idinfo; #endif /* _BLKID_PROBE_H */ diff --git a/libs/blkid/src/probers/promise_raid.c b/libs/blkid/src/probers/promise_raid.c new file mode 100644 index 00000000..c11ddd35 --- /dev/null +++ b/libs/blkid/src/probers/promise_raid.c @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2008 Karel Zak + * Copyright (C) 2005 Kay Sievers + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "blkidP.h" + +struct promise_meta { + uint8_t sig[24]; +}; + +#define PDC_CONFIG_OFF 0x1200 +#define PDC_SIGNATURE "Promise Technology, Inc." + +static int probe_pdcraid(blkid_probe pr, const struct blkid_idmag *mag) +{ + unsigned int i; + static unsigned int sectors[] = { + 63, 255, 256, 16, 399, 0 + }; + + if (pr->size < 0x40000) + return -1; + + for (i = 0; sectors[i] != 0; i++) { + uint64_t meta_off; + struct promise_meta *pdc; + + meta_off = ((pr->size / 0x200) - sectors[i]) * 0x200; + pdc = (struct promise_meta *) + blkid_probe_get_buffer(pr, meta_off, 0x200); + if (!pdc) + return -1; + + if (memcmp(pdc->sig, PDC_SIGNATURE, + sizeof(PDC_SIGNATURE) - 1) == 0) + return 0; + } + return -1; +} + +const struct blkid_idinfo pdcraid_idinfo = { + .name = "promise_fasttrack_raid_member", + .usage = BLKID_USAGE_RAID, + .probefunc = probe_pdcraid +}; + +