diff options
| author | Anton Altaparmakov <aia21@cantab.net> | 2007-05-21 04:37:42 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-21 12:58:40 -0400 |
| commit | dde33348e53ecab687a9768bf5262f0b8f79b7f2 (patch) | |
| tree | 6bfb828e56147b7c327a1304c27e93fc92f6c060 | |
| parent | 17304383ebc1ce68a88030ac4d18ea549d9578c7 (diff) | |
LDM: Fix for Windows Vista dynamic disks
This fixes the LDM driver so that it works with Windows Vista dynamic
disks which are subtly different to Windows 2000/XP ones.
The patch was needed to get a Vista formatted dynamic disk to be
recognized and parsed successfully.
Thanks go to Chris Teachworth for the report and testing.
Cc: Richard Russon <ldm@flatcap.org>
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | Documentation/ldm.txt | 21 | ||||
| -rw-r--r-- | MAINTAINERS | 6 | ||||
| -rw-r--r-- | fs/partitions/Kconfig | 12 | ||||
| -rw-r--r-- | fs/partitions/ldm.c | 206 | ||||
| -rw-r--r-- | fs/partitions/ldm.h | 6 |
5 files changed, 144 insertions, 107 deletions
diff --git a/Documentation/ldm.txt b/Documentation/ldm.txt index e266e11c19a..718085bc9f1 100644 --- a/Documentation/ldm.txt +++ b/Documentation/ldm.txt | |||
| @@ -2,10 +2,13 @@ | |||
| 2 | LDM - Logical Disk Manager (Dynamic Disks) | 2 | LDM - Logical Disk Manager (Dynamic Disks) |
| 3 | ------------------------------------------ | 3 | ------------------------------------------ |
| 4 | 4 | ||
| 5 | Originally Written by FlatCap - Richard Russon <ldm@flatcap.org>. | ||
| 6 | Last Updated by Anton Altaparmakov on 30 March 2007 for Windows Vista. | ||
| 7 | |||
| 5 | Overview | 8 | Overview |
| 6 | -------- | 9 | -------- |
| 7 | 10 | ||
| 8 | Windows 2000 and XP use a new partitioning scheme. It is a complete | 11 | Windows 2000, XP, and Vista use a new partitioning scheme. It is a complete |
| 9 | replacement for the MSDOS style partitions. It stores its information in a | 12 | replacement for the MSDOS style partitions. It stores its information in a |
| 10 | 1MiB journalled database at the end of the physical disk. The size of | 13 | 1MiB journalled database at the end of the physical disk. The size of |
| 11 | partitions is limited only by disk space. The maximum number of partitions is | 14 | partitions is limited only by disk space. The maximum number of partitions is |
| @@ -23,7 +26,11 @@ Once the LDM driver has divided up the disk, you can use the MD driver to | |||
| 23 | assemble any multi-partition volumes, e.g. Stripes, RAID5. | 26 | assemble any multi-partition volumes, e.g. Stripes, RAID5. |
| 24 | 27 | ||
| 25 | To prevent legacy applications from repartitioning the disk, the LDM creates a | 28 | To prevent legacy applications from repartitioning the disk, the LDM creates a |
| 26 | dummy MSDOS partition containing one disk-sized partition. | 29 | dummy MSDOS partition containing one disk-sized partition. This is what is |
| 30 | supported with the Linux LDM driver. | ||
| 31 | |||
| 32 | A newer approach that has been implemented with Vista is to put LDM on top of a | ||
| 33 | GPT label disk. This is not supported by the Linux LDM driver yet. | ||
| 27 | 34 | ||
| 28 | 35 | ||
| 29 | Example | 36 | Example |
| @@ -88,13 +95,13 @@ and cannot boot from a Dynamic Disk. | |||
| 88 | More Documentation | 95 | More Documentation |
| 89 | ------------------ | 96 | ------------------ |
| 90 | 97 | ||
| 91 | There is an Overview of the LDM online together with complete Technical | 98 | There is an Overview of the LDM together with complete Technical Documentation. |
| 92 | Documentation. It can also be downloaded in html. | 99 | It is available for download. |
| 93 | 100 | ||
| 94 | http://linux-ntfs.sourceforge.net/ldm/index.html | 101 | http://www.linux-ntfs.org/content/view/19/37/ |
| 95 | http://linux-ntfs.sourceforge.net/downloads.html | ||
| 96 | 102 | ||
| 97 | If you have any LDM questions that aren't answered on the website, email me. | 103 | If you have any LDM questions that aren't answered in the documentation, email |
| 104 | me. | ||
| 98 | 105 | ||
| 99 | Cheers, | 106 | Cheers, |
| 100 | FlatCap - Richard Russon | 107 | FlatCap - Richard Russon |
diff --git a/MAINTAINERS b/MAINTAINERS index 4c3277cb925..22ab4019972 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -2231,11 +2231,11 @@ M: khali@linux-fr.org | |||
| 2231 | L: lm-sensors@lm-sensors.org | 2231 | L: lm-sensors@lm-sensors.org |
| 2232 | S: Maintained | 2232 | S: Maintained |
| 2233 | 2233 | ||
| 2234 | LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP Dynamic Disks) | 2234 | LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks) |
| 2235 | P: Richard Russon (FlatCap) | 2235 | P: Richard Russon (FlatCap) |
| 2236 | M: ldm@flatcap.org | 2236 | M: ldm@flatcap.org |
| 2237 | L: ldm-devel@lists.sourceforge.net | 2237 | L: linux-ntfs-dev@lists.sourceforge.net |
| 2238 | W: http://ldm.sourceforge.net | 2238 | W: http://www.linux-ntfs.org/content/view/19/37/ |
| 2239 | S: Maintained | 2239 | S: Maintained |
| 2240 | 2240 | ||
| 2241 | LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI) | 2241 | LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI) |
diff --git a/fs/partitions/Kconfig b/fs/partitions/Kconfig index 7638a1c42a7..a99acd8de35 100644 --- a/fs/partitions/Kconfig +++ b/fs/partitions/Kconfig | |||
| @@ -166,8 +166,12 @@ config LDM_PARTITION | |||
| 166 | depends on PARTITION_ADVANCED | 166 | depends on PARTITION_ADVANCED |
| 167 | ---help--- | 167 | ---help--- |
| 168 | Say Y here if you would like to use hard disks under Linux which | 168 | Say Y here if you would like to use hard disks under Linux which |
| 169 | were partitioned using Windows 2000's or XP's Logical Disk Manager. | 169 | were partitioned using Windows 2000's/XP's or Vista's Logical Disk |
| 170 | They are also known as "Dynamic Disks". | 170 | Manager. They are also known as "Dynamic Disks". |
| 171 | |||
| 172 | Note this driver only supports Dynamic Disks with a protective MBR | ||
| 173 | label, i.e. DOS partition table. It does not support GPT labelled | ||
| 174 | Dynamic Disks yet as can be created with Vista. | ||
| 171 | 175 | ||
| 172 | Windows 2000 introduced the concept of Dynamic Disks to get around | 176 | Windows 2000 introduced the concept of Dynamic Disks to get around |
| 173 | the limitations of the PC's partitioning scheme. The Logical Disk | 177 | the limitations of the PC's partitioning scheme. The Logical Disk |
| @@ -175,8 +179,8 @@ config LDM_PARTITION | |||
| 175 | mirrored, striped or RAID volumes, all without the need for | 179 | mirrored, striped or RAID volumes, all without the need for |
| 176 | rebooting. | 180 | rebooting. |
| 177 | 181 | ||
| 178 | Normal partitions are now called Basic Disks under Windows 2000 and | 182 | Normal partitions are now called Basic Disks under Windows 2000, XP, |
| 179 | XP. | 183 | and Vista. |
| 180 | 184 | ||
| 181 | For a fuller description read <file:Documentation/ldm.txt>. | 185 | For a fuller description read <file:Documentation/ldm.txt>. |
| 182 | 186 | ||
diff --git a/fs/partitions/ldm.c b/fs/partitions/ldm.c index 1a60926a4cc..c387812537d 100644 --- a/fs/partitions/ldm.c +++ b/fs/partitions/ldm.c | |||
| @@ -2,10 +2,10 @@ | |||
| 2 | * ldm - Support for Windows Logical Disk Manager (Dynamic Disks) | 2 | * ldm - Support for Windows Logical Disk Manager (Dynamic Disks) |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org> | 4 | * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org> |
| 5 | * Copyright (c) 2001-2004 Anton Altaparmakov | 5 | * Copyright (c) 2001-2007 Anton Altaparmakov |
| 6 | * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com> | 6 | * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com> |
| 7 | * | 7 | * |
| 8 | * Documentation is available at http://linux-ntfs.sf.net/ldm | 8 | * Documentation is available at http://www.linux-ntfs.org/content/view/19/37/ |
| 9 | * | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify it under | 10 | * This program is free software; you can redistribute it and/or modify it under |
| 11 | * the terms of the GNU General Public License as published by the Free Software | 11 | * the terms of the GNU General Public License as published by the Free Software |
| @@ -62,7 +62,6 @@ static void _ldm_printk (const char *level, const char *function, | |||
| 62 | printk ("%s%s(): %s\n", level, function, buf); | 62 | printk ("%s%s(): %s\n", level, function, buf); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | |||
| 66 | /** | 65 | /** |
| 67 | * ldm_parse_hexbyte - Convert a ASCII hex number to a byte | 66 | * ldm_parse_hexbyte - Convert a ASCII hex number to a byte |
| 68 | * @src: Pointer to at least 2 characters to convert. | 67 | * @src: Pointer to at least 2 characters to convert. |
| @@ -118,7 +117,6 @@ static bool ldm_parse_guid (const u8 *src, u8 *dest) | |||
| 118 | return true; | 117 | return true; |
| 119 | } | 118 | } |
| 120 | 119 | ||
| 121 | |||
| 122 | /** | 120 | /** |
| 123 | * ldm_parse_privhead - Read the LDM Database PRIVHEAD structure | 121 | * ldm_parse_privhead - Read the LDM Database PRIVHEAD structure |
| 124 | * @data: Raw database PRIVHEAD structure loaded from the device | 122 | * @data: Raw database PRIVHEAD structure loaded from the device |
| @@ -130,46 +128,48 @@ static bool ldm_parse_guid (const u8 *src, u8 *dest) | |||
| 130 | * Return: 'true' @ph contains the PRIVHEAD data | 128 | * Return: 'true' @ph contains the PRIVHEAD data |
| 131 | * 'false' @ph contents are undefined | 129 | * 'false' @ph contents are undefined |
| 132 | */ | 130 | */ |
| 133 | static bool ldm_parse_privhead (const u8 *data, struct privhead *ph) | 131 | static bool ldm_parse_privhead(const u8 *data, struct privhead *ph) |
| 134 | { | 132 | { |
| 135 | BUG_ON (!data || !ph); | 133 | bool is_vista = false; |
| 136 | 134 | ||
| 137 | if (MAGIC_PRIVHEAD != BE64 (data)) { | 135 | BUG_ON(!data || !ph); |
| 138 | ldm_error ("Cannot find PRIVHEAD structure. LDM database is" | 136 | if (MAGIC_PRIVHEAD != BE64(data)) { |
| 137 | ldm_error("Cannot find PRIVHEAD structure. LDM database is" | ||
| 139 | " corrupt. Aborting."); | 138 | " corrupt. Aborting."); |
| 140 | return false; | 139 | return false; |
| 141 | } | 140 | } |
| 142 | 141 | ph->ver_major = BE16(data + 0x000C); | |
| 143 | ph->ver_major = BE16 (data + 0x000C); | 142 | ph->ver_minor = BE16(data + 0x000E); |
| 144 | ph->ver_minor = BE16 (data + 0x000E); | 143 | ph->logical_disk_start = BE64(data + 0x011B); |
| 145 | ph->logical_disk_start = BE64 (data + 0x011B); | 144 | ph->logical_disk_size = BE64(data + 0x0123); |
| 146 | ph->logical_disk_size = BE64 (data + 0x0123); | 145 | ph->config_start = BE64(data + 0x012B); |
| 147 | ph->config_start = BE64 (data + 0x012B); | 146 | ph->config_size = BE64(data + 0x0133); |
| 148 | ph->config_size = BE64 (data + 0x0133); | 147 | /* Version 2.11 is Win2k/XP and version 2.12 is Vista. */ |
| 149 | 148 | if (ph->ver_major == 2 && ph->ver_minor == 12) | |
| 150 | if ((ph->ver_major != 2) || (ph->ver_minor != 11)) { | 149 | is_vista = true; |
| 151 | ldm_error ("Expected PRIVHEAD version %d.%d, got %d.%d." | 150 | if (!is_vista && (ph->ver_major != 2 || ph->ver_minor != 11)) { |
| 152 | " Aborting.", 2, 11, ph->ver_major, ph->ver_minor); | 151 | ldm_error("Expected PRIVHEAD version 2.11 or 2.12, got %d.%d." |
| 152 | " Aborting.", ph->ver_major, ph->ver_minor); | ||
| 153 | return false; | 153 | return false; |
| 154 | } | 154 | } |
| 155 | ldm_debug("PRIVHEAD version %d.%d (Windows %s).", ph->ver_major, | ||
| 156 | ph->ver_minor, is_vista ? "Vista" : "2000/XP"); | ||
| 155 | if (ph->config_size != LDM_DB_SIZE) { /* 1 MiB in sectors. */ | 157 | if (ph->config_size != LDM_DB_SIZE) { /* 1 MiB in sectors. */ |
| 156 | /* Warn the user and continue, carefully */ | 158 | /* Warn the user and continue, carefully. */ |
| 157 | ldm_info ("Database is normally %u bytes, it claims to " | 159 | ldm_info("Database is normally %u bytes, it claims to " |
| 158 | "be %llu bytes.", LDM_DB_SIZE, | 160 | "be %llu bytes.", LDM_DB_SIZE, |
| 159 | (unsigned long long)ph->config_size ); | 161 | udunsigned long long)ph->config_size); |
| 160 | } | 162 | } |
| 161 | if (( | ||
