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