[PATCH] Accept small blocks for NTFS and Reiserfs in blkid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
Patch attached.

-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko

diff -ur util-linux-2.20.1/libblkid/src/superblocks/ntfs.c util-linux-2.20.1-mod/libblkid/src/superblocks/ntfs.c
--- util-linux-2.20.1/libblkid/src/superblocks/ntfs.c	2011-09-26 11:50:23.000000000 +0200
+++ util-linux-2.20.1-mod/libblkid/src/superblocks/ntfs.c	2012-05-03 14:07:35.193438515 +0200
@@ -81,7 +81,7 @@
 		(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)
diff -ur util-linux-2.20.1/libblkid/src/superblocks/reiserfs.c util-linux-2.20.1-mod/libblkid/src/superblocks/reiserfs.c
--- util-linux-2.20.1/libblkid/src/superblocks/reiserfs.c	2011-09-26 11:50:23.000000000 +0200
+++ util-linux-2.20.1-mod/libblkid/src/superblocks/reiserfs.c	2012-05-03 14:08:29.636647756 +0200
@@ -49,12 +49,12 @@
 
 	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. */

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux