Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-block.git] / block / partitions / msdos.c
CommitLineData
1da177e4
LT
1/*
2 * fs/partitions/msdos.c
3 *
4 * Code extracted from drivers/block/genhd.c
5 * Copyright (C) 1991-1998 Linus Torvalds
6 *
7 * Thanks to Branko Lankester, lankeste@fwi.uva.nl, who found a bug
8 * in the early extended-partition checks and added DM partitions
9 *
10 * Support for DiskManager v6.0x added by Mark Lord,
11 * with information provided by OnTrack. This now works for linux fdisk
12 * and LILO, as well as loadlin and bootln. Note that disks other than
13 * /dev/hda *must* have a "DOS" type 0x51 partition in the first slot (hda1).
14 *
15 * More flexible handling of extended partitions - aeb, 950831
16 *
17 * Check partition table on IDE disks for common CHS translations
18 *
19 * Re-organised Feb 1998 Russell King
20 */
0607fd02 21#include <linux/msdos_fs.h>
1da177e4
LT
22
23#include "check.h"
24#include "msdos.h"
25#include "efi.h"
f8f06603 26#include "aix.h"
1da177e4
LT
27
28/*
29 * Many architectures don't like unaligned accesses, while
30 * the nr_sects and start_sect partition table entries are
31 * at a 2 (mod 4) address.
32 */
33#include <asm/unaligned.h>
34
3fbf586c 35#define SYS_IND(p) get_unaligned(&p->sys_ind)
1da177e4 36
3fbf586c
DT
37static inline sector_t nr_sects(struct partition *p)
38{
39 return (sector_t)get_unaligned_le32(&p->nr_sects);
40}
41
42static inline sector_t start_sect(struct partition *p)
43{
44 return (sector_t)get_unaligned_le32(&p->start_sect);
45}
1da177e4
LT
46
47static inline int is_extended_partition(struct partition *p)
48{
49 return (SYS_IND(p) == DOS_EXTENDED_PARTITION ||
50 SYS_IND(p) == WIN98_EXTENDED_PARTITION ||
51 SYS_IND(p) == LINUX_EXTENDED_PARTITION);
52}
53
54#define MSDOS_LABEL_MAGIC1 0x55
55#define MSDOS_LABEL_MAGIC2 0xAA
56
57static inline int
58msdos_magic_present(unsigned char *p)
59{
60 return (p[0] == MSDOS_LABEL_MAGIC1 && p[1] == MSDOS_LABEL_MAGIC2);
61}
62
e1dfa92d
OH
63/* Value is EBCDIC 'IBMA' */
64#define AIX_LABEL_MAGIC1 0xC9
65#define AIX_LABEL_MAGIC2 0xC2
66#define AIX_LABEL_MAGIC3 0xD4
67#define AIX_LABEL_MAGIC4 0xC1
1493bf21 68static int aix_magic_present(struct parsed_partitions *state, unsigned char *p)
e1dfa92d 69{
4419d1ac 70 struct partition *pt = (struct partition *) (p + 0x1be);
e1dfa92d
OH
71 Sector sect;
72 unsigned char *d;
4419d1ac 73 int slot, ret = 0;
e1dfa92d 74
a470e18f
OH
75 if (!(p[0] == AIX_LABEL_MAGIC1 &&
76 p[1] == AIX_LABEL_MAGIC2 &&
77 p[2] == AIX_LABEL_MAGIC3 &&
78 p[3] == AIX_LABEL_MAGIC4))
e1dfa92d 79 return 0;
4419d1ac
OH
80 /* Assume the partition table is valid if Linux partitions exists */
81 for (slot = 1; slot <= 4; slot++, pt++) {
82 if (pt->sys_ind == LINUX_SWAP_PARTITION ||
83 pt->sys_ind == LINUX_RAID_PARTITION ||
84 pt->sys_ind == LINUX_DATA_PARTITION ||
85 pt->sys_ind == LINUX_LVM_PARTITION ||
86 is_extended_partition(pt))
87 return 0;
88 }
1493bf21 89 d = read_part_sector(state, 7, &sect);
e1dfa92d
OH
90 if (d) {
91 if (d[0] == '_' && d[1] == 'L' && d[2] == 'V' && d[3] == 'M')
92 ret = 1;
93 put_dev_sector(sect);
1d04f3c6 94 }
e1dfa92d
OH
95 return ret;
96}
97
d33b98fc
SW
98static void set_info(struct parsed_partitions *state, int slot,
99 u32 disksig)
100{
101 struct partition_meta_info *info = &state->parts[slot].info;
102
103 snprintf(info->uuid, sizeof(info->uuid), "%08x-%02x", disksig,
104 slot);
105 info->volname[0] = 0;
106 state->parts[slot].has_info = true;
107}
108
1da177e4
LT
109/*
110 * Create devices for each logical partition in an extended partition.
111 * The logical partitions form a linked list, with each entry being
112 * a partition table with two entries. The first entry
113 * is the real data partition (with a start relative to the partition
114 * table start). The second is a pointer to the next logical partition
115 * (with a start relative to the entire extended partition).
116 * We do not create a Linux partition for the partition tables, but
117 * only for the actual data partitions.
118 */
119
1493bf21 120static void parse_extended(struct parsed_partitions *state,
d33b98fc
SW
121 sector_t first_sector, sector_t first_size,
122 u32 disksig)
1da177e4
LT
123{
124 struct partition *p;
125 Sector sect;
126 unsigned char *data;
3fbf586c 127 sector_t this_sector, this_size;
1493bf21 128 sector_t sector_size = bdev_logical_block_size(state->bdev) / 512;
1da177e4
LT
129 int loopct = 0; /* number of links followed
130 without finding a data partition */
131 int i;
132
133 this_sector = first_sector;
134 this_size = first_size;
135
136 while (1) {
137 if (++loopct > 100)
138 return;
139 if (state->next == state->limit)
140 return;
1493bf21 141 data = read_part_sector(state, this_sector, &sect);
1da177e4
LT
142 if (!data)
143 return;
144
145 if (!msdos_magic_present(data + 510))
1d04f3c6 146 goto done;
1da177e4
LT
147
148 p = (struct partition *) (data + 0x1be);
149
150 /*
151 * Usually, the first entry is the real data partition,
152 * the 2nd entry is the next extended partition, or empty,
153 * and the 3rd and 4th entries are unused.
154 * However, DRDOS sometimes has the extended partition as
155 * the first entry (when the data partition is empty),
156 * and OS/2 seems to use all four entries.
157 */
158
1d04f3c6 159 /*
1da177e4
LT
160 * First process the data partition(s)
161 */
dce14c23 162 for (i = 0; i < 4; i++, p++) {
3fbf586c 163 sector_t offs, size, next;
dce14c23 164
3fbf586c 165 if (!nr_sects(p) || is_extended_partition(p))
1da177e4
LT
166 continue;
167
168 /* Check the 3rd and 4th entries -
169 these sometimes contain random garbage */
3fbf586c
DT
170 offs = start_sect(p)*sector_size;
171 size = nr_sects(p)*sector_size;
1da177e4
LT
172 next = this_sector + offs;
173 if (i >= 2) {
174 if (offs + size > this_size)
175 continue;
176 if (next < first_sector)
177 continue;
178 if (next + size > first_sector + first_size)
179 continue;
180 }
181
182 put_partition(state, state->next, next, size);
d33b98fc 183 set_info(state, state->next, disksig);
1da177e4 184 if (SYS_IND(p) == LINUX_RAID_PARTITION)
d18d7682 185 state->parts[state->next].flags = ADDPART_FLAG_RAID;
1da177e4
LT
186 loopct = 0;
187 if (++state->next == state->limit)
188 goto done;
189 }
190 /*
191 * Next, process the (first) extended partition, if present.
192 * (So far, there seems to be no reason to make
193 * parse_extended() recursive and allow a tree
194 * of extended partitions.)
195 * It should be a link to the next logical partition.
196 */
197 p -= 4;
dce14c23 198 for (i = 0; i < 4; i++, p++)
3fbf586c 199 if (nr_sects(p) && is_extended_partition(p))
1da177e4
LT
200 break;
201 if (i == 4)
202 goto done; /* nothing left to do */
203
3fbf586c
DT
204 this_sector = first_sector + start_sect(p) * sector_size;
205 this_size = nr_sects(p) * sector_size;
1da177e4
LT
206 put_dev_sector(sect);
207 }
208done:
209 put_dev_sector(sect);
210}
211
212/* james@bpgc.com: Solaris has a nasty indicator: 0x82 which also
213 indicates linux swap. Be careful before believing this is Solaris. */
214
1493bf21
TH
215static void parse_solaris_x86(struct parsed_partitions *state,
216 sector_t offset, sector_t size, int origin)
1da177e4
LT
217{
218#ifdef CONFIG_SOLARIS_X86_PARTITION
219 Sector sect;
220 struct solaris_x86_vtoc *v;
221 int i;
b84d8796 222 short max_nparts;
1da177e4 223
1493bf21 224 v = read_part_sector(state, offset + 1, &sect);
1da177e4
LT
225 if (!v)
226 return;
227 if (le32_to_cpu(v->v_sanity) != SOLARIS_X86_VTOC_SANE) {
228 put_dev_sector(sect);
229 return;
230 }
9c867fbe
AD
231 {
232 char tmp[1 + BDEVNAME_SIZE + 10 + 11 + 1];
233
234 snprintf(tmp, sizeof(tmp), " %s%d: <solaris:", state->name, origin);
235 strlcat(state->pp_buf, tmp, PAGE_SIZE);
236 }
1da177e4 237 if (le32_to_cpu(v->v_version) != 1) {
9c867fbe
AD
238 char tmp[64];
239
240 snprintf(tmp, sizeof(tmp), " cannot handle version %d vtoc>\n",
241 le32_to_cpu(v->v_version));
242 strlcat(state->pp_buf, tmp, PAGE_SIZE);
1da177e4
LT
243 put_dev_sector(sect);
244 return;
245 }
b84d8796 246 /* Ensure we can handle previous case of VTOC with 8 entries gracefully */
dce14c23
FF
247 max_nparts = le16_to_cpu(v->v_nparts) > 8 ? SOLARIS_X86_NUMSLICE : 8;
248 for (i = 0; i < max_nparts && state->next < state->limit; i++) {
1da177e4 249 struct solaris_x86_slice *s = &v->v_slice[i];
9c867fbe
AD
250 char tmp[3 + 10 + 1 + 1];
251
1da177e4
LT
252 if (s->s_size == 0)
253 continue;
9c867fbe
AD
254 snprintf(tmp, sizeof(tmp), " [s%d]", i);
255 strlcat(state->pp_buf, tmp, PAGE_SIZE);
1da177e4
LT
256 /* solaris partitions are relative to current MS-DOS
257 * one; must add the offset of the current partition */
258 put_partition(state, state->next++,
259 le32_to_cpu(s->s_start)+offset,
260 le32_to_cpu(s->s_size));
261 }
262 put_dev_sector(sect);
9c867fbe 263 strlcat(state->pp_buf, " >\n", PAGE_SIZE);
1da177e4
LT
264#endif
265}
266
486fd404 267#if defined(CONFIG_BSD_DISKLABEL)
1d04f3c6 268/*
1da177e4
LT
269 * Create devices for BSD partitions listed in a disklabel, under a
270 * dos-like partition. See parse_extended() for more information.
271 */
1493bf21
TH
272static void parse_bsd(struct parsed_partitions *state,
273 sector_t offset, sector_t size, int origin, char *flavour,
274 int max_partitions)
1da177e4
LT
275{
276 Sector sect;
277 struct bsd_disklabel *l;
278 struct bsd_partition *p;
9c867fbe 279 char tmp[64];
1da177e4 280
1493bf21 281 l = read_part_sector(state, offset + 1, &sect);
1da177e4
LT
282 if (!l)
283 return;
284 if (le32_to_cpu(l->d_magic) != BSD_DISKMAGIC) {
285 put_dev_sector(sect);
286 return;
287 }
9c867fbe
AD
288
289 snprintf(tmp, sizeof(tmp), " %s%d: <%s:", state->name, origin, flavour);
290 strlcat(state->pp_buf, tmp, PAGE_SIZE);
1da177e4
LT
291
292 if (le16_to_cpu(l->d_npartitions) < max_partitions)
293 max_partitions = le16_to_cpu(l->d_npartitions);
294 for (p = l->d_partitions; p - l->d_partitions < max_partitions; p++) {
3fbf586c 295 sector_t bsd_start, bsd_size;
1da177e4
LT
296
297 if (state->next == state->limit)
298 break;
1d04f3c6 299 if (p->p_fstype == BSD_FS_UNUSED)
1da177e4
LT
300 continue;
301 bsd_start = le32_to_cpu(p->p_offset);
302 bsd_size = le32_to_cpu(p->p_size);
22322035
R
303 if (memcmp(flavour, "bsd\0", 4) == 0)
304 bsd_start += offset;
1da177e4
LT
305 if (offset == bsd_start && size == bsd_size)
306 /* full parent partition, we have it already */
307 continue;
308 if (offset > bsd_start || offset+size < bsd_start+bsd_size) {
9c867fbe 309 strlcat(state->pp_buf, "bad subpartition - ignored\n", PAGE_SIZE);
1da177e4
LT
310 continue;
311 }
312 put_partition(state, state->next++, bsd_start, bsd_size);
313 }
314 put_dev_sector(sect);
9c867fbe
AD
315 if (le16_to_cpu(l->d_npartitions) > max_partitions) {
316 snprintf(tmp, sizeof(tmp), " (ignored %d more)",
317 le16_to_cpu(l->d_npartitions) - max_partitions);
318 strlcat(state->pp_buf, tmp, PAGE_SIZE);
319 }
320 strlcat(state->pp_buf, " >\n", PAGE_SIZE);
1da177e4
LT
321}
322#endif
323
1493bf21
TH
324static void parse_freebsd(struct parsed_partitions *state,
325 sector_t offset, sector_t size, int origin)
1da177e4
LT
326{
327#ifdef CONFIG_BSD_DISKLABEL
1493bf21 328 parse_bsd(state, offset, size, origin, "bsd", BSD_MAXPARTITIONS);
1da177e4
LT
329#endif
330}
331
1493bf21
TH
332static void parse_netbsd(struct parsed_partitions *state,
333 sector_t offset, sector_t size, int origin)
1da177e4
LT
334{
335#ifdef CONFIG_BSD_DISKLABEL
1493bf21 336 parse_bsd(state, offset, size, origin, "netbsd", BSD_MAXPARTITIONS);
1da177e4
LT
337#endif
338}
339
1493bf21
TH
340static void parse_openbsd(struct parsed_partitions *state,
341 sector_t offset, sector_t size, int origin)
1da177e4
LT
342{
343#ifdef CONFIG_BSD_DISKLABEL
1493bf21
TH
344 parse_bsd(state, offset, size, origin, "openbsd",
345 OPENBSD_MAXPARTITIONS);
1da177e4
LT
346#endif
347}
348
349/*
350 * Create devices for Unixware partitions listed in a disklabel, under a
351 * dos-like partition. See parse_extended() for more information.
352 */
1493bf21
TH
353static void parse_unixware(struct parsed_partitions *state,
354 sector_t offset, sector_t size, int origin)
1da177e4
LT
355{
356#ifdef CONFIG_UNIXWARE_DISKLABEL
357 Sector sect;
358 struct unixware_disklabel *l;
359 struct unixware_slice *p;
360
1493bf21 361 l = read_part_sector(state, offset + 29, &sect);
1da177e4
LT
362 if (!l)
363 return;
364 if (le32_to_cpu(l->d_magic) != UNIXWARE_DISKMAGIC ||
365 le32_to_cpu(l->vtoc.v_magic) != UNIXWARE_DISKMAGIC2) {
366 put_dev_sector(sect);
367 return;
368 }
9c867fbe
AD
369 {
370 char tmp[1 + BDEVNAME_SIZE + 10 + 12 + 1];
371
372 snprintf(tmp, sizeof(tmp), " %s%d: <unixware:", state->name, origin);
373 strlcat(state->pp_buf, tmp, PAGE_SIZE);
374 }
1da177e4
LT
375 p = &l->vtoc.v_slice[1];
376 /* I omit the 0th slice as it is the same as whole disk. */
377 while (p - &l->vtoc.v_slice[0] < UNIXWARE_NUMSLICE) {
378 if (state->next == state->limit)
379 break;
380
381 if (p->s_label != UNIXWARE_FS_UNUSED)
382 put_partition(state, state->next++,
3fbf586c
DT
383 le32_to_cpu(p->start_sect),
384 le32_to_cpu(p->nr_sects));
1da177e4
LT
385 p++;
386 }
387 put_dev_sector(sect);
9c867fbe 388 strlcat(state->pp_buf, " >\n", PAGE_SIZE);
1da177e4
LT
389#endif
390}
391
392/*
393 * Minix 2.0.0/2.0.2 subpartition support.
394 * Anand Krishnamurthy <anandk@wiproge.med.ge.com>
395 * Rajeev V. Pillai <rajeevvp@yahoo.com>
396 */
1493bf21
TH
397static void parse_minix(struct parsed_partitions *state,
398 sector_t offset, sector_t size, int origin)
1da177e4
LT
399{
400#ifdef CONFIG_MINIX_SUBPARTITION
401 Sector sect;
402 unsigned char *data;
403 struct partition *p;
404 int i;
405
1493bf21 406 data = read_part_sector(state, offset, &sect);
1da177e4
LT
407 if (!data)
408 return;
409
410 p = (struct partition *)(data + 0x1be);
411
412 /* The first sector of a Minix partition can have either
413 * a secondary MBR describing its subpartitions, or
414 * the normal boot sector. */
dce14c23 415 if (msdos_magic_present(data + 510) &&
1da177e4 416 SYS_IND(p) == MINIX_PARTITION) { /* subpartition table present */
9c867fbe 417 char tmp[1 + BDEVNAME_SIZE + 10 + 9 + 1];
1da177e4 418
9c867fbe
AD
419 snprintf(tmp, sizeof(tmp), " %s%d: <minix:", state->name, origin);
420 strlcat(state->pp_buf, tmp, PAGE_SIZE);
1da177e4
LT
421 for (i = 0; i < MINIX_NR_SUBPARTITIONS; i++, p++) {
422 if (state->next == state->limit)
423 break;
424 /* add each partition in use */
425 if (SYS_IND(p) == MINIX_PARTITION)
426 put_partition(state, state->next++,
3fbf586c 427 start_sect(p), nr_sects(p));
1da177e4 428 }
9c867fbe 429 strlcat(state->pp_buf, " >\n", PAGE_SIZE);
1da177e4
LT
430 }
431 put_dev_sector(sect);
432#endif /* CONFIG_MINIX_SUBPARTITION */
433}
434
435static struct {
436 unsigned char id;
1493bf21 437 void (*parse)(struct parsed_partitions *, sector_t, sector_t, int);
1da177e4
LT
438} subtypes[] = {
439 {FREEBSD_PARTITION, parse_freebsd},
440 {NETBSD_PARTITION, parse_netbsd},
441 {OPENBSD_PARTITION, parse_openbsd},
442 {MINIX_PARTITION, parse_minix},
443 {UNIXWARE_PARTITION, parse_unixware},
444 {SOLARIS_X86_PARTITION, parse_solaris_x86},
445 {NEW_SOLARIS_X86_PARTITION, parse_solaris_x86},
446 {0, NULL},
447};
1d04f3c6 448
1493bf21 449int msdos_partition(struct parsed_partitions *state)
1da177e4 450{
1493bf21 451 sector_t sector_size = bdev_logical_block_size(state->bdev) / 512;
1da177e4
LT
452 Sector sect;
453 unsigned char *data;
454 struct partition *p;
0607fd02 455 struct fat_boot_sector *fb;
1da177e4 456 int slot;
d33b98fc 457 u32 disksig;
1da177e4 458
1493bf21 459 data = read_part_sector(state, 0, &sect);
1da177e4
LT
460 if (!data)
461 return -1;
86ee8ba6
PDM
462
463 /*
464 * Note order! (some AIX disks, e.g. unbootable kind,
465 * have no MSDOS 55aa)
466 */
467 if (aix_magic_present(state, data)) {
1da177e4 468 put_dev_sector(sect);
f8f06603
PDM
469#ifdef CONFIG_AIX_PARTITION
470 return aix_partition(state);
471#else
86ee8ba6 472 strlcat(state->pp_buf, " [AIX]", PAGE_SIZE);
1da177e4 473 return 0;
f8f06603 474#endif
1da177e4
LT
475 }
476
86ee8ba6 477 if (!msdos_magic_present(data + 510)) {
e1dfa92d 478 put_dev_sector(sect);
e1dfa92d
OH
479 return 0;
480 }
481
1da177e4
LT
482 /*
483 * Now that the 55aa signature is present, this is probably
484 * either the boot sector of a FAT filesystem or a DOS-type
485 * partition table. Reject this in case the boot indicator
486 * is not 0 or 0x80.
487 */
488 p = (struct partition *) (data + 0x1be);
489 for (slot = 1; slot <= 4; slot++, p++) {
490 if (p->boot_ind != 0 && p->boot_ind != 0x80) {
0607fd02
FS
491 /*
492 * Even without a valid boot inidicator value
493 * its still possible this is valid FAT filesystem
494 * without a partition table.
495 */
496 fb = (struct fat_boot_sector *) data;
497 if (slot == 1 && fb->reserved && fb->fats
498 && fat_valid_media(fb->media)) {
9c867fbe 499 strlcat(state->pp_buf, "\n", PAGE_SIZE);
0607fd02
FS
500 put_dev_sector(sect);
501 return 1;
502 } else {
503 put_dev_sector(sect);
504 return 0;
505 }
1da177e4
LT
506 }
507 }
508
509#ifdef CONFIG_EFI_PARTITION
510 p = (struct partition *) (data + 0x1be);
511 for (slot = 1 ; slot <= 4 ; slot++, p++) {
512 /* If this is an EFI GPT disk, msdos should ignore it. */
513 if (SYS_IND(p) == EFI_PMBR_OSTYPE_EFI_GPT) {
514 put_dev_sector(sect);
515 return 0;
516 }
517 }
518#endif
519 p = (struct partition *) (data + 0x1be);
520
d33b98fc
SW
521 disksig = le32_to_cpup((__le32 *)(data + 0x1b8));
522
1da177e4
LT
523 /*
524 * Look for partitions in two passes:
525 * First find the primary and DOS-type extended partitions.
526 * On the second pass look inside *BSD, Unixware and Solaris partitions.
527 */
528
529 state->next = 5;
530 for (slot = 1 ; slot <= 4 ; slot++, p++) {
3fbf586c
DT
531 sector_t start = start_sect(p)*sector_size;
532 sector_t size = nr_sects(p)*sector_size;
dce14c23 533
1da177e4
LT
534 if (!size)
535 continue;
536 if (is_extended_partition(p)) {
8e0cc811
OH
537 /*
538 * prevent someone doing mkfs or mkswap on an
539 * extended partition, but leave room for LILO
540 * FIXME: this uses one logical sector for > 512b
541 * sector, although it may not be enough/proper.
542 */
543 sector_t n = 2;
dce14c23 544
8e0cc811
OH
545 n = min(size, max(sector_size, n));
546 put_partition(state, slot, start, n);
547
9c867fbe 548 strlcat(state->pp_buf, " <", PAGE_SIZE);
d33b98fc 549 parse_extended(state, start, size, disksig);
9c867fbe 550 strlcat(state->pp_buf, " >", PAGE_SIZE);
1da177e4
LT
551 continue;
552 }
553 put_partition(state, slot, start, size);
d33b98fc 554 set_info(state, slot, disksig);
1da177e4 555 if (SYS_IND(p) == LINUX_RAID_PARTITION)
cc910624 556 state->parts[slot].flags = ADDPART_FLAG_RAID;
1da177e4 557 if (SYS_IND(p) == DM6_PARTITION)
9c867fbe 558 strlcat(state->pp_buf, "[DM]", PAGE_SIZE);
1da177e4 559 if (SYS_IND(p) == EZD_PARTITION)
9c867fbe 560 strlcat(state->pp_buf, "[EZD]", PAGE_SIZE);
1da177e4
LT
561 }
562
9c867fbe 563 strlcat(state->pp_buf, "\n", PAGE_SIZE);
1da177e4
LT
564
565 /* second pass - output for each on a separate line */
566 p = (struct partition *) (0x1be + data);
567 for (slot = 1 ; slot <= 4 ; slot++, p++) {
568 unsigned char id = SYS_IND(p);
569 int n;
570
3fbf586c 571 if (!nr_sects(p))
1da177e4
LT
572 continue;
573
574 for (n = 0; subtypes[n].parse && id != subtypes[n].id; n++)
575 ;
576
577 if (!subtypes[n].parse)
578 continue;
1493bf21
TH
579 subtypes[n].parse(state, start_sect(p) * sector_size,
580 nr_sects(p) * sector_size, slot);
1da177e4
LT
581 }
582 put_dev_sector(sect);
583 return 1;
584}