]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: accept small blocks for NTFS and Reiserfs in blkid
authorVladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com>
Fri, 4 May 2012 09:48:07 +0000 (11:48 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 24 May 2012 10:22:56 +0000 (12:22 +0200)
libblkid is restrictive as to what it accepts as valid reiserfs or
valid NTFS.  One can mkfs an NTFS with 256B sectors and it's supported
by ntfs-3g Reiserfs can have 512B blocks and it works both with
mkfs.ntfs and Linux.

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/superblocks/ntfs.c
libblkid/src/superblocks/reiserfs.c

index 98f3fb2f9ec0e760a28de5e884c6c163f83ec291..0b46154ad0093600ef410cdc2b5e9953f67937ce 100644 (file)
@@ -81,7 +81,7 @@ static int probe_ntfs(blkid_probe pr, const struct blkid_idmag *mag)
                (ns->bios_parameter_block[1]  << 8);
        sectors_per_cluster = ns->bios_parameter_block[2];
 
-       if ((bytes_per_sector < 512) || (sectors_per_cluster == 0))
+       if ((bytes_per_sector < 256) || (sectors_per_cluster == 0))
                return 1;
 
        if (ns->cluster_per_mft_record < 0)
index feb58a812412dc88091eea6ce821fbc7a697e4ee..152571f470e1fce141851961b3de9d69431716b1 100644 (file)
@@ -49,12 +49,12 @@ static int probe_reiser(blkid_probe pr, const struct blkid_idmag *mag)
 
        blocksize = le16_to_cpu(rs->rs_blocksize);
 
-       /* The blocksize must be at least 1k */
-       if ((blocksize >> 10) == 0)
+       /* The blocksize must be at least 512B */
+       if ((blocksize >> 9) == 0)
                return -BLKID_ERR_PARAM;
 
        /* If the superblock is inside the journal, we have the wrong one */
-       if (mag->kboff / (blocksize >> 10) > le32_to_cpu(rs->rs_journal_block))
+       if (mag->kboff / (blocksize >> 9) > le32_to_cpu(rs->rs_journal_block) / 2)
                return -BLKID_ERR_BIG;
 
        /* LABEL/UUID are only valid for later versions of Reiserfs v3.6. */