summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2018-05-25 13:53:03 +0200
committerKarel Zak2018-05-25 13:53:03 +0200
commit7816ee22d596a8d406add0ee50c8aefd192ceb11 (patch)
tree1734a0c30ec8e79f01fac937c115f3d354659e67
parentcfdisk: fix compiler warnings, follow-up 7085f1e4 (#636) (diff)
downloadkernel-qcow2-util-linux-7816ee22d596a8d406add0ee50c8aefd192ceb11.tar.gz
kernel-qcow2-util-linux-7816ee22d596a8d406add0ee50c8aefd192ceb11.tar.xz
kernel-qcow2-util-linux-7816ee22d596a8d406add0ee50c8aefd192ceb11.zip
libblkid: (ntfs) enlarge cluster limit to 2MB
Windows 10 Creators edition has extended the ntfs cluster limit to 2MB. As a consequence blkid does not identify recent partitions with clusters beyond 65K as ntfs ones. Addresses: https://github.com/karelzak/util-linux/issues/641 Signed-off-by: Karel Zak <kzak@redhat.com> Co-Author: Jean-Pierre André <jean-pierre.andre@wanadoo.fr>
-rw-r--r--libblkid/src/superblocks/ntfs.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libblkid/src/superblocks/ntfs.c b/libblkid/src/superblocks/ntfs.c
index 3a9d5cb01..723d27503 100644
--- a/libblkid/src/superblocks/ntfs.c
+++ b/libblkid/src/superblocks/ntfs.c
@@ -72,7 +72,8 @@ struct file_attribute {
} __attribute__((__packed__));
#define MFT_RECORD_VOLUME 3
-#define NTFS_MAX_CLUSTER_SIZE (64 * 1024)
+/* Windows 10 Creators edition has extended the cluster size limit to 2MB */
+#define NTFS_MAX_CLUSTER_SIZE (2 * 1024 * 1024)
enum {
MFT_RECORD_ATTR_VOLUME_NAME = 0x60,
@@ -97,16 +98,19 @@ static int probe_ntfs(blkid_probe pr, const struct blkid_idmag *mag)
* Check bios parameters block
*/
sector_size = le16_to_cpu(ns->bpb.sector_size);
- sectors_per_cluster = ns->bpb.sectors_per_cluster;
if (sector_size < 256 || sector_size > 4096)
return 1;
- switch (sectors_per_cluster) {
+ switch (ns->bpb.sectors_per_cluster) {
case 1: case 2: case 4: case 8: case 16: case 32: case 64: case 128:
+ sectors_per_cluster = ns->bpb.sectors_per_cluster;
break;
default:
- return 1;
+ if ((ns->bpb.sectors_per_cluster < 240)
+ || (ns->bpb.sectors_per_cluster > 249))
+ return 1;
+ sectors_per_cluster = 1 << (256 - ns->bpb.sectors_per_cluster);
}
if ((uint16_t) le16_to_cpu(ns->bpb.sector_size) *