Skip to contentSkip to conversation

Accept small blocks for NTFS and Reiserfs in blkid

PATCH Applied Vladimir 'φ-coder/phcoder' Serbinenko 2 participants 2 messages May 3, 2012 – May 4, 2012 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Accept small blocks for NTFS and Reiserfs in blkid

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.

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
libblkid/src/superblocks/ntfs.c +1 -1
diff -ur util-linux-2.20.1/libblkid/src/superblocks/ntfs.c util-linux-2.20.1-mod/libblkid/src/superblocks/ntfs.c
@@ -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)
libblkid/src/superblocks/reiserfs.c +3 -3
diff -ur util-linux-2.20.1/libblkid/src/superblocks/reiserfs.c util-linux-2.20.1-mod/libblkid/src/superblocks/reiserfs.c
@@ -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. */
maintainer Applied
#1 lore raw
Quoted 1 line · Vladimir 'φ-coder/phcoder' Serbinenko

libblkid is restrictive as to what it accepts as valid reiserfs or valid NTFS.

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com