]> err.no Git - util-linux/commitdiff
libblkid: probe for (non-linux) RAIDs on whole devices only
authorKarel Zak <kzak@redhat.com>
Tue, 18 May 2010 12:31:28 +0000 (14:31 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 18 May 2010 13:26:03 +0000 (15:26 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/blkid/src/probe.c
shlibs/blkid/src/superblocks/adaptec_raid.c
shlibs/blkid/src/superblocks/highpoint_raid.c
shlibs/blkid/src/superblocks/isw_raid.c
shlibs/blkid/src/superblocks/jmicron_raid.c
shlibs/blkid/src/superblocks/lsi_raid.c
shlibs/blkid/src/superblocks/nvidia_raid.c
shlibs/blkid/src/superblocks/promise_raid.c
shlibs/blkid/src/superblocks/silicon_raid.c
shlibs/blkid/src/superblocks/via_raid.c

index 370ef133501e3b93e3f59fdbe44c6cc810845e76..200a52c5e756c56afcc53d49c4a379bc22c364db 100644 (file)
@@ -652,9 +652,6 @@ int blkid_probe_set_device(blkid_probe pr, int fd,
                pr->size -= pr->off;
        }
 
-       DBG(DEBUG_LOWPROBE, printf("ready for low-probing, offset=%jd, size=%jd\n",
-                               pr->off, pr->size));
-
        if (pr->size <= 1440 * 1024 && !S_ISCHR(sb.st_mode))
                pr->flags |= BLKID_TINY_DEV;
 
@@ -662,6 +659,13 @@ int blkid_probe_set_device(blkid_probe pr, int fd,
        if (S_ISBLK(sb.st_mode) && ioctl(fd, CDROM_GET_CAPABILITY, NULL) >= 0)
                pr->flags |= BLKID_CDROM_DEV;
 #endif
+
+       DBG(DEBUG_LOWPROBE, printf("ready for low-probing, offset=%jd, size=%jd\n",
+                               pr->off, pr->size));
+       DBG(DEBUG_LOWPROBE, printf("whole-disk: %s, regfile: %s\n",
+               blkid_probe_is_wholedisk(pr) ?"YES" : "NO",
+               S_ISREG(pr->mode) ? "YES" : "NO"));
+
        return 0;
 err:
        DBG(DEBUG_LOWPROBE,
index 73b146c6a737a32475cb0a6d991e377a960e6cf1..570e75e9f786ce89f30b5e76e6d4efb3d02ae4e3 100644 (file)
@@ -81,6 +81,9 @@ static int probe_adraid(blkid_probe pr, const struct blkid_idmag *mag)
        if (pr->size < 0x10000)
                return -1;
 
+       if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
+               return -1;
+
        off = ((pr->size / 0x200)-1) * 0x200;
        ad = (struct adaptec_metadata *)
                        blkid_probe_get_buffer(pr,
index 98343c418d30c54cb5553070e6909e39eafb3963..25e3114b3fbbeb5c76c6946b2a2ac51fc2f38493 100644 (file)
@@ -30,6 +30,8 @@ static int probe_highpoint45x(blkid_probe pr, const struct blkid_idmag *mag)
 
        if (pr->size < 0x10000)
                return -1;
+       if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
+               return -1;
 
        off = ((pr->size / 0x200) - 11) * 0x200;
        hpt = (struct hpt45x_metadata *)
@@ -47,6 +49,14 @@ static int probe_highpoint45x(blkid_probe pr, const struct blkid_idmag *mag)
        return 0;
 }
 
+static int probe_highpoint37x(blkid_probe pr, const struct blkid_idmag *mag)
+{
+       if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
+               return -1;
+       return 0;
+}
+
+
 const struct blkid_idinfo highpoint45x_idinfo = {
        .name           = "hpt45x_raid_member",
        .usage          = BLKID_USAGE_RAID,
@@ -57,6 +67,7 @@ const struct blkid_idinfo highpoint45x_idinfo = {
 const struct blkid_idinfo highpoint37x_idinfo = {
        .name           = "hpt37x_raid_member",
        .usage          = BLKID_USAGE_RAID,
+       .probefunc      = probe_highpoint37x,
        .magics         = {
                /*
                 * Superblok offset:                      4608 bytes  (9 sectors)
index 5149c38a347b26f71d2d73920b3ca96f64a7f112..ac6251d7c3bd39cac0f91eeb7beb62fd054e7419 100644 (file)
@@ -33,6 +33,8 @@ static int probe_iswraid(blkid_probe pr, const struct blkid_idmag *mag)
 
        if (pr->size < 0x10000)
                return -1;
+       if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
+               return -1;
 
        off = ((pr->size / 0x200) - 2) * 0x200;
        isw = (struct isw_metadata *)
index 24430bf99da196e7f0e36501abc13de3502fc883..d35b17f896aa1f9b0c544cc0d73ec82f6848ea4e 100644 (file)
@@ -32,6 +32,8 @@ static int probe_jmraid(blkid_probe pr, const struct blkid_idmag *mag)
 
        if (pr->size < 0x10000)
                return -1;
+       if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
+               return -1;
 
        off = ((pr->size / 0x200) - 1) * 0x200;
        jm = (struct jm_metadata *)
index 3010eb6b73d4298e66131d30ec072810f471a83d..5217a0093c91a7ead90b85dbad9e240d108a3e70 100644 (file)
@@ -30,6 +30,8 @@ static int probe_lsiraid(blkid_probe pr, const struct blkid_idmag *mag)
 
        if (pr->size < 0x10000)
                return -1;
+       if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
+               return -1;
 
        off = ((pr->size / 0x200) - 1) * 0x200;
        lsi = (struct lsi_metadata *)
index e75bec848bc1bec073a3c72f7226944be7570214..c3db949a8a9b50c40ba44f79c367d05c6d822d49 100644 (file)
@@ -32,6 +32,8 @@ static int probe_nvraid(blkid_probe pr, const struct blkid_idmag *mag)
 
        if (pr->size < 0x10000)
                return -1;
+       if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
+               return -1;
 
        off = ((pr->size / 0x200) - 2) * 0x200;
        nv = (struct nv_metadata *)
index 1cc70e65e9a5c5fc366e5c8bd25cda7783996580..0e91d3c257506d4246246b2024df3ff509781515 100644 (file)
@@ -33,6 +33,8 @@ static int probe_pdcraid(blkid_probe pr, const struct blkid_idmag *mag)
 
        if (pr->size < 0x40000)
                return -1;
+       if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
+               return -1;
 
        for (i = 0; sectors[i] != 0; i++) {
                uint64_t off;
index 11277ad6973c2bf275d4acb10e8bc8c1636acff8..b72b72760bae158578685fc9c64444cf3253cd56 100644 (file)
@@ -48,6 +48,8 @@ static int probe_silraid(blkid_probe pr, const struct blkid_idmag *mag)
 
        if (pr->size < 0x10000)
                return -1;
+       if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
+               return -1;
 
        off = ((pr->size / 0x200) - 1) * 0x200;
 
index 5865045464747571a12169726655af7f9fed41a5..2013138015a7e272a78a0b3caebf12e7ec310fb2 100644 (file)
@@ -52,6 +52,8 @@ static int probe_viaraid(blkid_probe pr, const struct blkid_idmag *mag)
 
        if (pr->size < 0x10000)
                return -1;
+       if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
+               return -1;
 
        off = ((pr->size / 0x200)-1) * 0x200;