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