diff options
author | Alexey Obitotskiy | 2016-06-24 11:59:35 +0200 |
---|---|---|
committer | Karel Zak | 2016-07-01 13:40:11 +0200 |
commit | 6c448f452e380a76eec5b93ae6994ec7fed09354 (patch) | |
tree | 3965be058e3721c038b8affb66b8675740157480 | |
parent | agetty: don't modify argv[] when parse speeds (diff) | |
download | kernel-qcow2-util-linux-6c448f452e380a76eec5b93ae6994ec7fed09354.tar.gz kernel-qcow2-util-linux-6c448f452e380a76eec5b93ae6994ec7fed09354.tar.xz kernel-qcow2-util-linux-6c448f452e380a76eec5b93ae6994ec7fed09354.zip |
libblkid: Add metadata signature check for IMSM on 4Kn drives
Drives with 512 and 4K sectors have different offset for
metadata signature. Without signature detected on 4Kn drives
those drives will not be recognized as raid member. This
patch adds checking for IMSM signature for 4Kn drives.
Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
-rw-r--r-- | libblkid/src/superblocks/isw_raid.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libblkid/src/superblocks/isw_raid.c b/libblkid/src/superblocks/isw_raid.c index 065c2b208..81d53a1d0 100644 --- a/libblkid/src/superblocks/isw_raid.c +++ b/libblkid/src/superblocks/isw_raid.c @@ -25,11 +25,11 @@ struct isw_metadata { #define ISW_SIGNATURE "Intel Raid ISM Cfg Sig. " - static int probe_iswraid(blkid_probe pr, const struct blkid_idmag *mag __attribute__((__unused__))) { uint64_t off; + unsigned int sector_size; struct isw_metadata *isw; if (pr->size < 0x10000) @@ -37,16 +37,17 @@ static int probe_iswraid(blkid_probe pr, if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) return 1; - off = ((pr->size / 0x200) - 2) * 0x200; - isw = (struct isw_metadata *) - blkid_probe_get_buffer(pr, - off, - sizeof(struct isw_metadata)); + sector_size = blkid_probe_get_sectorsize(pr); + off = ((pr->size / sector_size) - 2) * sector_size; + + isw = (struct isw_metadata *)blkid_probe_get_buffer(pr, + off, sizeof(struct isw_metadata)); if (!isw) return errno ? -errno : 1; if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0) return 1; + if (blkid_probe_sprintf_version(pr, "%6s", &isw->sig[sizeof(ISW_SIGNATURE)-1]) != 0) return 1; |