Lines Matching +full:slice +full:- +full:per +full:- +full:line
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
16 * More flexible handling of extended partitions - aeb, 950831
20 * Re-organised Feb 1998 Russell King
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()
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()
143 sector_size = queue_logical_block_size(state->disk->queue) / 512; in parse_extended()
150 if (state->next == state->limit) 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()
208 p -= 4; in parse_extended()
242 v_slice[SOLARIS_X86_NUMSLICE]; /* slice headers */
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()
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()
313 __u32 d_secsize; /* # of bytes per sector */
314 __u32 d_nsectors; /* # of data sectors per track */
315 __u32 d_ntracks; /* # of tracks per cylinder */
316 __u32 d_ncylinders; /* # of data cylinders per unit */
317 __u32 d_secpercyl; /* # of data sectors per cylinder */
318 __u32 d_secperunit; /* # of data sectors per unit */
319 __u16 d_sparespertrack; /* # of spare sectors per track */
320 __u16 d_sparespercyl; /* # of spare sectors per cylinder */
321 __u32 d_acylinders; /* # of alt. cylinders per unit */
324 __u16 d_trackskew; /* sector 0 skew, per track */
325 __u16 d_cylskew; /* sector 0 skew, per cylinder */
327 __u32 d_trkseek; /* track-to-track seek, usec */
330 __u32 d_drivedata[NDDATA]; /* drive-type specific information */
345 __u8 p_frag; /* filesystem fragments per block */
346 __le16 p_cpg; /* filesystem cylinders per group */
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()
388 le32_to_cpu(l->d_partitions[2].p_offset) == 0) 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()
435 #define UNIXWARE_DISKMAGIC2 (0x600DDEEEUL) /* The slice table magic nr */
437 #define UNIXWARE_FS_UNUSED 0 /* Unused slice entry ID */
443 __le32 nr_sects; /* number of sectors in slice */
451 __le32 d_ncylinders; /* # of data cylinders per device */
452 __le32 d_ntracks; /* # of tracks per cylinder */
453 __le32 d_nsectors; /* # of data sectors per track */
454 __le32 d_secsize; /* # of bytes per sector */
459 __le32 d_phys_cyl; /* # of physical cylinders per device */
460 __le32 d_phys_trk; /* # of physical tracks per cylinder */
461 __le32 d_phys_sec; /* # of physical sectors per track */
462 __le32 d_phys_bytes; /* # of physical bytes per sector */
475 v_slice[UNIXWARE_NUMSLICE]; /* slice headers */
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()
506 /* I omit the 0th slice as it is the same as whole disk. */ 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()
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()
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()
623 if (p->boot_ind != 0 && p->boot_ind != 0x80) { 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()
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()