Lines Matching +full:partition +full:-
1 // SPDX-License-Identifier: GPL-2.0
6 * Copyright (C) 1991-1998 Linus Torvalds
9 * in the early extended-partition checks and added DM partitions
14 * /dev/hda *must* have a "DOS" type 0x51 partition in the first slot (hda1).
16 * More flexible handling of extended partitions - aeb, 950831
18 * Check partition table on IDE disks for common CHS translations
20 * Re-organised Feb 1998 Russell King
36 * the nr_sects and start_sect partition table entries are
43 return (sector_t)get_unaligned_le32(&p->nr_sects); in nr_sects()
48 return (sector_t)get_unaligned_le32(&p->start_sect); in start_sect()
53 return (p->sys_ind == DOS_EXTENDED_PARTITION || in is_extended_partition()
54 p->sys_ind == WIN98_EXTENDED_PARTITION || in is_extended_partition()
55 p->sys_ind == LINUX_EXTENDED_PARTITION); in is_extended_partition()
86 * Assume the partition table is valid if Linux partitions exists. in aix_magic_present()
88 * Linux swap partitions, so we consider that a Linux partition as in aix_magic_present()
92 if (pt->sys_ind == SOLARIS_X86_PARTITION || in aix_magic_present()
93 pt->sys_ind == LINUX_RAID_PARTITION || in aix_magic_present()
94 pt->sys_ind == LINUX_DATA_PARTITION || in aix_magic_present()
95 pt->sys_ind == LINUX_LVM_PARTITION || in aix_magic_present()
111 struct partition_meta_info *info = &state->parts[slot].info; in set_info()
113 snprintf(info->uuid, sizeof(info->uuid), "%08x-%02x", disksig, in set_info()
115 info->volname[0] = 0; in set_info()
116 state->parts[slot].has_info = true; in set_info()
120 * Create devices for each logical partition in an extended partition.
122 * a partition table with two entries. The first entry
123 * is the real data partition (with a start relative to the partition
124 * table start). The second is a pointer to the next logical partition
125 * (with a start relative to the entire extended partition).
126 * We do not create a Linux partition for the partition tables, but
140 without finding a data partition */ in parse_extended()
143 sector_size = queue_logical_block_size(state->disk->queue) / 512; in parse_extended()
150 if (state->next == state->limit) in parse_extended()
162 * Usually, the first entry is the real data partition, in parse_extended()
163 * the 2nd entry is the next extended partition, or empty, in parse_extended()
165 * However, DRDOS sometimes has the extended partition as in parse_extended()
166 * the first entry (when the data partition is empty), in parse_extended()
171 * First process the data partition(s) in parse_extended()
179 /* Check the 3rd and 4th entries - in parse_extended()
193 put_partition(state, state->next, next, size); in parse_extended()
194 set_info(state, state->next, disksig); in parse_extended()
195 if (p->sys_ind == LINUX_RAID_PARTITION) in parse_extended()
196 state->parts[state->next].flags = ADDPART_FLAG_RAID; in parse_extended()
198 if (++state->next == state->limit) in parse_extended()
202 * Next, process the (first) extended partition, if present. in parse_extended()
206 * It should be a link to the next logical partition. in parse_extended()
208 p -= 4; in parse_extended()
227 __le16 s_tag; /* ID tag of partition */
229 __le32 s_start; /* start sector no of partition */
230 __le32 s_size; /* # of blocks in partition */
262 if (le32_to_cpu(v->v_sanity) != SOLARIS_X86_VTOC_SANE) { in parse_solaris_x86()
269 snprintf(tmp, sizeof(tmp), " %s%d: <solaris:", state->name, origin); in parse_solaris_x86()
270 strlcat(state->pp_buf, tmp, PAGE_SIZE); in parse_solaris_x86()
272 if (le32_to_cpu(v->v_version) != 1) { in parse_solaris_x86()
276 le32_to_cpu(v->v_version)); in parse_solaris_x86()
277 strlcat(state->pp_buf, tmp, PAGE_SIZE); in parse_solaris_x86()
282 max_nparts = le16_to_cpu(v->v_nparts) > 8 ? SOLARIS_X86_NUMSLICE : 8; in parse_solaris_x86()
283 for (i = 0; i < max_nparts && state->next < state->limit; i++) { in parse_solaris_x86()
284 struct solaris_x86_slice *s = &v->v_slice[i]; in parse_solaris_x86()
287 if (s->s_size == 0) in parse_solaris_x86()
290 strlcat(state->pp_buf, tmp, PAGE_SIZE); in parse_solaris_x86()
291 /* solaris partitions are relative to current MS-DOS in parse_solaris_x86()
292 * one; must add the offset of the current partition */ in parse_solaris_x86()
293 put_partition(state, state->next++, in parse_solaris_x86()
294 le32_to_cpu(s->s_start)+offset, in parse_solaris_x86()
295 le32_to_cpu(s->s_size)); in parse_solaris_x86()
298 strlcat(state->pp_buf, " >\n", PAGE_SIZE); in parse_solaris_x86()
306 #define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */
327 __u32 d_trkseek; /* track-to-track seek, usec */
330 __u32 d_drivedata[NDDATA]; /* drive-type specific information */
336 /* filesystem and partition information: */
340 struct bsd_partition { /* the partition table */
341 __le32 p_size; /* number of sectors in partition */
353 * dos-like partition. See parse_extended() for more information.
367 if (le32_to_cpu(l->d_magic) != BSD_DISKMAGIC) { in parse_bsd()
372 snprintf(tmp, sizeof(tmp), " %s%d: <%s:", state->name, origin, flavour); in parse_bsd()
373 strlcat(state->pp_buf, tmp, PAGE_SIZE); in parse_bsd()
375 if (le16_to_cpu(l->d_npartitions) < max_partitions) in parse_bsd()
376 max_partitions = le16_to_cpu(l->d_npartitions); in parse_bsd()
377 for (p = l->d_partitions; p - l->d_partitions < max_partitions; p++) { in parse_bsd()
380 if (state->next == state->limit) in parse_bsd()
382 if (p->p_fstype == BSD_FS_UNUSED) in parse_bsd()
384 bsd_start = le32_to_cpu(p->p_offset); in parse_bsd()
385 bsd_size = le32_to_cpu(p->p_size); in parse_bsd()
386 /* FreeBSD has relative offset if C partition offset is zero */ in parse_bsd()
388 le32_to_cpu(l->d_partitions[2].p_offset) == 0) in parse_bsd()
391 /* full parent partition, we have it already */ in parse_bsd()
394 strlcat(state->pp_buf, "bad subpartition - ignored\n", PAGE_SIZE); in parse_bsd()
397 put_partition(state, state->next++, bsd_start, bsd_size); in parse_bsd()
400 if (le16_to_cpu(l->d_npartitions) > max_partitions) { in parse_bsd()
402 le16_to_cpu(l->d_npartitions) - max_partitions); in parse_bsd()
403 strlcat(state->pp_buf, tmp, PAGE_SIZE); in parse_bsd()
405 strlcat(state->pp_buf, " >\n", PAGE_SIZE); in parse_bsd()
455 __le32 d_part_start; /* # of first sector of this partition*/
481 * dos-like partition. See parse_extended() for more information.
494 if (le32_to_cpu(l->d_magic) != UNIXWARE_DISKMAGIC || in parse_unixware()
495 le32_to_cpu(l->vtoc.v_magic) != UNIXWARE_DISKMAGIC2) { in parse_unixware()
502 snprintf(tmp, sizeof(tmp), " %s%d: <unixware:", state->name, origin); in parse_unixware()
503 strlcat(state->pp_buf, tmp, PAGE_SIZE); in parse_unixware()
505 p = &l->vtoc.v_slice[1]; in parse_unixware()
507 while (p - &l->vtoc.v_slice[0] < UNIXWARE_NUMSLICE) { in parse_unixware()
508 if (state->next == state->limit) in parse_unixware()
511 if (p->s_label != UNIXWARE_FS_UNUSED) in parse_unixware()
512 put_partition(state, state->next++, in parse_unixware()
513 le32_to_cpu(p->start_sect), in parse_unixware()
514 le32_to_cpu(p->nr_sects)); in parse_unixware()
518 strlcat(state->pp_buf, " >\n", PAGE_SIZE); in parse_unixware()
544 /* The first sector of a Minix partition can have either in parse_minix()
548 p->sys_ind == MINIX_PARTITION) { /* subpartition table present */ in parse_minix()
551 snprintf(tmp, sizeof(tmp), " %s%d: <minix:", state->name, origin); in parse_minix()
552 strlcat(state->pp_buf, tmp, PAGE_SIZE); in parse_minix()
554 if (state->next == state->limit) in parse_minix()
556 /* add each partition in use */ in parse_minix()
557 if (p->sys_ind == MINIX_PARTITION) in parse_minix()
558 put_partition(state, state->next++, in parse_minix()
561 strlcat(state->pp_buf, " >\n", PAGE_SIZE); in parse_minix()
591 sector_size = queue_logical_block_size(state->disk->queue) / 512; in msdos_partition()
594 return -1; in msdos_partition()
605 strlcat(state->pp_buf, " [AIX]", PAGE_SIZE); in msdos_partition()
617 * either the boot sector of a FAT filesystem or a DOS-type in msdos_partition()
618 * partition table. Reject this in case the boot indicator in msdos_partition()
623 if (p->boot_ind != 0 && p->boot_ind != 0x80) { in msdos_partition()
627 * without a partition table. in msdos_partition()
630 if (slot == 1 && fb->reserved && fb->fats in msdos_partition()
631 && fat_valid_media(fb->media)) { in msdos_partition()
632 strlcat(state->pp_buf, "\n", PAGE_SIZE); in msdos_partition()
646 if (p->sys_ind == EFI_PMBR_OSTYPE_EFI_GPT) { in msdos_partition()
658 * First find the primary and DOS-type extended partitions. in msdos_partition()
662 state->next = 5; in msdos_partition()
672 * extended partition, but leave room for LILO in msdos_partition()
681 strlcat(state->pp_buf, " <", PAGE_SIZE); in msdos_partition()
683 strlcat(state->pp_buf, " >", PAGE_SIZE); in msdos_partition()
688 if (p->sys_ind == LINUX_RAID_PARTITION) in msdos_partition()
689 state->parts[slot].flags = ADDPART_FLAG_RAID; in msdos_partition()
690 if (p->sys_ind == DM6_PARTITION) in msdos_partition()
691 strlcat(state->pp_buf, "[DM]", PAGE_SIZE); in msdos_partition()
692 if (p->sys_ind == EZD_PARTITION) in msdos_partition()
693 strlcat(state->pp_buf, "[EZD]", PAGE_SIZE); in msdos_partition()
696 strlcat(state->pp_buf, "\n", PAGE_SIZE); in msdos_partition()
698 /* second pass - output for each on a separate line */ in msdos_partition()
701 unsigned char id = p->sys_ind; in msdos_partition()