* [PATCH] Accept small blocks for NTFS and Reiserfs in blkid
@ 2012-05-03 12:16 Vladimir 'φ-coder/phcoder' Serbinenko
2012-05-04 9:51 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2012-05-03 12:16 UTC (permalink / raw)
To: util-linux
[-- Attachment #1.1: Type: text/plain, Size: 301 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: block.diff --]
[-- Type: text/x-diff; name="block.diff", Size: 1496 bytes --]
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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-04 9:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-03 12:16 [PATCH] Accept small blocks for NTFS and Reiserfs in blkid Vladimir 'φ-coder/phcoder' Serbinenko
2012-05-04 9:51 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox