When matching real partitions to "wanted" install descriptions, skip

all types of special partitions (like raw disk, or the MBR container
partition for the NetBSD part of the disk).
The start of the partition is no unique identifier if we include these
in the matching (e.g. boot partition and raw partition may both start
at sector 0).
This commit is contained in:
martin 2023-01-06 18:19:27 +00:00
parent 39a2427725
commit aa21971f77
3 changed files with 13 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bsddisklabel.c,v 1.71 2022/12/27 13:12:10 martin Exp $ */
/* $NetBSD: bsddisklabel.c,v 1.72 2023/01/06 18:19:27 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -1703,6 +1703,8 @@ apply_settings_to_partitions(struct disk_partitions *parts,
if (!parts->pscheme->get_part_info(parts, pno, &t))
continue;
if (t.flags & PTI_SPECIAL_PARTS)
continue;
for (i = 0; i < wanted->num; i++) {
if (wanted->infos[i].cur_part_id != NO_PART)

View File

@ -1,4 +1,4 @@
/* $NetBSD: label.c,v 1.47 2023/01/06 15:07:22 martin Exp $ */
/* $NetBSD: label.c,v 1.48 2023/01/06 18:19:27 martin Exp $ */
/*
* Copyright 1997 Jonathan Stone
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: label.c,v 1.47 2023/01/06 15:07:22 martin Exp $");
__RCSID("$NetBSD: label.c,v 1.48 2023/01/06 18:19:27 martin Exp $");
#endif
#include <sys/types.h>
@ -74,9 +74,7 @@ boringpart(const struct disk_part_info *info)
if (info->size == 0)
return true;
if (info->flags &
(PTI_PSCHEME_INTERNAL|PTI_WHOLE_DISK|PTI_SEC_CONTAINER|
PTI_RAW_PART))
if (info->flags & PTI_SPECIAL_PARTS)
return true;
return false;
@ -513,6 +511,9 @@ renumber_partitions(struct partition_usage_set *pset)
continue;
if (pset->infos[i].cur_flags != info.flags)
continue;
if ((info.flags & PTI_SPECIAL_PARTS) !=
(pset->infos[i].flags & PTI_SPECIAL_PARTS))
continue;
if ((info.fs_type != FS_UNUSED &&
info.fs_type == pset->infos[i].fs_type) ||
(pset->infos[i].type ==

View File

@ -1,4 +1,4 @@
/* $NetBSD: partitions.h,v 1.28 2022/06/09 18:26:06 martin Exp $ */
/* $NetBSD: partitions.h,v 1.29 2023/01/06 18:19:27 martin Exp $ */
/*
* Copyright (c) 2020 The NetBSD Foundation, Inc.
@ -132,6 +132,9 @@ struct part_type_desc {
* persistent; may only be
* set for a single partition!
*/
#define PTI_SPECIAL_PARTS \
(PTI_PSCHEME_INTERNAL|PTI_WHOLE_DISK|PTI_SEC_CONTAINER|PTI_RAW_PART)
/* A single partition */
struct disk_part_info {