Module Name:    src
Committed By:   martin
Date:           Thu Jan  9 13:22:32 UTC 2020

Modified Files:
        src/usr.sbin/sysinst: bsddisklabel.c defs.h disklabel.c disks.c gpt.c
            label.c mbr.c menus.mi menus.pm msg.mi.de msg.mi.en msg.mi.es
            msg.mi.fr msg.mi.pl msg.pm.de msg.pm.en msg.pm.es msg.pm.fr
            msg.pm.pl part_edit.c partitions.h partman.c target.c
        src/usr.sbin/sysinst/arch/arc: md.c
        src/usr.sbin/sysinst/arch/bebox: md.c
        src/usr.sbin/sysinst/arch/cobalt: md.c
        src/usr.sbin/sysinst/arch/evbarm: md.c
        src/usr.sbin/sysinst/arch/evbmips: md.c
        src/usr.sbin/sysinst/arch/evbppc: md.c
        src/usr.sbin/sysinst/arch/hpcarm: md.c
        src/usr.sbin/sysinst/arch/hpcmips: md.c
        src/usr.sbin/sysinst/arch/hpcsh: md.c
        src/usr.sbin/sysinst/arch/i386: md.c
        src/usr.sbin/sysinst/arch/landisk: md.c
        src/usr.sbin/sysinst/arch/luna68k: md.c
        src/usr.sbin/sysinst/arch/ofppc: md.c
        src/usr.sbin/sysinst/arch/playstation2: md.c
        src/usr.sbin/sysinst/arch/prep: md.c
        src/usr.sbin/sysinst/arch/sandpoint: md.c
        src/usr.sbin/sysinst/arch/zaurus: md.c

Log Message:
Finish conversion of extended partitioning parts to new abstract
backend interface. XXX still could use a lot of polishing.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/sysinst/bsddisklabel.c
cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/sysinst/disklabel.c \
    src/usr.sbin/sysinst/msg.mi.pl
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/sysinst/disks.c
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/sysinst/gpt.c \
    src/usr.sbin/sysinst/part_edit.c
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/sysinst/label.c
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/sysinst/mbr.c
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/sysinst/menus.mi \
    src/usr.sbin/sysinst/msg.mi.de
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/sysinst/menus.pm
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/sysinst/msg.mi.en
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/sysinst/msg.mi.es
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/sysinst/msg.mi.fr
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/sysinst/msg.pm.de \
    src/usr.sbin/sysinst/msg.pm.en src/usr.sbin/sysinst/msg.pm.es \
    src/usr.sbin/sysinst/msg.pm.fr src/usr.sbin/sysinst/msg.pm.pl
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/sysinst/partitions.h
cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/sysinst/partman.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/target.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/arch/arc/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/bebox/md.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/arch/cobalt/md.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/arch/evbarm/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/evbmips/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/evbppc/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/hpcarm/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/hpcmips/md.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/arch/hpcsh/md.c
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/sysinst/arch/i386/md.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/sysinst/arch/landisk/md.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sysinst/arch/luna68k/md.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/sysinst/arch/ofppc/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/playstation2/md.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/arch/prep/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/sandpoint/md.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/arch/zaurus/md.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.33 src/usr.sbin/sysinst/bsddisklabel.c:1.34
--- src/usr.sbin/sysinst/bsddisklabel.c:1.33	Fri Dec 13 22:12:41 2019
+++ src/usr.sbin/sysinst/bsddisklabel.c	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.33 2019/12/13 22:12:41 martin Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.34 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1547,7 +1547,7 @@ make_bsd_partitions(struct install_parti
 		if (pscheme == NULL)
 			return false;
 		parts = pscheme->create_new_for_disk(pm->diskdev,
-		    0, pm->dlsize, pm->dlsize, true);
+		    0, pm->dlsize, pm->dlsize, true, NULL);
 		if (parts == NULL)
 			return false;
 		pm->parts = parts;
@@ -1630,7 +1630,7 @@ make_bsd_partitions(struct install_parti
 	 * edit it and verify it's OK, or abort altogether.
 	 */
  	for (;;) {
-		int rv = edit_and_check_label(pm, &wanted);
+		int rv = edit_and_check_label(pm, &wanted, true);
 		if (rv == 0) {
 			msg_display(MSG_abort_part);
 			free_usage_set(&wanted);

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.49 src/usr.sbin/sysinst/defs.h:1.50
--- src/usr.sbin/sysinst/defs.h:1.49	Wed Dec 11 15:08:45 2019
+++ src/usr.sbin/sysinst/defs.h	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.49 2019/12/11 15:08:45 martin Exp $	*/
+/*	$NetBSD: defs.h,v 1.50 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -368,7 +368,7 @@ daddr_t tmp_ramdisk_size;
 
 daddr_t root_limit;    /* BIOS (etc) read limit */
 
-enum SHRED_T { SHRED_NONE=0, SHRED_ZEROS, SHRED_RANDOM, SHRED_CRYPTO };
+enum SHRED_T { SHRED_NONE=0, SHRED_ZEROS, SHRED_RANDOM };
 
 /* All information that is unique for each drive */
 SLIST_HEAD(pm_head_t, pm_devs) pm_head;
@@ -430,7 +430,6 @@ struct pm_devs {
 	 */
 	char **mounted;
 
-	bool bootable;	/* This device is bootable */
 	bool unsaved;	/* Flag indicating to partman that device need saving */
 	bool found;	/* Flag to delete unplugged and unconfigured devices */
 	int blocked;	/* Device is busy and cannot be changed */
@@ -442,11 +441,10 @@ struct pm_devs *pm_new; /* Pointer for n
 
 /* Generic structure for partman */
 struct part_entry {
-	int retvalue;
 	part_id id;
 	struct disk_partitions *parts;
 	void *dev_ptr;
-	size_t index;
+	size_t index;	/* e.g. if PM_RAID: this is raids[index] */
 	int dev_ptr_delta;
 	char fullname[SSTRSIZE];
 	enum {PM_DISK=1, PM_PART, PM_SPEC,
@@ -579,7 +577,6 @@ void remove_color_options(void);
 void remove_raid_options(void);
 void remove_lvm_options(void);
 void remove_cgd_options(void);
-void remove_gpt_options(void);
 
 /* Machine dependent functions .... */
 void	md_init(void);
@@ -697,7 +694,7 @@ int	fs_is_lfs(void *);
 const char *get_last_mounted(int fd, daddr_t offset, uint *fs_type,
      uint *fs_sub_type, uint flags);
 void	canonicalize_last_mounted(char*);
-int	edit_and_check_label(struct pm_devs *p, struct partition_usage_set *pset);
+int	edit_and_check_label(struct pm_devs *p, struct partition_usage_set *pset, bool install);
 int edit_ptn(menudesc *, void *);
 int checkoverlap(struct disk_partitions *parts);
 daddr_t getpartsize(struct disk_partitions *parts, daddr_t partstart,
@@ -869,15 +866,23 @@ static inline int partman(void) { return
 static inline int pm_getrefdev(struct pm_devs *x __unused) { return -1; }
 #define update_wedges(x) __nothing
 #endif
+void pmdiskentry_enable(menudesc*, struct part_entry *);
 int pm_partusage(struct pm_devs *, int, int);
 void pm_setfstype(struct pm_devs *, part_id, int, int);
+void pm_set_lvmpv(struct pm_devs *, part_id, bool);
+bool pm_is_lvmpv(struct pm_devs *, part_id, const struct disk_part_info*);
 int pm_editpart(int);
 void pm_rename(struct pm_devs *);
-int pm_shred(struct pm_devs *, int, int);
+void pm_shred(struct part_entry *, int);
 void pm_umount(struct pm_devs *, int);
 int pm_unconfigure(struct pm_devs *);
-int pm_cgd_edit(void *, struct part_entry *);
+int pm_cgd_edit_new(struct pm_devs *pm, part_id id);
+int pm_cgd_edit_old(struct part_entry *);
 void pm_wedges_fill(struct pm_devs *);
+void pm_edit_partitions(struct part_entry *);
+part_id pm_whole_disk(struct part_entry *, int);
+struct pm_devs * pm_from_pe(struct part_entry *);
+bool pm_force_parts(struct pm_devs *);
 
 /*
  * Parse a file system position or size in a common way, return

Index: src/usr.sbin/sysinst/disklabel.c
diff -u src/usr.sbin/sysinst/disklabel.c:1.27 src/usr.sbin/sysinst/disklabel.c:1.28
--- src/usr.sbin/sysinst/disklabel.c:1.27	Sun Dec 15 12:09:55 2019
+++ src/usr.sbin/sysinst/disklabel.c	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: disklabel.c,v 1.27 2019/12/15 12:09:55 martin Exp $	*/
+/*	$NetBSD: disklabel.c,v 1.28 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -116,7 +116,7 @@ disklabel_change_geom(struct disk_partit
 
 static struct disk_partitions *
 disklabel_parts_new(const char *dev, daddr_t start, daddr_t len,
-    daddr_t total_size, bool is_boot_drive)
+    daddr_t total_size, bool is_boot_drive, struct disk_partitions *parent)
 {
 	struct disklabel_disk_partitions *parts;
 	struct disk_geom geo;
@@ -144,14 +144,17 @@ disklabel_parts_new(const char *dev, dad
 	parts->dp.disk_start = start;
 	parts->dp.disk_size = parts->dp.free_space = len;
 	disklabel_init_default_alignment(parts, parts->l.d_secpercyl);
+	parts->dp.parent = parent;
 
 	strncpy(parts->l.d_packname, "fictious", sizeof parts->l.d_packname);
 
 #if RAW_PART > 2
-	parts->l.d_partitions[RAW_PART-1].p_fstype = FS_UNUSED;
-	parts->l.d_partitions[RAW_PART-1].p_offset = start;
-	parts->l.d_partitions[RAW_PART-1].p_size = len;
-	parts->dp.num_part++;
+	if (parts->dp.parent != NULL) {
+		parts->l.d_partitions[RAW_PART-1].p_fstype = FS_UNUSED;
+		parts->l.d_partitions[RAW_PART-1].p_offset = start;
+		parts->l.d_partitions[RAW_PART-1].p_size = len;
+		parts->dp.num_part++;
+	}
 #endif
 	parts->l.d_partitions[RAW_PART].p_fstype = FS_UNUSED;
 	parts->l.d_partitions[RAW_PART].p_offset = 0;
@@ -435,10 +438,13 @@ disklabel_delete_all(struct disk_partiti
 	parts->dp.num_part = 0;
 
 #if RAW_PART > 2
-	parts->l.d_partitions[RAW_PART-1].p_fstype = FS_UNUSED;
-	parts->l.d_partitions[RAW_PART-1].p_offset = parts->dp.disk_start;
-	parts->l.d_partitions[RAW_PART-1].p_size = parts->dp.disk_size;
-	parts->dp.num_part++;
+	if (parts->dp.parent != NULL) {
+		parts->l.d_partitions[RAW_PART-1].p_fstype = FS_UNUSED;
+		parts->l.d_partitions[RAW_PART-1].p_offset =
+		    parts->dp.disk_start;
+		parts->l.d_partitions[RAW_PART-1].p_size = parts->dp.disk_size;
+		parts->dp.num_part++;
+	}
 #endif
 	parts->l.d_partitions[RAW_PART].p_fstype = FS_UNUSED;
 	parts->l.d_partitions[RAW_PART].p_offset = 0;
@@ -466,7 +472,8 @@ disklabel_delete(struct disk_partitions 
 		if (ndx == id) {
 			if (part == RAW_PART
 #if RAW_PART > 2
-				|| part == RAW_PART-1
+				|| (part == RAW_PART-1 &&
+				    parts->dp.parent != NULL)
 #endif
 						) {
 				if (err_msg)
@@ -507,7 +514,8 @@ disklabel_delete_range(struct disk_parti
 		daddr_t end = start + parts->l.d_partitions[part].p_size;
 
 #if RAW_PART > 2
-		if (part == RAW_PART - 1 && start == r_start &&
+		if (parts->dp.parent != NULL &&
+		    part == RAW_PART - 1 && start == r_start &&
 		    r_start + r_size == end)
 			continue;
 #endif
@@ -537,7 +545,11 @@ dl_init_types(void)
 		enum part_type pt;
 		switch (i) {
 		case FS_UNUSED:	pt = PT_undef; break;
-		case FS_BSDFFS:	pt = PT_root; break;
+		case FS_BSDFFS:
+		case FS_RAID:
+		case FS_BSDLFS:
+		case FS_CGD:
+				pt = PT_root; break;
 		case FS_SWAP:	pt = PT_swap; break;
 		case FS_MSDOS:	pt = PT_FAT; break;
 		default:	pt = PT_unknown; break;
@@ -672,6 +684,21 @@ disklabel_get_generic_type(enum part_typ
 }
 
 static bool
+disklabel_get_default_fstype(const struct part_type_desc *nat_type,
+    unsigned *fstype, unsigned *fs_sub_type)
+{
+
+	*fstype = dl_part_type_from_generic(nat_type);
+#ifdef DEFAULT_UFS2
+        if (*fstype == FS_BSDFFS)
+                *fs_sub_type = 2;
+        else
+#endif
+                *fs_sub_type = 0;
+        return true;
+}
+
+static bool
 disklabel_get_part_info(const struct disk_partitions *arg, part_id id,
     struct disk_part_info *info)
 {
@@ -703,7 +730,7 @@ disklabel_get_part_info(const struct dis
 				info->flags |=
 				    PTI_PSCHEME_INTERNAL|PTI_RAW_PART;
 #if RAW_PART > 2
-			if (part == (RAW_PART-1) &&
+			if (part == (RAW_PART-1) && parts->dp.parent != NULL &&
 			    parts->l.d_partitions[part].p_fstype == FS_UNUSED)
 				info->flags |=
 				    PTI_PSCHEME_INTERNAL|PTI_WHOLE_DISK;
@@ -770,8 +797,8 @@ disklabel_get_free_spaces_internal(const
 	size_t cnt = 0, i;
 	daddr_t s, e, from, size, end_of_disk;
 
-	if (start < parts->dp.disk_start)
-		start = parts->dp.disk_start;
+	if (start <= parts->dp.disk_start+LABELSECTOR)
+		start = parts->dp.disk_start+LABELSECTOR+1;
 	if (min_space_size < 1)
 		min_space_size = 1;
 	if (align > 1 && (start % align) != 0)
@@ -850,7 +877,7 @@ disklabel_can_add_partition(const struct
 		if (i == RAW_PART)
 			continue;
 #if RAW_PART > 2
-		if (i == RAW_PART-1)
+		if (i == RAW_PART-1 && parts->dp.parent != NULL)
 			continue;
 #endif
 		if (parts->l.d_partitions[i].p_fstype == FS_UNUSED)
@@ -884,7 +911,7 @@ disklabel_set_disk_pack_name(struct disk
 static bool
 disklabel_get_part_device(const struct disk_partitions *arg,
     part_id ptn, char *devname, size_t max_devname_len, int *part,
-    enum dev_name_usage which_name, bool with_path)
+    enum dev_name_usage which_name, bool with_path, bool life)
 {
 	const struct disklabel_disk_partitions *parts =
 	    (const struct disklabel_disk_partitions*)arg;
@@ -979,7 +1006,7 @@ disklabel_add_partition(struct disk_part
 		if (i == RAW_PART)
 			continue;
 #if RAW_PART > 2
-		if (i == RAW_PART-1)
+		if (i == RAW_PART-1 && parts->dp.parent != NULL)
 			continue;
 #endif
 		if (parts->l.d_partitions[i].p_size > 0)
@@ -1042,7 +1069,7 @@ disklabel_add_outer_partition(struct dis
 		if (i == RAW_PART)
 			continue;
 #if RAW_PART > 2
-		if (i == RAW_PART-1)
+		if (i == RAW_PART-1 && parts->dp.parent != NULL)
 			continue;
 #endif
 		if (parts->l.d_partitions[i].p_size > 0)
@@ -1170,6 +1197,7 @@ disklabel_parts = {
 	.get_part_type = disklabel_get_type,
 	.get_generic_part_type = disklabel_get_generic_type,
 	.get_fs_part_type = disklabel_get_fs_part_type,
+	.get_default_fstype = disklabel_get_default_fstype,
 	.create_custom_part_type = disklabel_create_custom_part_type,
 	.create_unknown_part_type = disklabel_create_unknown_part_type,
 	.get_part_alignment = disklabel_get_alignment,
Index: src/usr.sbin/sysinst/msg.mi.pl
diff -u src/usr.sbin/sysinst/msg.mi.pl:1.27 src/usr.sbin/sysinst/msg.mi.pl:1.28
--- src/usr.sbin/sysinst/msg.mi.pl:1.27	Wed Dec 11 19:23:37 2019
+++ src/usr.sbin/sysinst/msg.mi.pl	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.pl,v 1.27 2019/12/11 19:23:37 martin Exp $	*/
+/*	$NetBSD: msg.mi.pl,v 1.28 2020/01/09 13:22:30 martin Exp $	*/
 /*	Based on english version: */
 /*	NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp       */
 
@@ -1152,15 +1152,12 @@ message failed {Nie powiodlo sie}
 message notsupported {Operacja nie jest obslugiwana!}
 message askfsmountadv {Punkt montowania (lub "raid", "cgd" albo "lvm")?}
 message partman {Partycje rozszerzone}
-message editbsdpart {Edytuj partycje NetBSD}
+message edit_parts {Edytuj partycje}
 message editpart {Edytuj partycje}
-message editmbr {Edytuj i zapisz MBR}
-message switchgpt {Przelacz na GPT}
-message switchmbr {Przelacz na MBR}
-message renamedisk {Ustaw nazwe dysku}
+message switch_parts {Switch partitioning scheme}
 message fmtasraid {Formatuj jako RAID}
 message fmtaslvm {Formatuj jak LVM PV}
-message encrypt {Szyfrowanie}
+message encrypt {Szyfrowanie (CGD)}
 message setbootable {Rozruchowy}
 message erase {Bezpieczne kasowanie}
 message undo {Cofanie zmian}

Index: src/usr.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.58 src/usr.sbin/sysinst/disks.c:1.59
--- src/usr.sbin/sysinst/disks.c:1.58	Wed Dec 11 19:23:37 2019
+++ src/usr.sbin/sysinst/disks.c	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.58 2019/12/11 19:23:37 martin Exp $ */
+/*	$NetBSD: disks.c,v 1.59 2020/01/09 13:22:30 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -758,7 +758,7 @@ convert_scheme(struct pm_devs *p, bool i
 		return false;
 
 	new_parts = new_scheme->create_new_for_disk(p->diskdev,
-	    0, p->dlsize, p->dlsize, is_boot_drive);
+	    0, p->dlsize, p->dlsize, is_boot_drive, NULL);
 	if (new_parts == NULL)
 		return false;
 
@@ -914,7 +914,6 @@ find_disks(const char *doingwhat, bool a
 		pm->found = 1;
 		pm->ptstart = 0;
 		pm->ptsize = 0;
-		pm->bootable = 0;
 		strlcpy(pm->diskdev, disk->dd_name, sizeof pm->diskdev);
 		strlcpy(pm->diskdev_descr, disk->dd_descr, sizeof pm->diskdev_descr);
 		/* Use as a default disk if the user has the sets on a local disk */
@@ -1132,15 +1131,15 @@ make_filesystems(struct install_partitio
 			continue;			
 
 		if (parts->pscheme->get_part_device(parts, ptn->cur_part_id,
-		    devdev, sizeof devdev, &partno, parent_device_only, false)
-		    && is_active_rootpart(devdev, partno))
+		    devdev, sizeof devdev, &partno, parent_device_only, false,
+		    false) && is_active_rootpart(devdev, partno))
 			continue;
 
 		parts->pscheme->get_part_device(parts, ptn->cur_part_id,
-		    devdev, sizeof devdev, &partno, plain_name, true);
+		    devdev, sizeof devdev, &partno, plain_name, true, true);
 
 		parts->pscheme->get_part_device(parts, ptn->cur_part_id,
-		    rdev, sizeof rdev, &partno, raw_dev_name, true);
+		    rdev, sizeof rdev, &partno, raw_dev_name, true, true);
 
 		switch (ptn->fs_type) {
 		case FS_APPLEUFS:
@@ -1311,7 +1310,7 @@ make_fstab(struct install_partition_desc
 
 		if (ptn->parts->pscheme->get_part_device(ptn->parts,
 			    ptn->cur_part_id, dev_buf, sizeof dev_buf, NULL,
-			    logical_name, true))
+			    logical_name, true, false))
 			dev = dev_buf;
 		else
 			dev = NULL;
@@ -1510,9 +1509,9 @@ process_found_fs(struct data *list, size
 		    &parts, &pno) || parts == NULL || pno == NO_PART)
 			return 0;
 		parts->pscheme->get_part_device(parts, pno,
-		    dev, sizeof(dev), NULL, plain_name, true);
+		    dev, sizeof(dev), NULL, plain_name, true, true);
 		parts->pscheme->get_part_device(parts, pno,
-		    rdev, sizeof(rdev), NULL, raw_dev_name, true);
+		    rdev, sizeof(rdev), NULL, raw_dev_name, true, true);
 	} else {
 		/* this fstab entry uses the plain device name */
 		if (is_root) {
@@ -1832,7 +1831,7 @@ mount_disks(struct install_partition_des
 
 		if (!install->infos[i].parts->pscheme->get_part_device(
 		    install->infos[i].parts, install->infos[i].cur_part_id,
-		    devdev, sizeof devdev, NULL, plain_name, true))
+		    devdev, sizeof devdev, NULL, plain_name, true, true))
 			return -1;
 		error = mount_root(devdev, true, false, install);
 		if (error != 0 && error != EBUSY)
@@ -1899,7 +1898,7 @@ set_swap(struct install_partition_desc *
 
 	if (!install->infos[i].parts->pscheme->get_part_device(
 	    install->infos[i].parts, install->infos[i].cur_part_id, dev_buf,
-	    sizeof dev_buf, NULL, plain_name, true))
+	    sizeof dev_buf, NULL, plain_name, true, true))
 		return -1;
 
 	rval = swapctl(SWAP_ON, dev_buf, 0);
@@ -2508,11 +2507,11 @@ clone_partition_data(struct disk_partiti
 
 	if (!src_parts->pscheme->get_part_device(
 	    src_parts, sid, src_dev, sizeof src_dev, NULL,
-	    raw_dev_name, true))
+	    raw_dev_name, true, true))
 		return false;
 	if (!dest_parts->pscheme->get_part_device(
 	    dest_parts, did, target_dev, sizeof target_dev, NULL,
-	    raw_dev_name, true))
+	    raw_dev_name, true, true))
 		return false;
 
 	return run_program(RUN_DISPLAY | RUN_PROGRESS, 

Index: src/usr.sbin/sysinst/gpt.c
diff -u src/usr.sbin/sysinst/gpt.c:1.13 src/usr.sbin/sysinst/gpt.c:1.14
--- src/usr.sbin/sysinst/gpt.c:1.13	Fri Dec 13 22:12:41 2019
+++ src/usr.sbin/sysinst/gpt.c	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: gpt.c,v 1.13 2019/12/13 22:12:41 martin Exp $	*/
+/*	$NetBSD: gpt.c,v 1.14 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -107,8 +107,8 @@ struct {
 	{ .name = "lfs",	.fstype = FS_BSDLFS,	.ptype = PT_root },
 	{ .name = "linux-data",	.fstype = FS_EX2FS,	.ptype = PT_root },
 	{ .name = "apple",	.fstype = FS_HFS,	.ptype = PT_unknown },
-	{ .name = "ccd",	.fstype = FS_CCD,	.ptype = PT_unknown },
-	{ .name = "cgd",	.fstype = FS_CGD,	.ptype = PT_unknown },
+	{ .name = "ccd",	.fstype = FS_CCD,	.ptype = PT_root },
+	{ .name = "cgd",	.fstype = FS_CGD,	.ptype = PT_root },
 	{ .name = "raid",	.fstype = FS_RAID,	.ptype = PT_root },
 	{ .name = "vmcore",	.fstype = FS_VMKCORE,	.ptype = PT_unknown },
 	{ .name = "vmfs",	.fstype = FS_VMFS,	.ptype = PT_unknown },
@@ -441,7 +441,7 @@ gpt_read_from_disk(const char *dev, dadd
 
 static struct disk_partitions *
 gpt_create_new(const char *disk, daddr_t start, daddr_t len, daddr_t total,
-    bool is_boot_drive)
+    bool is_boot_drive, struct disk_partitions *parent)
 {
 	struct gpt_disk_partitions *parts;
 
@@ -878,7 +878,7 @@ gpt_get_fs_part_type(enum part_type pt, 
 {
 	size_t i;
 
-	/* Try with complet match (including part_type) first */
+	/* Try with complete match (including part_type) first */
 	for (i = 0; i < __arraycount(gpt_fs_types); i++)
 		if (fstype == gpt_fs_types[i].fstype &&
 		    pt == gpt_fs_types[i].ptype)
@@ -892,6 +892,26 @@ gpt_get_fs_part_type(enum part_type pt, 
 	return NULL;
 }
 
+static bool
+gpt_get_default_fstype(const struct part_type_desc *nat_type,
+    unsigned *fstype, unsigned *fs_sub_type)
+{
+	const struct gpt_ptype_desc *gtype;
+
+	gtype = gpt_find_native_type(nat_type);
+	if (gtype == NULL)
+		return false;
+
+	*fstype = gtype->default_fs_type;
+#ifdef DEFAULT_UFS2
+	if (gtype->default_fs_type == FS_BSDFFS)
+		*fs_sub_type = 2;
+	else
+#endif
+		*fs_sub_type = 0;
+	return true;
+}
+
 static const struct part_type_desc *
 gpt_get_uuid_part_type(const uuid_t *id)
 {
@@ -1278,6 +1298,15 @@ gpt_add_wedge(const char *disk, struct g
 	strlcpy((char*)&dkw.dkw_wname, p->gp_id, sizeof(dkw.dkw_wname));
 	dkw.dkw_offset = p->gp_start;
 	dkw.dkw_size = p->gp_size;
+	if (dkw.dkw_wname[0] == 0) {
+		if (p->gp_label[0] != 0)
+				strlcpy((char*)&dkw.dkw_wname,
+				    p->gp_label, sizeof(dkw.dkw_wname));
+	}
+	if (dkw.dkw_wname[0] == 0) {
+		snprintf((char*)dkw.dkw_wname, sizeof dkw.dkw_wname,
+		    "%s_%" PRIi64 "@%" PRIi64, disk, p->gp_size, p->gp_start);
+	}
 
 	fd = opendisk(disk, O_RDWR, diskpath, sizeof(diskpath), 0);
 	if (fd < 0)
@@ -1310,7 +1339,7 @@ escape_spaces(char *dest, const char *sr
 static bool
 gpt_get_part_device(const struct disk_partitions *arg,
     part_id id, char *devname, size_t max_devname_len, int *part,
-    enum dev_name_usage usage, bool with_path)
+    enum dev_name_usage usage, bool with_path, bool life)
 {
 	const struct gpt_disk_partitions *parts =
 	    (const struct gpt_disk_partitions*)arg;
@@ -1328,8 +1357,11 @@ gpt_get_part_device(const struct disk_pa
 	if (part)
 		*part = -1;
 
-	if (!(p->gp_flags & GPEF_WEDGE) &&
-	    (usage == plain_name || usage == raw_dev_name))
+	if (usage == logical_name && p->gp_label[0] == 0 && p->gp_id[0] == 0)
+		usage = plain_name;
+	if (usage == plain_name || usage == raw_dev_name)
+		life = true;
+	if (!(p->gp_flags & GPEF_WEDGE) && life)
 		gpt_add_wedge(arg->disk, p);
 
 	switch (usage) {
@@ -1740,6 +1772,7 @@ gpt_parts = {
 	.get_part_type = gpt_get_ptype,
 	.get_generic_part_type = gpt_get_generic_type,
 	.get_fs_part_type = gpt_get_fs_part_type,
+	.get_default_fstype = gpt_get_default_fstype,
 	.create_custom_part_type = gpt_create_custom_part_type,
 	.create_unknown_part_type = gpt_create_unknown_part_type,
 	.get_part_alignment = gpt_get_part_alignment,
Index: src/usr.sbin/sysinst/part_edit.c
diff -u src/usr.sbin/sysinst/part_edit.c:1.13 src/usr.sbin/sysinst/part_edit.c:1.14
--- src/usr.sbin/sysinst/part_edit.c:1.13	Sat Nov 16 15:50:45 2019
+++ src/usr.sbin/sysinst/part_edit.c	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: part_edit.c,v 1.13 2019/11/16 15:50:45 joerg Exp $ */
+/*	$NetBSD: part_edit.c,v 1.14 2020/01/09 13:22:30 martin Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -1376,7 +1376,12 @@ select_part_scheme(
 
 	for (used = 0, ndx = 0; ndx < num_available_part_schemes; ndx++) {
 		p = available_part_schemes[ndx];
-		if (skip != NULL && p == skip)
+		/*
+		 * Do not match exactly, we want to skip all lookalikes
+		 * too (only_disklabel_parts vs. disklabel_parts)
+		 */
+		if (skip != NULL &&
+		    p->create_new_for_disk == skip->create_new_for_disk)
 			continue;
 		if (bootable && p->have_boot_support != NULL &&
 		    !p->have_boot_support(dev->diskdev))

Index: src/usr.sbin/sysinst/label.c
diff -u src/usr.sbin/sysinst/label.c:1.17 src/usr.sbin/sysinst/label.c:1.18
--- src/usr.sbin/sysinst/label.c:1.17	Sun Dec 15 11:22:46 2019
+++ src/usr.sbin/sysinst/label.c	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: label.c,v 1.17 2019/12/15 11:22:46 martin Exp $	*/
+/*	$NetBSD: label.c,v 1.18 2020/01/09 13:22:30 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.17 2019/12/15 11:22:46 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.18 2020/01/09 13:22:30 martin Exp $");
 #endif
 
 #include <sys/types.h>
@@ -182,7 +182,7 @@ checkoverlap(struct disk_partitions *par
  *  2 -> continue installation
  */
 static int
-verify_parts(struct partition_usage_set *pset)
+verify_parts(struct partition_usage_set *pset, bool install)
 {
 	struct part_usage_info *wanted;
 	struct disk_partitions *parts;
@@ -217,9 +217,9 @@ verify_parts(struct partition_usage_set 
 		}
 	}
 
-	if (num_root == 0 ||
+	if ((num_root == 0 && install) ||
 	    (num_root > 1 && inst_start == 0)) {
-		if (num_root == 0)
+		if (num_root == 0 && install)
 			msg_display_subst(MSG_must_be_one_root, 2,
 			    msg_string(parts->pscheme->name),
 			    msg_string(parts->pscheme->short_name));
@@ -426,6 +426,10 @@ renumber_partitions(struct partition_usa
 		for (i = 0; i < pset->parts->num_part; i++) {
 			if (pset->infos[i].cur_start != info.start)
 				continue;
+			if (pset->infos[i].cur_flags != info.flags)
+				continue;
+			if (pset->infos[i].type != info.nat_type->generic_ptype)
+				continue;
 			memcpy(&ninfos[pno], &pset->infos[i],
 			    sizeof(ninfos[pno]));
 			ninfos[pno].cur_part_id = pno;
@@ -1549,7 +1553,6 @@ add_partition_adder(menudesc *m, struct 
 
 	m->opts = nmenopts;
 	m->numopts++;
-	pset->num++;
 }
 
 static void
@@ -1561,7 +1564,6 @@ remove_partition_adder(menudesc *m, stru
 	memmove(m->opts+off, m->opts+off+1,
 	    (m->numopts-off-1)*sizeof(*m->opts));
 	m->numopts--;
-	pset->num--;
 }
 
 /*
@@ -1571,6 +1573,9 @@ remove_partition_adder(menudesc *m, stru
 static void
 show_partition_adder(menudesc *m, struct partition_usage_set *pset)
 {
+	if (m->opts == NULL)
+		return;
+
 	bool can_add_partition = pset->parts->pscheme->can_add_partition(
 	    pset->parts);
 	bool part_adder_present =
@@ -1605,7 +1610,8 @@ edit_fspart_abort(menudesc *m, void *arg
  * Ask the user if they want to edit the partition or give up.
  */
 int
-edit_and_check_label(struct pm_devs *p, struct partition_usage_set *pset)
+edit_and_check_label(struct pm_devs *p, struct partition_usage_set *pset,
+    bool install)
 {
 	menu_ent *op;
 	size_t cnt, i;
@@ -1697,7 +1703,7 @@ edit_and_check_label(struct pm_devs *p, 
 		}
 
 		/* User thinks the label is OK. */
-		i = verify_parts(pset);
+		i = verify_parts(pset, install);
 		if (i == 1)
 			continue;
 		break;

Index: src/usr.sbin/sysinst/mbr.c
diff -u src/usr.sbin/sysinst/mbr.c:1.23 src/usr.sbin/sysinst/mbr.c:1.24
--- src/usr.sbin/sysinst/mbr.c:1.23	Fri Dec 13 22:12:41 2019
+++ src/usr.sbin/sysinst/mbr.c	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.c,v 1.23 2019/12/13 22:12:41 martin Exp $ */
+/*	$NetBSD: mbr.c,v 1.24 2020/01/09 13:22:30 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -149,6 +149,13 @@ const struct disk_partitioning_scheme di
 static void convert_mbr_chs(int, int, int, uint8_t *, uint8_t *,
 				 uint8_t *, uint32_t);
 
+static part_id mbr_add_part(struct disk_partitions *arg,
+    const struct disk_part_info *info, const char **errmsg);
+
+static size_t mbr_get_free_spaces(const struct disk_partitions *arg,
+    struct disk_part_free_space *result, size_t max_num_result,
+    daddr_t min_size, daddr_t align, daddr_t lower_bound, daddr_t ignore);
+
 /*
  * Notes on the extended partition editor.
  *
@@ -827,7 +834,7 @@ mbr_init_default_alignments(struct mbr_d
 
 static struct disk_partitions *
 mbr_create_new(const char *disk, daddr_t start, daddr_t len, daddr_t total,
-    bool is_boot_drive)
+    bool is_boot_drive, struct disk_partitions *parent)
 {
 	struct mbr_disk_partitions *parts;
 
@@ -1708,16 +1715,33 @@ mbr_read_disklabel(struct disk_partition
 	struct mbr_disk_partitions *myparts =
 	    (struct mbr_disk_partitions*)arg;
 	struct disk_part_info part;
+	struct disk_part_free_space space;
 
 	if (force_empty && myparts->dlabel) 
-		myparts->dlabel->pscheme->delete_all_partitions(myparts->dlabel);
+		myparts->dlabel->pscheme->delete_all_partitions(
+		    myparts->dlabel);
 
 	if (myparts->dlabel == NULL) {
 		/*
 		 * Find the NetBSD MBR partition
 		 */
-		if (!mbr_find_netbsd(&myparts->mbr, start, &part))
-			return NULL;
+		if (!mbr_find_netbsd(&myparts->mbr, start, &part)) {
+			if (!force_empty)
+				return NULL;
+
+			/* add a "whole disk" NetBSD partition */
+			memset(&part, 0, sizeof part);
+			part.start = min(myparts->ptn_0_offset,start);
+			if (!mbr_get_free_spaces(arg, &space, 1,
+			    part.start, myparts->ptn_alignment, -1, -1))
+				return NULL;
+			part.start = space.start;
+			part.size = space.size;
+			part.nat_type = &mbr_gen_type_desc[MBR_PTYPE_NETBSD].gen;
+			mbr_add_part(arg, &part, NULL);
+			if (!mbr_find_netbsd(&myparts->mbr, start, &part))
+				return NULL;
+		}
 
 		if (!force_empty)
 			myparts->dlabel = disklabel_parts.read_from_disk(
@@ -1729,15 +1753,13 @@ mbr_read_disklabel(struct disk_partition
 			myparts->dlabel = 
 			    disklabel_parts.create_new_for_disk(
 			    myparts->dp.disk, part.start, part.size,
-			    myparts->dp.disk_size, false);
+			    myparts->dp.disk_size, false, &myparts->dp);
 		}
 
-		if (myparts->dlabel != NULL) {
-			myparts->dlabel->parent = arg;
+		if (myparts->dlabel != NULL)
 			myparts->dlabel->pscheme->change_disk_geom(
 			    myparts->dlabel, myparts->geo_cyl,
 			    myparts->geo_head, myparts->geo_sec);
-		}
 	}
 	return myparts->dlabel;
 }
@@ -2808,7 +2830,7 @@ add_wedge(const char *disk, daddr_t star
 	dkw.dkw_offset = start;
 	dkw.dkw_size = size;
 	snprintf((char*)dkw.dkw_wname, sizeof dkw.dkw_wname,
-	    "%s_%" PRIi64 "@%" PRIi64, (const char*)disk, size, start);
+	    "%s_%" PRIi64 "@%" PRIi64, disk, size, start);
 
 	*wname = 0;
 
@@ -2827,7 +2849,7 @@ add_wedge(const char *disk, daddr_t star
 static bool
 mbr_get_part_device(const struct disk_partitions *arg,
     part_id ptn, char *devname, size_t max_devname_len, int *part,
-    enum dev_name_usage usage, bool with_path)
+    enum dev_name_usage usage, bool with_path, bool life)
 {
 	const struct mbr_disk_partitions *parts =
 	    (const struct mbr_disk_partitions*)arg;
@@ -2857,7 +2879,7 @@ mbr_get_part_device(const struct disk_pa
 				return parts->dlabel->pscheme->get_part_device(
 				    parts->dlabel, dptn, devname,
 				     max_devname_len,
-				    part, usage, with_path);
+				    part, usage, with_path, life);
 			}
 		}
 

Index: src/usr.sbin/sysinst/menus.mi
diff -u src/usr.sbin/sysinst/menus.mi:1.19 src/usr.sbin/sysinst/menus.mi:1.20
--- src/usr.sbin/sysinst/menus.mi:1.19	Tue Jul 23 16:02:32 2019
+++ src/usr.sbin/sysinst/menus.mi	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: menus.mi,v 1.19 2019/07/23 16:02:32 martin Exp $	*/
+/*	$NetBSD: menus.mi,v 1.20 2020/01/09 13:22:30 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -195,16 +195,6 @@ remove_lvm_options()
 }
 
 void
-remove_gpt_options()
-{
-	/*
-	 * No GPT available, remove the following menu entries:
-	 */
-	remove_menu_option(MENU_pmdiskentry, MSG_switchgpt);
-	remove_menu_option(MENU_pmpartentry, MSG_switchgpt);
-}
-
-void
 remove_cgd_options()
 {
 	/*
Index: src/usr.sbin/sysinst/msg.mi.de
diff -u src/usr.sbin/sysinst/msg.mi.de:1.19 src/usr.sbin/sysinst/msg.mi.de:1.20
--- src/usr.sbin/sysinst/msg.mi.de:1.19	Wed Dec 11 19:23:37 2019
+++ src/usr.sbin/sysinst/msg.mi.de	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.de,v 1.19 2019/12/11 19:23:37 martin Exp $	*/
+/*	$NetBSD: msg.mi.de,v 1.20 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1220,15 +1220,12 @@ message failed {Fehlgeschlagen}
 message notsupported {Operation wird nicht unterstützt!}
 message askfsmountadv {Mountpoint oder 'raid' oder 'cgd' oder 'lvm'?}
 message partman {Erweiterte Partitionierung}
-message editbsdpart {NetBSD Partitionen bearbeiten}
+message edit_parts {Partitionen bearbeiten}
 message editpart {Partitionen bearbeiten}
-message editmbr {MBR bearbeiten und speichern}
-message switchgpt {Wechseln zu GPT}
-message switchmbr {Wechseln zu MBR}
-message renamedisk {Festplatten-Namen festlegen}
-message fmtasraid {Format als RAID}
-message fmtaslvm {Format als LVM-PV}
-message encrypt {Verschlüsseln}
+message switch_parts {Switch partitioning scheme}
+message fmtasraid {Als RAID Komponente formatieren}
+message fmtaslvm {Als LVM-PV formatieren}
+message encrypt {Verschlüsseln (CGD)}
 message setbootable {Boot-Flag}
 message erase {Safe Erase}
 message undo {Rückgängigmachen von Änderungen}

Index: src/usr.sbin/sysinst/menus.pm
diff -u src/usr.sbin/sysinst/menus.pm:1.2 src/usr.sbin/sysinst/menus.pm:1.3
--- src/usr.sbin/sysinst/menus.pm:1.2	Wed Jun 12 06:20:17 2019
+++ src/usr.sbin/sysinst/menus.pm	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: menus.pm,v 1.2 2019/06/12 06:20:17 martin Exp $	*/
+/*	$NetBSD: menus.pm,v 1.3 2020/01/09 13:22:30 martin Exp $	*/
 /*	NetBSD: menus.mi,v 1.14 2018/09/11 08:05:18 martin Exp 		*/
 
 /*-
@@ -32,51 +32,37 @@
 
 /* Menu system definitions -- extended partitioning */
 
+/* arg is a struct part_entry* */
 menu pmdiskentry, x=50, y=5, exit, default exit;
-	option MSG_editbsdpart, exit, action
-				 {
-#ifndef NO_DISKLABEL	/* XXX ??? */
-					 make_bsd_partitions(NULL);
-#endif
-				  };
-	option MSG_editmbr,		exit, action {
-				md_get_info(NULL);
-				md_pre_disklabel(NULL, pm->parts);
-	};
-	option MSG_switchgpt,	exit, action {
-				const char *err;
-				if (!convert_scheme(pm, false, &err))
-					err_msg_win(err);
-				else
-					pm_partusage(pm, -1, 1);
-	};
-	option MSG_renamedisk,	exit, action {
-				pm->unsaved = 1; pm_rename(pm);
-	};
-	option MSG_fmtasraid,	exit, action {
-				pm->unsaved = 1;
-				pm_partusage(pm, -1, 1);
-				(*(enum setup_type*)arg) = SY_NEWRAID;
-				md_make_bsd_partitions(NULL);
-	};
-	option MSG_fmtaslvm,	exit, action {
-				pm->unsaved = 1;
-				pm_partusage(pm, -1, 1);
-				(*(enum setup_type*)arg) = SY_NEWLVM;
-				md_make_bsd_partitions(NULL);
+	display action { pmdiskentry_enable(menu, arg); };
+	option MSG_edit_parts, exit, action { pm_edit_partitions(arg); };
+	option MSG_switch_parts, exit, action {
+		struct pm_devs *my_pm = pm_from_pe(arg);
+		const char *err;
+
+		if (!convert_scheme(my_pm, false, &err))
+			err_msg_win(err);
+		else
+			pm_partusage(my_pm, -1, 1);
 	};
-	option MSG_encrypt,		exit, action {
-				pm->unsaved = 1;
-				pm_partusage(pm, -1, 1);
-				(*(enum setup_type*)arg) = SY_NEWCGD;
-				md_make_bsd_partitions(NULL);
-				pm_cgd_edit(0, &(struct part_entry)
-				    {.dev_ptr = pm, .index = 0 }
-				    );
-	};
-	option MSG_setbootable,	exit, action {
-				pm->unsaved = 1;
-				pm->bootable = !pm->bootable;
+	option MSG_fmtasraid, exit, action
+	{
+		pm_whole_disk(arg, SY_NEWRAID);
+	};
+	option MSG_fmtaslvm, exit, action
+	{
+		part_id new_part;
+
+		new_part = pm_whole_disk(arg, SY_NEWLVM);
+		if (new_part != NO_PART)
+			pm_set_lvmpv(pm_from_pe(arg), new_part, true);
+	};
+	option MSG_encrypt, exit, action
+	{
+		part_id new_part;
+		new_part = pm_whole_disk(arg, SY_NEWCGD);
+		if (new_part != NO_PART)
+			 pm_cgd_edit_new(pm_from_pe(arg), new_part);
 	};
 	option MSG_erase,		next menu shred_modes;
 	option MSG_undo,		exit, action {
@@ -88,120 +74,109 @@ menu pmdiskentry, x=50, y=5, exit, defau
 					pm_partusage(pm, -1, 1);
 	};
 
+/* arg is a struct part_entry* */
 menu pmpartentry, x=50, y=5, exit, default exit;
-	option MSG_edit,		exit, action { 
-									pm->unsaved = 1;
-									uint tpfs = 0; /*PI_FSTYPE(&pm->bsdlabel[*(int*)arg]);*/
-									// int tplvm = 0; /* pm->bsdlabel[*(int*)arg].lvmpv; */
-									pm_editpart(*(int*)arg);
-									if (tpfs != 0 /*PI_FSTYPE(&pm->bsdlabel[*(int*)arg]) ||
-										tplvm != pm->bsdlabel[*(int*)arg].lvmpv */)
-										/* Oops, partition type changed */
-										pm_partusage(pm, *(int*)arg, 1);
-								};
-	option MSG_fmtasraid,	exit, action {
-									if (pm->no_part) {
-										hit_enter_to_continue(NULL, MSG_notsupported);
-										return -1;
-									}
-									pm->unsaved = 1;
-									pm_partusage(pm, *(int*)arg, 1);
-									pm_setfstype(pm, (part_id)*(int*)arg, FS_RAID, 0);
-								};
-	option MSG_fmtaslvm,	exit, action {
-									if (pm->no_part) {
-										hit_enter_to_continue(NULL, MSG_notsupported);
-										return -1;
-									}
-									pm->unsaved = 1;
-									pm_partusage(pm, *(int*)arg, 1);
-									pm_setfstype(pm, (part_id)*(int*)arg, FS_BSDFFS, 2);
-									/* pm->bsdlabel[*(int*)arg].lvmpv = 1; */
-								};
-	option MSG_encrypt,		exit, action {
-									if (pm->no_part) {
-										hit_enter_to_continue(NULL, MSG_notsupported);
-										return -1;
-									}
-									pm->unsaved = 1;
-									pm_partusage(pm, *(int*)arg, 1);
-									pm_setfstype(pm, (part_id)*(int*)arg, FS_CGD, 0);
-									pm_cgd_edit(0,
-										&(struct part_entry){.dev_ptr = pm,
-											.id = *(int*)arg});
-								};
-	option MSG_erase,		next menu shred_modes;
-	option MSG_doumount,	exit, action { pm_umount(pm, *(int*)arg); };
-	option MSG_Delete_partition,	exit, action {
-									pm->unsaved = 1;
-									pm_partusage(pm, *(int*)arg, 1);
-									if (pm->no_part)
-										pm_unconfigure(pm);
-									else
-										pm_setfstype(pm, (part_id)*(int*)arg, FS_UNUSED, 0);
-									};
-
-menu pmgptentry, x=50, y=8, exit, default exit;
-	option MSG_editpart, exit, action { /* pm_make_gpt_partitions(pm); */ };
-	option MSG_switchmbr,	exit, action
-	    {
-		const char *err;
-		if (!convert_scheme(pm, false, &err))
-			err_msg_win(err);
-		else
-			pm_partusage(pm, -1, 1);
-	    };
-	option MSG_setbootable,	exit, action
-	    {
+	option MSG_edit, exit, action
+	{
+		struct part_entry *cur_pe = arg;
+		pm->unsaved = 1;
+		pm_editpart(cur_pe->id);
+		pm_partusage(pm, cur_pe->id, 1);
+	};
+	option MSG_fmtasraid, exit, action {
+		if (pm->no_part) {
+			hit_enter_to_continue(NULL, MSG_notsupported);
+			return -1;
+		}
+		struct part_entry *cur_pe = arg;
+		pm->unsaved = 1;
+		pm_partusage(pm, cur_pe->id, 1);
+		pm_setfstype(pm, cur_pe->id, FS_RAID, 0);
+	};
+	option MSG_fmtaslvm, exit, action {
+		if (pm->no_part) {
+			hit_enter_to_continue(NULL, MSG_notsupported);
+			return -1;
+		}
+		struct part_entry *cur_pe = arg;
+		pm->unsaved = 1;
+		pm_partusage(pm, cur_pe->id, 1);
+		pm_setfstype(pm, cur_pe->id, FS_BSDFFS, 2);
+		pm_set_lvmpv(pm, cur_pe->id, true);
+	};
+	option MSG_encrypt, exit, action {
+		if (pm->no_part) {
+			hit_enter_to_continue(NULL, MSG_notsupported);
+			return -1;
+		}
+		struct part_entry *cur_pe = arg;
 		pm->unsaved = 1;
-		pm->bootable = !pm->bootable;
-	    };
+		pm_partusage(pm, cur_pe->id, 1);
+		pm_setfstype(pm, cur_pe->id, FS_CGD, 0);
+		pm_cgd_edit_old(cur_pe);
+	};
 	option MSG_erase, next menu shred_modes;
-	option MSG_undo, exit, action
-	    {
-		/* label_read(); */ pm->unsaved = 0;
-		pm_partusage(pm, -1, 1);
-	    };
-	option MSG_unconfig, exit, action
-	    {
-		if (pm_unconfigure(pm) == 0)
-					pm_partusage(pm, -1, 1);
-	    };
+	option MSG_doumount, exit, action {
+		struct part_entry *cur_pe = arg;
+		pm_umount(pm, cur_pe->id);
+	};
+	option MSG_Delete_partition, exit, action {
+		struct part_entry *cur_pe = arg;
+		pm->unsaved = 1;
+		pm_partusage(pm, cur_pe->id, 1);
+		if (pm->no_part)
+			pm_unconfigure(pm);
+		else
+			pm_setfstype(pm, cur_pe->id, FS_UNUSED, 0);
+	};
 
+/* arg is a struct part_entry* */
 menu shred_modes, x=50, y=5, exit, default exit;
-	option MSG_fillzeros,	exit,
-							action { pm_shred(pm, *(int*)arg, SHRED_ZEROS); };
+	option MSG_fillzeros, exit,
+		action { pm_shred(arg, SHRED_ZEROS); };
 	option MSG_fillrandom,	exit,
-							action { pm_shred(pm, *(int*)arg, SHRED_RANDOM); };
-	option MSG_fillcrypto,	exit,
-							action { pm_shred(pm, *(int*)arg, SHRED_CRYPTO); };
+		action { pm_shred(arg, SHRED_RANDOM); };
 
+/* arg is a int pointer for the requested raid level */
 menu raidlevel;
 	option MSG_raid0, exit, action { *(int *)arg = 0; };
 	option MSG_raid1, exit, action { *(int *)arg = 1; };
 	option MSG_raid4, exit, action { *(int *)arg = 4; };
 	option MSG_raid5, exit, action { *(int *)arg = 5; };
 
+/* arg is a const char ** set to the selected encryption type */
 menu cgd_enctype;
-	option "aes-xts",			exit, action { *(const char**)arg = "aes-xts"; };
-	option "aes-cbc",			exit, action { *(const char**)arg = "aes-cbc"; };
-	option "3des-cbc",			exit, action { *(const char**)arg = "3des-cbc"; };
-	option "blowfish-cbc",		exit, action { *(const char**)arg = "blowfish-cbc"; };
+	option "aes-xts", exit, action { *(const char**)arg = "aes-xts"; };
+	option "aes-cbc", exit, action { *(const char**)arg = "aes-cbc"; };
+	option "3des-cbc", exit, action { *(const char**)arg = "3des-cbc"; };
+	option "blowfish-cbc", exit, action
+				{ *(const char**)arg = "blowfish-cbc"; };
 
+/* arg is a const char ** set to the requested iv type */
 menu cgd_ivtype;
-	option "encblkno1",			exit, action { *(const char**)arg = "encblkno1"; };
-	option "encblkno8",			exit, action { *(const char**)arg = "encblkno8"; };
+	option "encblkno1", exit, action { *(const char**)arg = "encblkno1"; };
+	option "encblkno8", exit, action { *(const char**)arg = "encblkno8"; };
 
+/* arg is const char ** set to the key gen type */
 menu cgd_keygentype;
-	option "pkcs5_pbkdf2/sha1",	exit, action { *(const char**)arg = "pkcs5_pbkdf2/sha1"; };
-	option "pkcs5_pbkdf2",		exit, action { *(const char**)arg = "pkcs5_pbkdf2"; };
-	option "storedkey",			exit, action { *(const char**)arg = "storedkey"; };
-	option "randomkey",			exit, action { *(const char**)arg = "randomkey"; };
-	option "urandomkey",		exit, action { *(const char**)arg = "urandomkey"; };
-	option "shell_cmd",			exit, action { *(const char**)arg = "shell_cmd"; };
+	option "pkcs5_pbkdf2/sha1", exit, action
+				 { *(const char**)arg = "pkcs5_pbkdf2/sha1"; };
+	option "pkcs5_pbkdf2", exit, action
+				{ *(const char**)arg = "pkcs5_pbkdf2"; };
+	option "storedkey", exit, action
+				{ *(const char**)arg = "storedkey"; };
+	option "randomkey", exit, action
+				{ *(const char**)arg = "randomkey"; };
+	option "urandomkey", exit, action
+				{ *(const char**)arg = "urandomkey"; };
+	option "shell_cmd", exit, action
+				{ *(const char**)arg = "shell_cmd"; };
 
+/* art is a const char ** set to the requested verification type */
 menu cgd_verifytype;
-	option "none",				exit, action { *(const char**)arg = "none"; };
-	option "disklabel",			exit, action { *(const char**)arg = "disklabel"; };
-	option "ffs",				exit, action { *(const char**)arg = "ffs"; };
-	option "re-enter",			exit, action { *(const char**)arg = "re-enter"; };
+	option "none",		exit, action { *(const char**)arg = "none"; };
+	option "disklabel",	exit, action { *(const char**)arg = "disklabel"; };
+	option "MBR",		exit, action { *(const char**)arg = "mbr"; };
+	option "GPT",		exit, action { *(const char**)arg = "gpt"; };
+	option "ffs",		exit, action { *(const char**)arg = "ffs"; };
+	option "re-enter",	exit, action { *(const char**)arg = "re-enter"; };

Index: src/usr.sbin/sysinst/msg.mi.en
diff -u src/usr.sbin/sysinst/msg.mi.en:1.26 src/usr.sbin/sysinst/msg.mi.en:1.27
--- src/usr.sbin/sysinst/msg.mi.en:1.26	Wed Dec 11 19:23:37 2019
+++ src/usr.sbin/sysinst/msg.mi.en	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.en,v 1.26 2019/12/11 19:23:37 martin Exp $	*/
+/*	$NetBSD: msg.mi.en,v 1.27 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1150,15 +1150,12 @@ message failed {Failed}
 message notsupported {Operation not supported!}
 message askfsmountadv {Mountpoint (or 'raid', 'cgd', 'lvm')?}
 message partman {Extended partitioning}
-message editbsdpart {Edit NetBSD partitions}
+message edit_parts {Edit partitions}
 message editpart {Edit partitions}
-message editmbr {Edit and save MBR}
-message switchgpt {Switch to GPT}
-message switchmbr {Switch to MBR}
-message renamedisk {Set disk name}
+message switch_parts {Switch partitioning scheme}
 message fmtasraid {Format as RAID}
 message fmtaslvm {Format as LVM PV}
-message encrypt {Encrypt}
+message encrypt {Encrypt (CGD)}
 message setbootable {Bootable flag}
 message erase {Safe erase}
 message undo {Undo changes}

Index: src/usr.sbin/sysinst/msg.mi.es
diff -u src/usr.sbin/sysinst/msg.mi.es:1.20 src/usr.sbin/sysinst/msg.mi.es:1.21
--- src/usr.sbin/sysinst/msg.mi.es:1.20	Wed Dec 11 19:23:37 2019
+++ src/usr.sbin/sysinst/msg.mi.es	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.es,v 1.20 2019/12/11 19:23:37 martin Exp $	*/
+/*	$NetBSD: msg.mi.es,v 1.21 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1201,15 +1201,12 @@ message failed {Error}
 message notsupported {Operación no admitida!}
 message askfsmountadv {Punto de montaje o 'raid' o 'CGD' o 'lvm'?}
 message partman {Partición extendida}
-message editbsdpart {Editar particiones NetBSD}
+message edit_parts {Editar particiones}
 message editpart {Editar particiones}
-message editmbr {Editar y guardar MBR}
-message switchgpt {Cambiar a GPT}
-message switchmbr {Cambiar a MBR}
-message renamedisk {Establece el nombre del disco}
+message switch_parts {Switch partitioning scheme}
 message fmtasraid {Formato como RAID}
 message fmtaslvm {Formato como LVM PV}
-message encrypt {Cifrar}
+message encrypt {Cifrar (CGD)}
 message setbootable {La bandera de arranque}
 message erase {Borrado seguro}
 message undo {Deshacer los cambios}

Index: src/usr.sbin/sysinst/msg.mi.fr
diff -u src/usr.sbin/sysinst/msg.mi.fr:1.24 src/usr.sbin/sysinst/msg.mi.fr:1.25
--- src/usr.sbin/sysinst/msg.mi.fr:1.24	Wed Dec 11 19:23:37 2019
+++ src/usr.sbin/sysinst/msg.mi.fr	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.fr,v 1.24 2019/12/11 19:23:37 martin Exp $	*/
+/*	$NetBSD: msg.mi.fr,v 1.25 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1253,15 +1253,12 @@ message failed {Échoué}
 message notsupported {Le fonctionnement n'est pas pris en charge!}
 message askfsmountadv {Point de montage ou de 'raid' ou 'cgd' ou 'lvm'?}
 message partman {Partitionnement étendu}
-message editbsdpart {Modifier les partitions NetBSD}
+message edit_parts {Modifier les partitions}
 message editpart {Modifier les partitions}
-message editmbr {Modifiez et enregistrez MBR}
-message switchgpt {Mettre à GPT}
-message switchmbr {Basculer vers MBR}
-message renamedisk {Définir le nom du disque}
+message switch_parts {Switch partitioning scheme}
 message fmtasraid {Format en RAID}
 message fmtaslvm {Format de LVM PV}
-message encrypt {Crypter}
+message encrypt {Crypter (CGD)}
 message setbootable {Drapeau d'amorçage}
 message erase {Fonction d'effacement sécurisé}
 message undo {Annuler les changements}

Index: src/usr.sbin/sysinst/msg.pm.de
diff -u src/usr.sbin/sysinst/msg.pm.de:1.1 src/usr.sbin/sysinst/msg.pm.de:1.2
--- src/usr.sbin/sysinst/msg.pm.de:1.1	Wed Jun 12 06:20:18 2019
+++ src/usr.sbin/sysinst/msg.pm.de	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.pm.de,v 1.1 2019/06/12 06:20:18 martin Exp $	*/
+/*	$NetBSD: msg.pm.de,v 1.2 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -34,9 +34,8 @@
 
 /* extended partition manager message catalog -- German, machine independent */
 
-message fillzeros {Füllen von Nullen}
-message fillrandom {Füllen von zufälligen Daten}
-message fillcrypto {Füllen von Crypto-Daten}
+message fillzeros {Füllen mit Nullen}
+message fillrandom {Füllen mit zufälligen Daten}
 message raid0 {0 - Keine Parität, nur einfache Striping.}
 message raid1 {1 - Mirroring. Die Parität ist der Spiegel.}
 message raid4 {4 - Striping mit Parität auf die letzte Komponente gespeichert.}
@@ -45,15 +44,14 @@ message raid5 {5 - Striping mit Parität 
 message wannaunblock {Das Gerät ist gespert. Wollen Sie es zwangsweise entsperren und fortsetzen?}
 message wannatry {Wollen Sie probieren?}
 message create_cgd {Erstellen eines kryptographische Datenträgers (CGD)}
-message create_cnd {Erstellen eines virtuelle Disk-Images (VND)}
+message create_vnd {Erstellen eines virtuelle Disk-Images (VND)}
 message create_vg {Erstellen einer Volume-Gruppe (LVM VG)}
 message create_lv {Erstellen eines logischen Volumes}
 message create_raid {Erstellen eines Software-RAID}
 message updpmlist {Aktualisieren der Geräte-Liste}
 message savepm {Speichern der Änderungen}
 message pmblocked {GESPERRT}
-message pmunchanged {NICHTS}
-message pmsetboot {BOOTEN}
+message pmunchanged {UNVERÄNDERT}
 message pmused {BENUTZT}
 message pmmounted {(montiert)}
 message pmunused {(unbenutzt)}
Index: src/usr.sbin/sysinst/msg.pm.en
diff -u src/usr.sbin/sysinst/msg.pm.en:1.1 src/usr.sbin/sysinst/msg.pm.en:1.2
--- src/usr.sbin/sysinst/msg.pm.en:1.1	Wed Jun 12 06:20:18 2019
+++ src/usr.sbin/sysinst/msg.pm.en	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.pm.en,v 1.1 2019/06/12 06:20:18 martin Exp $	*/
+/*	$NetBSD: msg.pm.en,v 1.2 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -36,7 +36,6 @@
 
 message fillzeros {Fill with zeros}
 message fillrandom {Fill with random data}
-message fillcrypto {Fill with crypto data}
 message raid0 {0 - No parity, simple striping.}
 message raid1 {1 - Mirroring.  The parity is the mirror.}
 message raid4 {4 - Striping with parity stored on the last component.}
@@ -47,7 +46,7 @@ Device is blocked.  Editing it may cause
 Do you want to force unblock it and continue?}
 message wannatry {Do you want to try?}
 message create_cgd {Create cryptographic volume (CGD)}
-message create_cnd {Create virtual disk image (VND)}
+message create_vnd {Create virtual disk image (VND)}
 message create_vg {Create volume group (LVM VG)}
 message create_lv {Create logical volume}
 message create_raid {Create software RAID}
@@ -55,7 +54,6 @@ message updpmlist {Update device list}
 message savepm {Save changes}
 message pmblocked {BLOCKED}
 message pmunchanged {UNCHANGED}
-message pmsetboot {BOOT}
 message pmused {USED}
 message pmmounted {(mounted)}
 message pmunused {(unused)}
Index: src/usr.sbin/sysinst/msg.pm.es
diff -u src/usr.sbin/sysinst/msg.pm.es:1.1 src/usr.sbin/sysinst/msg.pm.es:1.2
--- src/usr.sbin/sysinst/msg.pm.es:1.1	Wed Jun 12 06:20:18 2019
+++ src/usr.sbin/sysinst/msg.pm.es	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.pm.es,v 1.1 2019/06/12 06:20:18 martin Exp $	*/
+/*	$NetBSD: msg.pm.es,v 1.2 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -36,7 +36,6 @@
 
 message fillzeros {Llenar con ceros}
 message fillrandom {Llene los datos al azar}
-message fillcrypto {Rellene los datos de cifrado}
 message raid0 {0 - Sin paridad, creación de bandas sólo es simple.}
 message raid1 {1 - Creación de reflejos. La paridad es el espejo.}
 message raid4 {4 - Striping con paridad almacenada en el último componente. component.}
@@ -45,7 +44,7 @@ message raid5 {5 - Striping con paridad 
 message wannaunblock {El dispositivo está bloqueado. ¿Quiere forzar a desbloquear y continuar? unblock it and continue?}
 message wannatry {¿Quieres probar?}
 message create_cgd {Crear cifrado de volumen (CGD)}
-message create_cnd {Crear imagen de disco virtual (VND)}
+message create_vnd {Crear imagen de disco virtual (VND)}
 message create_vg {Crear grupo de volúmenes (LVM VG)}
 message create_lv {Crear volúmenes lógicos}
 message create_raid {Crear RAID por software}
@@ -53,7 +52,6 @@ message updpmlist {Actualizar lista de d
 message savepm {Guardar los cambios}
 message pmblocked {BLOQUEADO}
 message pmunchanged {SIN USO}
-message pmsetboot {ARRANCAR}
 message pmused {UTILIZA}
 message pmmounted {(montado)}
 message pmunused {(sin usar)}
Index: src/usr.sbin/sysinst/msg.pm.fr
diff -u src/usr.sbin/sysinst/msg.pm.fr:1.1 src/usr.sbin/sysinst/msg.pm.fr:1.2
--- src/usr.sbin/sysinst/msg.pm.fr:1.1	Wed Jun 12 06:20:18 2019
+++ src/usr.sbin/sysinst/msg.pm.fr	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.pm.fr,v 1.1 2019/06/12 06:20:18 martin Exp $	*/
+/*	$NetBSD: msg.pm.fr,v 1.2 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -36,7 +36,6 @@
 
 message fillzeros {Remplir de zéros}
 message fillrandom {Remplissez par des données aléatoires}
-message fillcrypto {Remplissez par crypto données}
 message raid0 {0 - Pas de parité, l'entrelacement seulement simple.}
 message raid1 {1 - Mirroring. La parité est le miroir.}
 message raid4 {4 - Entrelacement avec parité stockées sur le dernier composant. component.}
@@ -45,7 +44,7 @@ message raid5 {5 - Entrelacement avec pa
 message wannaunblock {L'appareil est bloqué. Voulez-vous forcer le débloquer et continuer? unblock it and continue?}
 message wannatry {Voulez-vous essayer?}
 message create_cgd {Le volume cryptographique Créer (CGD)}
-message create_cnd {Créer une image de disque virtuel (VND)}
+message create_vnd {Créer une image de disque virtuel (VND)}
 message create_vg {Créer un groupe de volumes LVM (VG)}
 message create_lv {Créer un volume logique}
 message create_raid {Créer un RAID logiciel}
@@ -53,7 +52,6 @@ message updpmlist {Mettre à jour la list
 message savepm {Enregistrer les modifications}
 message pmblocked {BLOQUE}
 message pmunchanged {INCHANGÉ}
-message pmsetboot {BOOT}
 message pmused {UTILISÉ}
 message pmmounted {(monté)}
 message pmunused {(non utilisé)}
Index: src/usr.sbin/sysinst/msg.pm.pl
diff -u src/usr.sbin/sysinst/msg.pm.pl:1.1 src/usr.sbin/sysinst/msg.pm.pl:1.2
--- src/usr.sbin/sysinst/msg.pm.pl:1.1	Wed Jun 12 06:20:18 2019
+++ src/usr.sbin/sysinst/msg.pm.pl	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.pm.pl,v 1.1 2019/06/12 06:20:18 martin Exp $	*/
+/*	$NetBSD: msg.pm.pl,v 1.2 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -36,7 +36,6 @@
 
 message fillzeros {Wype³nij zerami}
 message fillrandom {Wype³nij losowymi danymi}
-message fillcrypto {Wype³nij przez crypto danych}
 message raid0 {0 - brak parzysto¶ci, tylko proste rozk³adanie.}
 message raid1 {1 - Mirroring. Parytet jest lustro.}
 message raid4 {4 - Malowanie z parytetu przechowywanych w ostatniej czê¶ci.}
@@ -45,7 +44,7 @@ message raid5 {5 - Malowanie z parytetu 
 message wannaunblock {Urz±dzenie jest zablokowane. Czy chcesz, aby zmusiæ go odblokowaæ i kontynuowaæ?}
 message wannatry {Czy chcesz spróbowaæ?}
 message create_cgd {Utwórz wolumen kryptograficznych (CGD)}
-message create_cnd {Utwórz wirtualnego obraz dysku (VND)}
+message create_vnd {Utwórz wirtualnego obraz dysku (VND)}
 message create_vg {Utwórz grupê woluminów (LVM VG)}
 message create_lv {Utwórz wolumin logiczny}
 message create_raid {Utwórz oprogramowania RAID}
@@ -53,7 +52,6 @@ message updpmlist {Aktualizuj listê urz±
 message savepm {Zapisz zmiany}
 message pmblocked {ZABLOK.}
 message pmunchanged {BEZ ZMIAN}
-message pmsetboot {BOOT}
 message pmused {U¯YWANE}
 message pmmounted {(zamontowany)}
 message pmunused {(nieu¿ywany)}

Index: src/usr.sbin/sysinst/partitions.h
diff -u src/usr.sbin/sysinst/partitions.h:1.12 src/usr.sbin/sysinst/partitions.h:1.13
--- src/usr.sbin/sysinst/partitions.h:1.12	Thu Dec 26 04:53:12 2019
+++ src/usr.sbin/sysinst/partitions.h	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: partitions.h,v 1.12 2019/12/26 04:53:12 msaitoh Exp $	*/
+/*	$NetBSD: partitions.h,v 1.13 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -225,6 +225,12 @@ struct disk_partitioning_scheme {
 	const struct part_type_desc * (*get_fs_part_type)(
 	    enum part_type, unsigned, unsigned);
 	/*
+	 * Optional: inverse to above: given a part_type_desc, set default
+	 * fstype and subtype.
+	 */
+	bool (*get_default_fstype)(const struct part_type_desc *,
+	    unsigned *fstype, unsigned *fs_sub_type);
+	/*
 	 * Create a custom partition type. If the type already exists
 	 * (or there is a collision), the old existing type will be
 	 * returned and no new type created. This is not considered
@@ -322,10 +328,14 @@ struct disk_partitioning_scheme {
 	 * If with_path is true (and the returned value is a device
 	 * node), include the /dev/ prefix in the result string
 	 * (this is ignored when returning NAME= syntax for /etc/fstab).
+	 * If life is true, the device must be made available under
+	 * that name (only makes a difference for NAME=syntax if
+	 * no wedge has been created yet,) - implied for all variants
+	 * where dev_name_usage != logical_name.
 	 */
 	bool (*get_part_device)(const struct disk_partitions*,
 	    part_id, char *devname, size_t max_devname_len, int *part,
-	    enum dev_name_usage, bool with_path);
+	    enum dev_name_usage, bool with_path, bool life);
 
 	/*
 	 * How big could we resize the given position (start of existing
@@ -433,7 +443,7 @@ struct disk_partitioning_scheme {
 	 */
 	struct disk_partitions * (*create_new_for_disk)(const char *,
 	    daddr_t start, daddr_t len, daddr_t disk_total_size,
-	    bool is_boot_drive);
+	    bool is_boot_drive, struct disk_partitions *parent);
 
 	/*
 	 * Optional: this scheme may be used to boot from the given disk

Index: src/usr.sbin/sysinst/partman.c
diff -u src/usr.sbin/sysinst/partman.c:1.45 src/usr.sbin/sysinst/partman.c:1.46
--- src/usr.sbin/sysinst/partman.c:1.45	Fri Dec 13 22:12:41 2019
+++ src/usr.sbin/sysinst/partman.c	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: partman.c,v 1.45 2019/12/13 22:12:41 martin Exp $ */
+/*	$NetBSD: partman.c,v 1.46 2020/01/09 13:22:30 martin Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -63,6 +63,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <libgen.h>
+#include <paths.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -129,6 +130,13 @@ struct cgd_desc *cgds;
 #define MAX_LVM_VG 16
 #define MAX_LVM_PV 255
 #define MAX_LVM_LV 255
+
+struct lvm_pv_reg {
+	struct pm_devs *pm;
+	daddr_t start;
+};
+struct lvm_pv_reg lvm_pvs[MAX_LVM_PV];	/* XXX - make dynamic */
+
 typedef struct pv_t {
 	struct pm_devs *pm;
 	char pm_name[SSTRSIZE];
@@ -192,9 +200,10 @@ struct {
     const char *mnt_opts, *on;
 } *mnts;
 
-int cursel; /* Number of selected entry in main menu */
-int changed; /* flag indicating that we have unsaved changes */
-int raid_curspare; /* XXX: replace by true way */
+static int pm_cursel; /* Number of selected entry in main menu */
+static int pm_changed; /* flag indicating that we have unsaved changes */
+static int pm_raid_curspare; /* XXX: replace by true way */
+static int pm_retvalue;
 
 enum { /* RAIDframe menu enum */
 	PMR_MENU_DEVS, PMR_MENU_DEVSSPARE, PMR_MENU_RAIDLEVEL, PMR_MENU_NUMROW,
@@ -251,7 +260,7 @@ pm_edit_size_value(msg prompt_msg, daddr
 	new_size_val = parse_disk_pos(answer, &mult, cylsec, NULL);
 
 	if (new_size_val > 0)
-		*size = new_size_val;
+		*size = new_size_val * mult;
 }
 
 static const char *
@@ -341,7 +350,9 @@ pm_dev_list(int type)
 	struct part_entry disk_entries[MAX_DISKS*MAXPARTITIONS];
 	struct pm_devs *pm_i;
 
-	SLIST_FOREACH(pm_i, &pm_head, l)
+	SLIST_FOREACH(pm_i, &pm_head, l) {
+		if (pm_i->parts == NULL)
+			continue;
 		for (i = 0; i < pm_i->parts->num_part; i++) {
 			ok = false;
 			if (!pm_i->parts->pscheme->get_part_info(pm_i->parts,
@@ -360,8 +371,8 @@ pm_dev_list(int type)
 						ok = 1;
 					break;
 				case PM_LVM:
-// XXX					if (pm_i->bsdlabel[i].lvmpv)
-//						ok = 1;
+					if (pm_is_lvmpv(pm_i, i, &info))
+						ok = 1;
 					break;
 			}
 			if (!ok)
@@ -376,7 +387,7 @@ pm_dev_list(int type)
 			pm_i->parts->pscheme->get_part_device(
 			    pm_i->parts, i, disk_entries[num_devs].fullname,
 			    sizeof disk_entries[num_devs].fullname,
-			    NULL, plain_name, false);
+			    NULL, plain_name, false, true);
 
 			menu_entries[num_devs] = (struct menu_ent) {
 				.opt_name = disk_entries[num_devs].fullname,					
@@ -385,20 +396,21 @@ pm_dev_list(int type)
 			};
 			num_devs++;
 		}
+	}
 
 	menu_no = new_menu(MSG_avdisks,
 		menu_entries, num_devs, -1, -1,
 		(num_devs+1<3)?3:num_devs+1, 13,
 		MC_SCROLL | MC_NOCLEAR, NULL, NULL, NULL, NULL, MSG_cancel);
 	if (menu_no == -1)
-		return (struct part_entry) { .retvalue = -1, };
+		return (struct part_entry) { };
 	process_menu(menu_no, &dev_num);
 	free_menu(menu_no);
 
 	if (dev_num < 0 || dev_num >= num_devs)
-		return (struct part_entry) { .retvalue = -1, };
+		return (struct part_entry) { };
 
-	disk_entries[dev_num].retvalue = dev_num;
+	pm_retvalue = dev_num;
 	return disk_entries[dev_num];
 }
 
@@ -414,11 +426,16 @@ pm_manage_getfreenode(void *node, const 
 	for (i = 0; i < s->max; i++) {
 		ok = 1;
 		/* Check that node is not already reserved */
-		for (ii = 0; ii < s->max; ii++)
-			if (*(int*)((char*)s->entry_node + s->entry_size * ii) == i) {
+		for (ii = 0; ii < s->max; ii++) {
+			if (*(int*)((char*)s->entry_enabled + s->entry_size
+			    * ii) == 0)
+				continue;
+			if (*(int*)((char*)s->entry_node + s->entry_size * ii)
+			    == i) {
 				ok = 0;
 				break;
 			}
+		}
 		if (! ok)
 			continue;
 		/* Check that node is not in the device list */
@@ -511,7 +528,7 @@ pm_raid_edit_menufmt(menudesc *m, int op
 		case PMR_MENU_DEVS:
 			strlcpy(buf, msg_string(MSG_raid_disks_fmt),
 			    sizeof buf);
-			strlcpy(buf, ": ", sizeof buf);
+			strlcat(buf, ": ", sizeof buf);
 			for (i = 0; i < MAX_IN_RAID; i++) {
 				if (dev_ptr->comp[i].parts == NULL ||
 				     dev_ptr->comp[i].is_spare)
@@ -524,7 +541,7 @@ pm_raid_edit_menufmt(menudesc *m, int op
 		case PMR_MENU_DEVSSPARE:
 			strlcpy(buf, msg_string(MSG_raid_spares_fmt),
 			    sizeof buf);
-			strlcpy(buf, ": ", sizeof buf);
+			strlcat(buf, ": ", sizeof buf);
 			for (i = 0; i < MAX_IN_RAID; i++) {
 				if (dev_ptr->comp[i].parts == NULL ||
 				     !dev_ptr->comp[i].is_spare)
@@ -595,11 +612,11 @@ pm_raid_set_value(menudesc *m, void *arg
 	
 	switch (m->cursel) {
 		case PMR_MENU_DEVS:
-			raid_curspare = 0;
+			pm_raid_curspare = 0;
 			process_menu(menu_disk_adddel, dev_ptr);
 			return 0;
 		case PMR_MENU_DEVSSPARE:
-			raid_curspare = 1;
+			pm_raid_curspare = 1;
 			process_menu(menu_disk_adddel, dev_ptr);
 			return 0;
 		case PMR_MENU_RAIDLEVEL:
@@ -718,17 +735,17 @@ pm_raid_disk_add(menudesc *m, void *arg)
 	int i;
 	struct raid_desc *dev_ptr = arg;
 	struct part_entry disk_entrie = pm_dev_list(PM_RAID);
-	if (disk_entrie.retvalue < 0)
-		return disk_entrie.retvalue;
+	if (pm_retvalue < 0)
+		return pm_retvalue;
 
 	for (i = 0; i < MAX_IN_RAID; i++)
 		if (dev_ptr->comp[i].parts == NULL) {
 			dev_ptr->comp[i].parts = disk_entrie.parts;
 			dev_ptr->comp[i].id = disk_entrie.id;
-			dev_ptr->comp[i].is_spare = raid_curspare;
+			dev_ptr->comp[i].is_spare = pm_raid_curspare;
 			strlcpy(dev_ptr->comp[i].name, disk_entrie.fullname,
 			    sizeof dev_ptr->comp[i].name);
-			if (raid_curspare)
+			if (pm_raid_curspare)
 				dev_ptr->numSpare++;
 			else
 				dev_ptr->numCol++;
@@ -750,7 +767,7 @@ pm_raid_disk_del(menudesc *m, void *arg)
 
 	for (i = 0; i < MAX_IN_RAID; i++) {
 		if (dev_ptr->comp[i].parts == NULL ||
-			dev_ptr->comp[i].is_spare != raid_curspare)
+			dev_ptr->comp[i].is_spare != pm_raid_curspare)
 			continue;
 		menu_entries[num_devs] = (struct menu_ent) {
 			.opt_name = dev_ptr->comp[i].name,
@@ -791,7 +808,7 @@ pm_raid_commit(void)
 {
 	int i, ii;
 	FILE *f;
-	char f_name[STRSIZE];
+	char f_name[STRSIZE], devname[STRSIZE];
 
 	for (i = 0; i < MAX_RAID; i++) {
 		if (! pm_raid_check(&raids[i]))
@@ -814,20 +831,58 @@ pm_raid_commit(void)
 		    raids[i].numRow, raids[i].numCol, raids[i].numSpare);
 
 		scripting_fprintf(f, "\nSTART disks\n");
-		for (ii = 0; ii < MAX_IN_RAID; ii++)
+		for (ii = 0; ii < MAX_IN_RAID; ii++) {
 			if (raids[i].comp[ii].parts != NULL &&
 			    !raids[i].comp[ii].is_spare) {
-				scripting_fprintf(f,  "/dev/%s\n",
-				    raids[i].comp[ii].name);
+				strcpy(devname, raids[i].comp[ii].name);
+				if (raids[i].comp[ii].parts != NULL &&
+				    raids[i].comp[ii].id != NO_PART) {
+					/* wedge may have moved */
+					raids[i].comp[ii].parts->pscheme->
+					    get_part_device(
+					    raids[i].comp[ii].parts,
+					    raids[i].comp[ii].id,
+					    devname, sizeof devname, NULL,
+					    logical_name, true, true);
+					raids[i].comp[ii].parts->pscheme->
+					    get_part_device(
+					    raids[i].comp[ii].parts,
+					    raids[i].comp[ii].id,
+					    raids[i].comp[ii].name,
+					    sizeof raids[i].comp[ii].name,
+					    NULL, plain_name, true, true);
+				}
+				scripting_fprintf(f,  "%s\n", devname);
 			}
+		}
 
 		scripting_fprintf(f, "\nSTART spare\n");
-		for (ii = 0; ii < MAX_IN_RAID; ii++)
+		for (ii = 0; ii < MAX_IN_RAID; ii++) {
 			if (raids[i].comp[ii].parts != NULL &&
 			    raids[i].comp[ii].is_spare) {
-				scripting_fprintf(f,  "/dev/%s\n",
-				    raids[i].comp[ii].name);
+				strcpy(devname, raids[i].comp[ii].name);
+				if (raids[i].comp[ii].parts != NULL &&
+				    raids[i].comp[ii].id != NO_PART) {
+					/* wedge may have moved */
+					raids[i].comp[ii].parts->pscheme->
+					    get_part_device(
+					    raids[i].comp[ii].parts,
+					    raids[i].comp[ii].id,
+					    devname, sizeof devname, NULL,
+					    logical_name, true, true);
+					raids[i].comp[ii].parts->pscheme->
+					    get_part_device(
+					    raids[i].comp[ii].parts,
+					    raids[i].comp[ii].id,
+					    raids[i].comp[ii].name,
+					    sizeof raids[i].comp[ii].name,
+					    NULL, plain_name, true, true);
+				}
+
+				scripting_fprintf(f,  "%s\n",
+				    devname);
 			}
+		}
 
 		scripting_fprintf(f, "\nSTART layout\n%d %d %d %d\n",
 		    raids[i].sectPerSU,	raids[i].SUsPerParityUnit,
@@ -926,7 +981,7 @@ pm_vnd_edit_menufmt(menudesc *m, int opt
 		case PMV_MENU_SIZE:
 			if (!dev_ptr->is_exist)
 				snprintf(buf, SSTRSIZE, "%" PRIu64,
-				    dev_ptr->size);
+				    dev_ptr->size / sizemult);
 			wprintw(m->mw, "%*s %s", -lcol_width,
 			    msg_string(MSG_vnd_size_fmt), buf);
 			break;
@@ -1318,7 +1373,7 @@ pm_cgd_init(void *arg1, void *arg2)
 		disk_entrie->parts->pscheme->get_part_device(
 		    disk_entrie->parts,  disk_entrie->id,
 		    disk_entrie->fullname, sizeof(disk_entrie->fullname),
-		    NULL, logical_name, false);
+		    NULL, logical_name, false, true);
 		pm_cgd_disk_set(dev_ptr, disk_entrie);
 	}
 }
@@ -1351,7 +1406,7 @@ pm_cgd_disk_set(struct cgd_desc *dev_ptr
 		if (disk_entrie == NULL)
 			return -2;
 		*disk_entrie = pm_dev_list(PM_CGD);
-		if (disk_entrie->retvalue < 0) {
+		if (pm_retvalue < 0) {
 			free(disk_entrie);
 			return -1;
 		}
@@ -1366,32 +1421,58 @@ pm_cgd_disk_set(struct cgd_desc *dev_ptr
 }
 
 int
-pm_cgd_edit(void *dev_ptr, struct part_entry *disk_entrie)
+pm_cgd_edit_new(struct pm_devs *mypm, part_id id)
 {
-	if (disk_entrie != NULL)
-		dev_ptr = NULL;
+	struct part_entry pe = { .id = id, .parts = mypm->parts,
+	    .dev_ptr = mypm, .type = PM_CGD };
+	
 	return pm_edit(PMC_MENU_END, pm_cgd_edit_menufmt,
 		pm_cgd_set_value, pm_cgd_check, pm_cgd_init,
-		disk_entrie, dev_ptr, 0, &cgds_t_info);
+		&pe, NULL, 0, &cgds_t_info);
+}
+
+int
+pm_cgd_edit_old(struct part_entry *pe)
+{
+	return pm_edit(PMC_MENU_END, pm_cgd_edit_menufmt,
+		pm_cgd_set_value, pm_cgd_check, pm_cgd_init,
+		pe->dev_ptr != NULL ? pe : NULL,
+		pe->dev_ptr, 0, &cgds_t_info);
 }
 
 static int
 pm_cgd_commit(void)
 {
+	char devname[STRSIZE];
 	int i, error = 0;
+
 	for (i = 0; i < MAX_CGD; i++) {
 		if (! pm_cgd_check(&cgds[i]))
 			continue;
 		if (run_program(RUN_DISPLAY | RUN_PROGRESS,
-			"cgdconfig -g -i %s -k %s -o /tmp/cgd.%d.conf %s %d",
+			"cgdconfig -g -V %s -i %s -k %s -o /tmp/cgd.%d.conf"
+			" %s %d", cgds[i].verify_type,
 			cgds[i].iv_type, cgds[i].keygen_type, cgds[i].node,
 			cgds[i].enc_type, cgds[i].key_size) != 0) {
 			error++;
 			continue;
 		}
+		if (cgds[i].pm != NULL && cgds[i].pm->parts != NULL) {
+			/* wedge device names may have changed */
+			cgds[i].pm->parts->pscheme->get_part_device(
+			    cgds[i].pm->parts, cgds[i].pm_part,
+			    devname, sizeof devname, NULL,
+			    logical_name, true, true);
+			cgds[i].pm->parts->pscheme->get_part_device(
+			    cgds[i].pm->parts, cgds[i].pm_part,
+			    cgds[i].pm_name, sizeof cgds[i].pm_name, NULL,
+			    plain_name, false, true);
+		} else {
+			continue;
+		}
 		if (run_program(RUN_DISPLAY | RUN_PROGRESS,
-			"cgdconfig -V re-enter cgd%d /dev/%s /tmp/cgd.%d.conf",
-			cgds[i].node, cgds[i].pm_name, cgds[i].node) != 0) {
+			"cgdconfig -V re-enter cgd%d '%s' /tmp/cgd.%d.conf",
+			cgds[i].node, devname, cgds[i].node) != 0) {
 			error++;
 			continue;
 		}
@@ -1458,10 +1539,10 @@ pm_lvm_disk_add(menudesc *m, void *arg)
 	int i;
 	lvms_t *dev_ptr = arg;
 	struct part_entry disk_entrie = pm_dev_list(PM_LVM);
-	if (disk_entrie.retvalue < 0)
-		return disk_entrie.retvalue;
+	if (pm_retvalue < 0)
+		return pm_retvalue;
 
-	for (i = 0; i < MAX_LVM_PV; i++)
+	for (i = 0; i < MAX_LVM_PV; i++) {
 		if (dev_ptr->pv[i].pm == NULL) {
 			dev_ptr->pv[i].pm = disk_entrie.dev_ptr;
 			dev_ptr->pv[i].pm_part = disk_entrie.id;
@@ -1469,6 +1550,8 @@ pm_lvm_disk_add(menudesc *m, void *arg)
 			    sizeof(dev_ptr->pv[i].pm_name));
 			break;
 		}
+	}
+	pm_retvalue = 1;
 	return 0;
 }
 
@@ -2023,7 +2106,7 @@ int
 pm_getrefdev(struct pm_devs *pm_cur)
 {
 	int i, ii, dev_num, num_devs, num_devs_s;
-	char descr[SSTRSIZE], dev[SSTRSIZE] = "";
+	char descr[MENUSTRSIZE], dev[MENUSTRSIZE] = "";
 
 	pm_cur->refdev = NULL;
 	if (! strncmp(pm_cur->diskdev, "cgd", 3)) {
@@ -2045,7 +2128,8 @@ pm_getrefdev(struct pm_devs *pm_cur)
 				pm_cur->refdev = &vnds[i];
 				vnds[i].pm->parts->pscheme->get_part_device(
 				    vnds[i].pm->parts, vnds[i].pm_part,
-				    dev, sizeof dev, NULL, plain_name, false);
+				    dev, sizeof dev, NULL, plain_name, false,
+				    true);
 				snprintf(descr, sizeof descr, " (%s, %s)",
 				    dev, vnds[i].filepath);
 				strlcat(pm_cur->diskdev_descr, descr,
@@ -2078,6 +2162,42 @@ pm_getrefdev(struct pm_devs *pm_cur)
 	return 0;
 }
 
+/*
+ * Enable/disable items in the extended partition disk/partition action
+ * menu
+ */
+void
+pmdiskentry_enable(menudesc *menu, struct part_entry *pe)
+{
+	int i;
+	menu_ent *m;
+	bool enable;
+
+	for (i = 0; i < menu->numopts; i++) {
+		m = &menu->opts[i];
+
+		enable = false;
+		if (m->opt_name == MSG_unconfig) {
+			if (pe->type == PM_DISK)
+				enable = ((struct pm_devs *)pe->dev_ptr)
+				    ->refdev != NULL;
+		} else if (m->opt_name == MSG_undo) {
+			if (pe->type != PM_DISK)
+				continue;
+			enable = ((struct pm_devs *)pe->dev_ptr)->unsaved;
+		} else if (m->opt_name == MSG_switch_parts) {
+			enable = pm_from_pe(pe)->parts != NULL;
+		} else {
+			continue;
+		}
+
+		if (enable)
+			m->opt_flags &= ~OPT_IGNORE;
+		else
+			m->opt_flags |= OPT_IGNORE;
+	}
+}
+
 /* Detect that partition is in use */
 int
 pm_partusage(struct pm_devs *pm_cur, int part_num, int do_del)
@@ -2086,6 +2206,9 @@ pm_partusage(struct pm_devs *pm_cur, int
 	struct disk_part_info info;
 	part_id id;
 
+	if (pm_cur->parts == NULL)
+		return -1;	/* nothing can be in use */
+
 	if (part_num < 0) {
 		/* Check all partitions on device */
 		for (id = 0; id < pm_cur->parts->num_part; id++) {
@@ -2184,6 +2307,52 @@ pm_destroy_all(void)
 }
 
 void
+pm_set_lvmpv(struct pm_devs *my_pm, part_id pno, bool add)
+{
+	size_t i;
+	struct disk_part_info info;
+
+	if (!my_pm->parts->pscheme->get_part_info(my_pm->parts, pno, &info))
+		return;
+
+	if (add) {
+		for (i = 0; i < __arraycount(lvm_pvs); i++)
+			if (lvm_pvs[i].pm == NULL && lvm_pvs[i].start == 0)
+				break;
+		if (i >= __arraycount(lvm_pvs))
+			return;
+		lvm_pvs[i].pm = my_pm;
+		lvm_pvs[i].start = info.start;
+		return;
+	} else {
+		for (i = 0; i < __arraycount(lvm_pvs); i++)
+			if (lvm_pvs[i].pm == my_pm &&
+			    lvm_pvs[i].start == info.start)
+				break;
+		if (i >= __arraycount(lvm_pvs))
+			return;
+		lvm_pvs[i].pm = NULL;
+		lvm_pvs[i].start = 0;
+	}
+}
+
+bool
+pm_is_lvmpv(struct pm_devs *my_pm, part_id id,
+    const struct disk_part_info *info)
+{
+	size_t i;
+
+	for (i = 0; i < __arraycount(lvm_pvs); i++) {
+		if (lvm_pvs[i].pm != my_pm)
+			continue;
+		if (lvm_pvs[i].start == info->start)
+			return true;
+	}
+
+	return false;
+}
+
+void
 pm_setfstype(struct pm_devs *pm_cur, part_id id, int fstype, int fs_subtype)
 {
 	struct disk_part_info info;
@@ -2224,12 +2393,13 @@ pm_rename(struct pm_devs *pm_cur)
 int
 pm_editpart(int part_num)
 {
-//XXX	partinfo backup = pm->bsdlabel[part_num];
+	struct partition_usage_set pset = {};
 
-	edit_ptn(&(struct menudesc){.cursel = part_num}, NULL);
+	usage_set_from_parts(&pset, pm->parts);
+	edit_ptn(&(struct menudesc){.cursel = part_num}, &pset);
+	free_usage_set(&pset);
 	if (checkoverlap(pm->parts)) {
 		hit_enter_to_continue(MSG_cantsave, NULL);
-//XXX		pm->bsdlabel[part_num] = backup;
 		return -1;
 	}
 	pm->unsaved = 1;
@@ -2237,48 +2407,40 @@ pm_editpart(int part_num)
 }
 
 /* Safe erase of disk */
-int
-pm_shred(struct pm_devs *pm_cur, int part, int shredtype)
+void
+pm_shred(struct part_entry *pe, int shredtype)
 {
-	int error = -1;
+	const char *srcdev;
 	char dev[SSTRSIZE];
-	part_id id;
+	struct pm_devs *my_pm;
 
-	if (part < 0)
-		return -1;
+	my_pm = pe->dev_ptr;
+	if (pe->type == PM_DISK) {
+		snprintf(dev, sizeof dev,
+		    _PATH_DEV "r%s%c", my_pm->diskdev, 'a' + RAW_PART);
+		if (pe->parts != NULL) {
+			pe->parts->pscheme->free(pe->parts);
+			pe->parts = NULL;
+			my_pm->parts = NULL;
+		}
+	} else if (pe->type == PM_PART) {
+		pe->parts->pscheme->get_part_device(pe->parts, pe->id,
+		    dev, sizeof dev, NULL, raw_dev_name, true, true);
+	}
 
-	id = part;
-	pm_cur->parts->pscheme->get_part_device(pm_cur->parts, id, dev,
-	    sizeof dev, NULL, plain_name, false);
-	switch(shredtype) {
+	switch (shredtype) {
 		case SHRED_ZEROS:
-			error += run_program(RUN_DISPLAY | RUN_PROGRESS,
-				"dd of=/dev/%s if=/dev/zero bs=1m progress=100 msgfmt=human",
-				dev);
+			srcdev = _PATH_DEVZERO;
 			break;
 		case SHRED_RANDOM:
-			error += run_program(RUN_DISPLAY | RUN_PROGRESS,
-				"dd of=/dev/%s if=/dev/urandom bs=1m progress=100 msgfmt=human",
-				dev);
-			break;
-		case SHRED_CRYPTO:
-			error += run_program(RUN_DISPLAY | RUN_PROGRESS,
-				"sh -c 'cgdconfig -s cgd0 /dev/%s aes-cbc 128 < /dev/urandom'",
-				dev); /* XXX: cgd0?! */
-			if (! error) {
-				error += run_program(RUN_DISPLAY | RUN_PROGRESS,
-					"dd of=/dev/rcgd0d if=/dev/urandom bs=1m progress=100 msgfmt=human");
-				error += run_program(RUN_DISPLAY | RUN_PROGRESS,
-					"cgdconfig -u cgd0");
-			}
+			srcdev = _PATH_URANDOM;
 			break;
 		default:
-			return -1;
+			return;
 	}
-	pm_partusage(pm_cur, -1, 1);
-//XXX	memset(&pm_cur->oldlabel, 0, sizeof pm_cur->oldlabel);
-//XXX	memset(&pm_cur->bsdlabel, 0, sizeof pm_cur->bsdlabel);
-	return error;
+	run_program(RUN_DISPLAY | RUN_PROGRESS,
+	    "progress -f %s -b 1m dd bs=1m of=%s", srcdev, dev);
+	pm_partusage(my_pm, -1, 1);
 }
 
 #if 0 // XXX
@@ -2289,11 +2451,11 @@ pm_mountall_sort(const void *a, const vo
 }
 #endif
 
+#if 0	// XXX
 /* Mount all available partitions */
 static int
 pm_mountall(void)
 {
-#if 0	// XXX
 	int num_devs = 0;
 	int mnts_order[MAX_MNTS];
 	int i, ii, error, ok;
@@ -2321,8 +2483,6 @@ pm_mountall(void)
 			}
 			mnts[num_devs].on = pm_i->bsdlabel[i].pi_mount;
 			if (strcmp(pm_i->bsdlabel[i].pi_mount, "/") == 0) {
-				if (pm_i->no_part)
-					pm_i->bootable = 1;
 				/* Use disk with / as a default if the user has 
 				the sets on a local disk */
 				strlcpy(localfs_dev, pm_i->diskdev, SSTRSIZE);
@@ -2348,9 +2508,9 @@ pm_mountall(void)
 		if (error)
 			return error;
 	}
-#endif
 	return 0;
 }
+#endif
 
 /* Mount partition bypassing ordinary order */
 static int
@@ -2395,7 +2555,7 @@ pm_umount(struct pm_devs *pm_cur, int pa
 	id = (part_id)part_num;
 
 	pm_cur->parts->pscheme->get_part_device(pm_cur->parts, id, buf,
-	    sizeof buf, NULL, plain_name, false);
+	    sizeof buf, NULL, plain_name, false, true);
 
 	if (run_program(RUN_DISPLAY | RUN_PROGRESS,
 			"umount -f /dev/%s", buf) == 0) {
@@ -2457,6 +2617,7 @@ pm_unconfigure(struct pm_devs *pm_cur)
 }
 
 /* Last checks before leaving partition manager */
+#if 0
 static int
 pm_lastcheck(void)
 {
@@ -2466,6 +2627,7 @@ pm_lastcheck(void)
 	fclose(file_tmp);
 	return 0;
 }
+#endif
 
 /* Are there unsaved changes? */
 static int
@@ -2475,7 +2637,7 @@ pm_needsave(void)
 	SLIST_FOREACH(pm_i, &pm_head, l)
 		if (pm_i->unsaved) {
 			/* Oops, we have unsaved changes */
-			changed = 1;
+			pm_changed = 1;
 			msg_display(MSG_saveprompt);
 			return ask_yesno(NULL);
 		}
@@ -2488,40 +2650,21 @@ pm_commit(menudesc *m, void *arg)
 {
 	int retcode;
 	struct pm_devs *pm_i;
-	struct install_partition_desc install;
-
-	if (m != NULL && arg != NULL)
-		((struct part_entry *)arg)[0].retvalue = m->cursel + 1;
 
+	pm_retvalue = -1;
 	SLIST_FOREACH(pm_i, &pm_head, l) {
 		if (! pm_i->unsaved)
 			continue;
-		pm_select(pm_i);
-		install_desc_from_parts(&install, pm_i->parts);
-
-		if (pm_i->no_part) {
-			if (make_filesystems(&install) != 0) {
-				if (logfp)
-					fprintf(logfp, "Special disk %s preparing error\n", pm_i->diskdev);
-				goto next;
-			}
-			pm_i->unsaved = 0;
-		} else if (pm_i->parts != NULL) {
-			
-			if (!pm_i->parts->pscheme->write_to_disk(pm_i->parts) ||
-			    set_swap_if_low_ram(NULL) != 0 || 
-				md_post_disklabel(&install, pm_i->parts) != 0 || /* Enable swap and check badblock */
-				make_filesystems(&install) != 0     /* Create filesystems with newfs */
-			) {
-				/* Oops, something failed... */
-				if (logfp)
-					fprintf(logfp, "Disk %s preparing error\n", pm_i->diskdev);
-				goto next;
-			}
-			pm_i->unsaved = 0;
+		if (pm_i->parts == NULL) {
+			pm_i->unsaved = false;
+			continue;
+		}
+		if (!pm_i->parts->pscheme->write_to_disk(pm_i->parts)) {
+			if (logfp)
+				fprintf(logfp, "partitining error %s\n",
+				    pm_i->diskdev);
+			return -1;
 		}
-next:
-		free_install_desc(&install);
 	}
 
 	/* Call all functions that may create new devices */
@@ -2549,13 +2692,15 @@ next:
 		pm_upddevlist(m, arg);
 	if (logfp)
 		fflush (logfp);
-    return 0;
+
+	pm_retvalue = 0;
+	return 0;
 }
 
+#if 0 // XXX
 static int
 pm_savebootsector(void)
 {
-#if 0 // XXX
 	struct pm_devs *pm_i;
 	SLIST_FOREACH(pm_i, &pm_head, l)
 		if (pm_i->bootable) {
@@ -2591,27 +2736,29 @@ pm_savebootsector(void)
 				}
 			}
 		}
-#endif
 	return 0;
 }
+#endif
 
 /* Function for 'Enter'-menu */
 static int
 pm_submenu(menudesc *m, void *arg)
 {
-	int part_num = -1;
 	struct pm_devs *pm_cur = NULL;
-	((struct part_entry *)arg)[0].retvalue = m->cursel + 1;
+	pm_retvalue = m->cursel + 1;
+	struct part_entry *cur_pe = (struct part_entry *)arg + m->cursel;
 
-	switch (((struct part_entry *)arg)[m->cursel].type) {
+	switch (cur_pe->type) {
 		case PM_DISK:
 		case PM_PART:
 		case PM_SPEC:
-			if (((struct part_entry *)arg)[m->cursel].dev_ptr != NULL) {
-				pm_cur = ((struct part_entry *)arg)[m->cursel].dev_ptr;
+			if (cur_pe->dev_ptr != NULL) {
+				pm_cur = cur_pe->dev_ptr;
 				if (pm_cur == NULL) 
 					return -1;
 				if (pm_cur->blocked) {
+					clear();
+					refresh();
 					msg_display(MSG_wannaunblock);
 					if (!ask_noyes(NULL))
 						return -2;
@@ -2623,79 +2770,37 @@ pm_submenu(menudesc *m, void *arg)
 			break;
 	}
 
-	switch (((struct part_entry *)arg)[m->cursel].type) {
+	switch (cur_pe->type) {
 		case PM_DISK:
-			if (pm_cur != NULL
-			    && pm_cur->parts == NULL) {
-
-#ifndef NO_DISKLABEL
-				struct install_partition_desc install = { 0 };
-#endif
-				const struct disk_partitioning_scheme *ps =
-				    select_part_scheme(pm_cur, NULL, false,
-				        NULL);
-				if (!ps)
-					return 0;
-
-				struct disk_partitions *parts =
-				   (*ps->create_new_for_disk)(pm_cur->diskdev,
-				   0, pm_cur->dlsize, pm_cur->dlsize, false);
-				if (!parts)
-					return 0;
-
-				pm_cur->parts = parts;
-				if (pm->dlsize > ps->size_limit)
-					pm->dlsize = ps->size_limit;
-
-				if (pm_cur->parts == NULL)
-					break;
-				wclear(stdscr);
-				wrefresh(stdscr);
-#ifndef NO_DISKLABEL
-				install_desc_from_parts(&install, pm->parts);
-				make_bsd_partitions(&install);
-				free_install_desc(&install);
-#endif
-			}
-			// XXX
-//			if (pm_cur != NULL
-//			    && pm_cur->label_type == PM_LABEL_GPT) {
-//				process_menu(MENU_pmgptentry, &part_num);
-//				pm_wedges_fill(pm_cur);
-//			} else {
-				process_menu(MENU_pmdiskentry, &part_num);
-//			}
+			process_menu(MENU_pmdiskentry, cur_pe);
 			break;
 		case PM_PART:
-			part_num = ((struct part_entry *)arg)[m->cursel].id;
-			process_menu(MENU_pmpartentry, &part_num);
-//			if (pm_cur != NULL && pm_cur->label_type == PM_LABEL_GPT)
-//				pm_wedges_fill(pm_cur);
+			process_menu(MENU_pmpartentry, cur_pe);
 			break;
 		case PM_SPEC:
-			part_num = 0;
-			process_menu(MENU_pmpartentry, &part_num);
+			process_menu(MENU_pmpartentry, cur_pe);
 			break;
 		case PM_RAID:
-			return pm_edit(PMR_MENU_END, pm_raid_edit_menufmt,
-				pm_raid_set_value, pm_raid_check, pm_raid_init,
-				NULL, ((struct part_entry *)arg)[m->cursel].dev_ptr, 0, &raids_t_info);
+			pm_edit(PMR_MENU_END, pm_raid_edit_menufmt,
+			    pm_raid_set_value, pm_raid_check, pm_raid_init,
+			    NULL, cur_pe->dev_ptr, 0, &raids_t_info);
+			break;
 		case PM_VND:
 			return pm_edit(PMV_MENU_END, pm_vnd_edit_menufmt,
-				pm_vnd_set_value, pm_vnd_check, pm_vnd_init,
-				NULL, ((struct part_entry *)arg)[m->cursel].dev_ptr, 0, &vnds_t_info);
+			    pm_vnd_set_value, pm_vnd_check, pm_vnd_init,
+			    NULL, cur_pe->dev_ptr, 0, &vnds_t_info);
 		case PM_CGD:
-			return pm_cgd_edit(((struct part_entry *)arg)[m->cursel].dev_ptr,
-				NULL);
+			pm_cgd_edit_old(cur_pe);
+			break;
 		case PM_LVM:
 			return pm_edit(PML_MENU_END, pm_lvm_edit_menufmt,
-				pm_lvm_set_value, pm_lvm_check, pm_lvm_init,
-				NULL, ((struct part_entry *)arg)[m->cursel].dev_ptr, 0, &lvms_t_info);
+			    pm_lvm_set_value, pm_lvm_check, pm_lvm_init,
+			    NULL, cur_pe->dev_ptr, 0, &lvms_t_info);
 		case PM_LVMLV:
 			return pm_edit(PMLV_MENU_END, pm_lvmlv_edit_menufmt,
-				pm_lvmlv_set_value, pm_lvmlv_check, pm_lvmlv_init,
-				NULL, ((struct part_entry *)arg)[m->cursel].dev_ptr,
-				((struct part_entry *)arg)[m->cursel].dev_ptr_delta, &lv_t_info);
+			    pm_lvmlv_set_value, pm_lvmlv_check, pm_lvmlv_init,
+			    NULL, cur_pe->dev_ptr,
+			    cur_pe->dev_ptr_delta, &lv_t_info);
 	}
 	return 0;
 }
@@ -2718,11 +2823,9 @@ pm_menufmt(menudesc *m, int opt, void *a
 				dev_status = msg_string(MSG_pmblocked);
 			else if (! pm_cur->unsaved)
 				dev_status = msg_string(MSG_pmunchanged);
-			else if (pm_cur->bootable)
-				dev_status = msg_string(MSG_pmsetboot);
 			else
 				dev_status = msg_string(MSG_pmused);
-			wprintw(m->mw, "%-33.32s   %33.32s",
+			wprintw(m->mw, "%-43.42s %25.24s",
 				pm_cur->diskdev_descr,
 				dev_status);
 			break;
@@ -2730,7 +2833,8 @@ pm_menufmt(menudesc *m, int opt, void *a
 			if (parts->pscheme->get_part_device != NULL)
 				parts->pscheme->get_part_device(
 				    parts,  part_num,
-				    dev, sizeof dev, NULL, plain_name, false);
+				    dev, sizeof dev, NULL, plain_name, false,
+				    true);
 			else
 				strcpy(dev, "-");
 			parts->pscheme->get_part_info(parts,
@@ -2807,7 +2911,7 @@ pm_upddevlist_adv(menudesc *m, void *arg
 				d->s->parent_size * d->sub_num) != 0)
 			continue;
 		/* We have a entry for displaying */
-		changed = 1;
+		pm_changed = 1;
 		m->opts[*i] = (struct menu_ent) {
 			.opt_name = NULL,
 			.opt_action = pm_submenu,
@@ -2836,12 +2940,12 @@ pm_upddevlist(menudesc *m, void *arg)
 	struct disk_part_info info;
 
 	if (arg != NULL)
-		((struct part_entry *)arg)[0].retvalue = m->cursel + 1;
+		pm_retvalue = m->cursel + 1;
 
-	changed = 0;
+	pm_changed = 0;
 	/* Mark all devices as not found */
 	SLIST_FOREACH(pm_i, &pm_head, l) {
-		if (pm_i->parts != NULL) {
+		if (pm_i->parts != NULL && !pm_i->unsaved) {
 			pm_i->parts->pscheme->free(pm_i->parts);
 			pm_i->parts = NULL;
 		}
@@ -2925,16 +3029,24 @@ pm_upddevlist(menudesc *m, void *arg)
 		}
 		i++;
 	}
+	for (ii = 0; ii <= (size_t)i; ii++) {
+		m->opts[ii].opt_flags = OPT_EXIT;
+	}
 	if (have_cgd) {
 		pm_upddevlist_adv(m, arg, &i,
-		    &(pm_upddevlist_adv_t) {MSG_create_cgd, PM_CGD, &cgds_t_info, 0, NULL});
+		    &(pm_upddevlist_adv_t) {MSG_create_cgd, PM_CGD,
+		    &cgds_t_info, 0, NULL});
 	}
+	pm_upddevlist_adv(m, arg, &i,
+	    &(pm_upddevlist_adv_t) {MSG_create_vnd, PM_VND,
+	    &vnds_t_info, 0, NULL});
 	if (have_lvm) {
 		pm_upddevlist_adv(m, arg, &i,
-		    &(pm_upddevlist_adv_t) {MSG_create_cnd, PM_VND, &vnds_t_info, 0, NULL});
-		pm_upddevlist_adv(m, arg, &i,
-		    &(pm_upddevlist_adv_t) {MSG_create_vg, PM_LVM, &lvms_t_info, 0,
-		    &(pm_upddevlist_adv_t) {MSG_create_lv, PM_LVMLV, &lv_t_info, 0, NULL}});
+		    &(pm_upddevlist_adv_t) {MSG_create_vg, PM_LVM,
+		    &lvms_t_info, 0,
+		    &(pm_upddevlist_adv_t) {MSG_create_lv, PM_LVMLV,
+		    &lv_t_info, 0,
+		    NULL}});
 	}
 	if (have_raid) {
 		pm_upddevlist_adv(m, arg, &i,
@@ -2949,30 +3061,27 @@ pm_upddevlist(menudesc *m, void *arg)
 		.opt_name = MSG_savepm,
 		.opt_action = pm_commit,
 	};
-	for (ii = 0; ii <= (size_t)i; ii++) {
-		m->opts[ii].opt_flags = OPT_EXIT;
-	}
 
-	if (((struct part_entry *)arg)[0].retvalue >= 0)
-		m->cursel = ((struct part_entry *)arg)[0].retvalue - 1;
+	if (pm_retvalue >= 0)
+		m->cursel = pm_retvalue - 1;
 	return i;
 }
 
 static void
 pm_menuin(menudesc *m, void *arg)
 {
-	if (cursel > m->numopts)
+	if (pm_cursel > m->numopts)
 		m->cursel = m->numopts;
-	else if (cursel < 0)
+	else if (pm_cursel < 0)
 		m->cursel = 0;
 	else
-		m->cursel = cursel;
+		m->cursel = pm_cursel;
 }
 
 static void
 pm_menuout(menudesc *m, void *arg)
 {
-	cursel = m->cursel;
+	pm_cursel = m->cursel;
 }
 
 /* Main partman function */
@@ -3008,9 +3117,6 @@ partman(void)
 		else if (!(lvms = calloc(MAX_LVM_VG, sizeof(*lvms))))
 			have_lvm = 0;
 
-		if (!have_gpt)
-			remove_gpt_options();
-
 		raids_t_info = (structinfo_t) {
 			.max = MAX_RAID,
 			.entry_size = sizeof raids[0],
@@ -3052,8 +3158,8 @@ partman(void)
 			.parent_size = sizeof lvms[0],
 		};
 
-		cursel = 0;
-		changed = 0;
+		pm_cursel = 0;
+		pm_changed = 0;
 		firstrun = 0;
 	}
 
@@ -3064,34 +3170,23 @@ partman(void)
 			MC_ALWAYS_SCROLL | MC_NOBOX | MC_NOCLEAR,
 			pm_menuin, pm_menufmt, pm_menuout, NULL, MSG_finishpm);
 		if (menu_no == -1)
-			args[0].retvalue = -1;
+			pm_retvalue = -1;
 		else {
-			args[0].retvalue = 0;
+			pm_retvalue = 0;
 			clear();
 			refresh();
 			process_menu(menu_no, &args);
 			free_menu(menu_no);
 		}
 
-		if (args[0].retvalue == 0 && pm->parts != NULL) {
-			struct install_partition_desc install;
-
-			install_desc_from_parts(&install, pm->parts);
+		if (pm_retvalue == 0 && pm->parts != NULL)
 			if (pm_needsave())
 				pm_commit(NULL, NULL);
-			if (pm_mountall() != 0 ||
-				make_fstab(&install) != 0 ||
-				pm_lastcheck() != 0 ||
-				pm_savebootsector() != 0) {
-					msg_display(MSG_wannatry);
-					args[0].retvalue = (ask_yesno(NULL)) ? 1:-1;
-			}
-			free_install_desc(&install);
-		}
-	} while (args[0].retvalue > 0);
+
+	} while (pm_retvalue > 0);
 	
 	/* retvalue <0 - error, retvalue ==0 - user quits, retvalue >0 - all ok */
-	return (args[0].retvalue >= 0)?0:-1;
+	return (pm_retvalue >= 0)?0:-1;
 }
 
 void
@@ -3106,3 +3201,182 @@ update_wedges(const char *disk)
 	    "dkctl %s makewedges", disk);
 }
 
+bool
+pm_force_parts(struct pm_devs *my_pm)
+{
+	if (my_pm == NULL)
+		return false;
+	if (my_pm->parts != NULL)
+		return true;
+
+	const struct disk_partitioning_scheme *ps =
+	    select_part_scheme(my_pm, NULL, false, NULL);
+	if (ps == NULL)
+		return false;
+
+	struct disk_partitions *parts =
+	   (*ps->create_new_for_disk)(my_pm->diskdev, 0, my_pm->dlsize,
+	    my_pm->dlsize, false, NULL);
+	if (parts == NULL)
+		return false;
+
+	my_pm->parts = parts;
+	if (pm->dlsize > ps->size_limit)
+		pm->dlsize = ps->size_limit;
+
+	return true;
+}
+
+void
+pm_edit_partitions(struct part_entry *pe)
+{
+	struct pm_devs *my_pm = pm_from_pe(pe);
+	struct partition_usage_set pset = { 0 };
+
+	if (!my_pm)
+		return;
+
+	if (!pm_force_parts(my_pm))
+		return;
+
+	clear();
+	refresh();
+
+	usage_set_from_parts(&pset, my_pm->parts);
+	edit_and_check_label(my_pm, &pset, false);
+	free_usage_set(&pset);
+
+	pm_partusage(my_pm, -1, -1);
+	my_pm->unsaved = true;
+	pm_retvalue = 1;
+}
+
+part_id
+pm_whole_disk(struct part_entry *pe, int t)
+{
+	struct pm_devs *my_pm = pm_from_pe(pe);
+	struct disk_partitions *parts, *outer;
+	struct disk_part_info info, oinfo;
+	struct disk_part_free_space space;
+	daddr_t align;
+	int fst;
+	struct partition_usage_set pset = { 0 };
+	part_id new_part, id;
+	size_t i, cnt;
+
+	if (!my_pm)
+		return NO_PART;
+
+	if (!pm_force_parts(my_pm))
+		return NO_PART;
+ 
+	parts = my_pm->parts;
+	parts->pscheme->delete_all_partitions(parts);
+	if (parts->pscheme->secondary_scheme != NULL) {
+		outer = parts;
+		parts = parts->pscheme->secondary_partitions(outer,
+		    0, true);
+		if (parts == NULL) {
+			parts = outer;
+		} else {
+			if (outer->pscheme->write_to_disk(outer))
+				my_pm->parts = parts;
+		}
+	}
+
+	align = parts->pscheme->get_part_alignment(parts);
+
+	memset(&info, 0, sizeof info);
+	switch (t) {
+	case SY_NEWRAID:
+		fst = FS_RAID;
+		break;
+	case SY_NEWLVM:
+		fst = FS_BSDFFS;
+		break;
+	case SY_NEWCGD:
+		fst = FS_CGD;
+		break;
+	default:
+		assert(false); 
+	}
+	info.nat_type = parts->pscheme->get_fs_part_type(PT_root, fst, 0);
+	if (info.nat_type != NULL && parts->pscheme->get_default_fstype != NULL)
+		parts->pscheme->get_default_fstype(info.nat_type,
+		    &info.fs_type, &info.fs_sub_type);
+	if (parts->pscheme->get_free_spaces(parts, &space, 1,
+	    5*align, align, -1, -1) != 1)
+		return NO_PART;
+	info.start = space.start;
+	info.size = space.size;
+	new_part = parts->pscheme->add_partition(parts, &info, NULL);
+	if (new_part == NO_PART)
+		return NO_PART;
+
+	parts->pscheme->get_part_info(parts, new_part, &oinfo);
+
+	clear();
+	refresh();
+
+	usage_set_from_parts(&pset, parts);
+	edit_and_check_label(my_pm, &pset, false);
+	free_usage_set(&pset);
+
+	/*
+	 * Try to match our new partition after user edit
+	 */
+	new_part = NO_PART;
+	for (cnt = i = 0; i < parts->num_part; i++) {
+		if (!parts->pscheme->get_part_info(parts,i, &info))
+			continue;
+		if (info.flags & (PTI_SEC_CONTAINER|PTI_WHOLE_DISK|
+		    PTI_PSCHEME_INTERNAL|PTI_RAW_PART))
+			continue;
+		if (info.nat_type != oinfo.nat_type)
+			continue;
+		if (new_part == NO_PART)
+			new_part = i;
+		cnt++;
+	}
+	if (cnt > 1) {
+		/* multiple matches, retry matching with start */
+		id = NO_PART;
+		for (cnt = i = 0; i < parts->num_part; i++) {
+			if (!parts->pscheme->get_part_info(parts, i, &info))
+				continue;
+			if (info.flags & (PTI_SEC_CONTAINER|PTI_WHOLE_DISK|
+			    PTI_PSCHEME_INTERNAL|PTI_RAW_PART))
+				continue;
+			if (info.nat_type != oinfo.nat_type)
+				continue;
+			if (info.start != oinfo.start)
+				continue;
+			if (id == NO_PART)
+				id = i;
+			cnt++;
+		}
+		if (id != NO_PART)
+			new_part = id;
+	}
+
+	clear();
+	refresh();
+
+	pm_partusage(my_pm, -1, -1);
+	my_pm->unsaved = true;
+	pm_retvalue = 1;
+
+	return new_part;
+}
+
+struct pm_devs *
+pm_from_pe(struct part_entry *pe)
+{
+	switch (pe->type) {
+	case PM_DISK:
+		return pe->dev_ptr;
+	default:
+		assert(false);
+	}
+	return NULL;
+}

Index: src/usr.sbin/sysinst/target.c
diff -u src/usr.sbin/sysinst/target.c:1.10 src/usr.sbin/sysinst/target.c:1.11
--- src/usr.sbin/sysinst/target.c:1.10	Wed Aug  7 10:08:04 2019
+++ src/usr.sbin/sysinst/target.c	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: target.c,v 1.10 2019/08/07 10:08:04 martin Exp $	*/
+/*	$NetBSD: target.c,v 1.11 2020/01/09 13:22:30 martin Exp $	*/
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -71,7 +71,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: target.c,v 1.10 2019/08/07 10:08:04 martin Exp $");
+__RCSID("$NetBSD: target.c,v 1.11 2020/01/09 13:22:30 martin Exp $");
 #endif
 
 /*
@@ -192,7 +192,7 @@ target_already_root(void)
 		if (!is_root_part_mount(info.last_mounted))
 			continue;
 		if (!parts->pscheme->get_part_device(parts, ptn,
-		    dev, sizeof dev, &rootpart, plain_name, false))
+		    dev, sizeof dev, &rootpart, plain_name, false, true))
 			continue;
 
 		last_res = is_active_rootpart(dev, rootpart);

Index: src/usr.sbin/sysinst/arch/arc/md.c
diff -u src/usr.sbin/sysinst/arch/arc/md.c:1.10 src/usr.sbin/sysinst/arch/arc/md.c:1.11
--- src/usr.sbin/sysinst/arch/arc/md.c:1.10	Sat Dec 14 12:00:40 2019
+++ src/usr.sbin/sysinst/arch/arc/md.c	Thu Jan  9 13:22:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.10 2019/12/14 12:00:40 martin Exp $ */
+/*	$NetBSD: md.c,v 1.11 2020/01/09 13:22:30 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -79,7 +79,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 

Index: src/usr.sbin/sysinst/arch/bebox/md.c
diff -u src/usr.sbin/sysinst/arch/bebox/md.c:1.6 src/usr.sbin/sysinst/arch/bebox/md.c:1.7
--- src/usr.sbin/sysinst/arch/bebox/md.c:1.6	Wed Aug 14 12:55:35 2019
+++ src/usr.sbin/sysinst/arch/bebox/md.c	Thu Jan  9 13:22:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.6 2019/08/14 12:55:35 martin Exp $ */
+/*	$NetBSD: md.c,v 1.7 2020/01/09 13:22:31 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -72,7 +72,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 

Index: src/usr.sbin/sysinst/arch/cobalt/md.c
diff -u src/usr.sbin/sysinst/arch/cobalt/md.c:1.10 src/usr.sbin/sysinst/arch/cobalt/md.c:1.11
--- src/usr.sbin/sysinst/arch/cobalt/md.c:1.10	Sat Dec 14 12:00:40 2019
+++ src/usr.sbin/sysinst/arch/cobalt/md.c	Thu Jan  9 13:22:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.10 2019/12/14 12:00:40 martin Exp $ */
+/*	$NetBSD: md.c,v 1.11 2020/01/09 13:22:31 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -79,7 +79,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 

Index: src/usr.sbin/sysinst/arch/evbarm/md.c
diff -u src/usr.sbin/sysinst/arch/evbarm/md.c:1.10 src/usr.sbin/sysinst/arch/evbarm/md.c:1.11
--- src/usr.sbin/sysinst/arch/evbarm/md.c:1.10	Wed Dec 11 15:08:45 2019
+++ src/usr.sbin/sysinst/arch/evbarm/md.c	Thu Jan  9 13:22:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.10 2019/12/11 15:08:45 martin Exp $ */
+/*	$NetBSD: md.c,v 1.11 2020/01/09 13:22:31 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -88,7 +88,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 

Index: src/usr.sbin/sysinst/arch/evbmips/md.c
diff -u src/usr.sbin/sysinst/arch/evbmips/md.c:1.6 src/usr.sbin/sysinst/arch/evbmips/md.c:1.7
--- src/usr.sbin/sysinst/arch/evbmips/md.c:1.6	Wed Aug 14 12:55:36 2019
+++ src/usr.sbin/sysinst/arch/evbmips/md.c	Thu Jan  9 13:22:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: md.c,v 1.6 2019/08/14 12:55:36 martin Exp $ */
+/* $NetBSD: md.c,v 1.7 2020/01/09 13:22:31 martin Exp $ */
 
 /*
  * Copyright 1997,2002 Piermont Information Systems Inc.
@@ -72,7 +72,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 

Index: src/usr.sbin/sysinst/arch/evbppc/md.c
diff -u src/usr.sbin/sysinst/arch/evbppc/md.c:1.6 src/usr.sbin/sysinst/arch/evbppc/md.c:1.7
--- src/usr.sbin/sysinst/arch/evbppc/md.c:1.6	Wed Aug 14 12:55:36 2019
+++ src/usr.sbin/sysinst/arch/evbppc/md.c	Thu Jan  9 13:22:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.6 2019/08/14 12:55:36 martin Exp $ */
+/*	$NetBSD: md.c,v 1.7 2020/01/09 13:22:31 martin Exp $ */
 
 /*
  * Copyright 1997,2002 Piermont Information Systems Inc.
@@ -72,7 +72,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 

Index: src/usr.sbin/sysinst/arch/hpcarm/md.c
diff -u src/usr.sbin/sysinst/arch/hpcarm/md.c:1.6 src/usr.sbin/sysinst/arch/hpcarm/md.c:1.7
--- src/usr.sbin/sysinst/arch/hpcarm/md.c:1.6	Wed Aug 14 12:55:36 2019
+++ src/usr.sbin/sysinst/arch/hpcarm/md.c	Thu Jan  9 13:22:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.6 2019/08/14 12:55:36 martin Exp $ */
+/*	$NetBSD: md.c,v 1.7 2020/01/09 13:22:31 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -101,7 +101,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 

Index: src/usr.sbin/sysinst/arch/hpcmips/md.c
diff -u src/usr.sbin/sysinst/arch/hpcmips/md.c:1.6 src/usr.sbin/sysinst/arch/hpcmips/md.c:1.7
--- src/usr.sbin/sysinst/arch/hpcmips/md.c:1.6	Wed Aug 14 12:55:36 2019
+++ src/usr.sbin/sysinst/arch/hpcmips/md.c	Thu Jan  9 13:22:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.6 2019/08/14 12:55:36 martin Exp $ */
+/*	$NetBSD: md.c,v 1.7 2020/01/09 13:22:31 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -75,7 +75,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 

Index: src/usr.sbin/sysinst/arch/hpcsh/md.c
diff -u src/usr.sbin/sysinst/arch/hpcsh/md.c:1.7 src/usr.sbin/sysinst/arch/hpcsh/md.c:1.8
--- src/usr.sbin/sysinst/arch/hpcsh/md.c:1.7	Wed Aug 14 12:55:36 2019
+++ src/usr.sbin/sysinst/arch/hpcsh/md.c	Thu Jan  9 13:22:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.7 2019/08/14 12:55:36 martin Exp $	*/
+/*	$NetBSD: md.c,v 1.8 2020/01/09 13:22:31 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -76,7 +76,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 

Index: src/usr.sbin/sysinst/arch/i386/md.c
diff -u src/usr.sbin/sysinst/arch/i386/md.c:1.27 src/usr.sbin/sysinst/arch/i386/md.c:1.28
--- src/usr.sbin/sysinst/arch/i386/md.c:1.27	Fri Dec 13 22:10:21 2019
+++ src/usr.sbin/sysinst/arch/i386/md.c	Thu Jan  9 13:22:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.27 2019/12/13 22:10:21 martin Exp $ */
+/*	$NetBSD: md.c,v 1.28 2020/01/09 13:22:31 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -122,7 +122,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 
@@ -285,7 +285,7 @@ md_post_newfs_bios(struct install_partit
 
 		install->infos[0].parts->pscheme->get_part_device(
 		    install->infos[0].parts, install->infos[0].cur_part_id,
-		    rdev, sizeof rdev, NULL, raw_dev_name, true);
+		    rdev, sizeof rdev, NULL, raw_dev_name, true, true);
 
 		snprintf(boot_options, sizeof boot_options,
 		    "console=%s,speed=%u", consoles[boottype.bp_consdev],
@@ -317,7 +317,7 @@ copy_uefi_boot(const struct part_usage_i
 	int err;
 
 	if (!boot->parts->pscheme->get_part_device(boot->parts,
-	    boot->cur_part_id, dev, sizeof(dev), NULL, plain_name, true))
+	    boot->cur_part_id, dev, sizeof(dev), NULL, plain_name, true, true))
 		return -1;
 
 	/*

Index: src/usr.sbin/sysinst/arch/landisk/md.c
diff -u src/usr.sbin/sysinst/arch/landisk/md.c:1.11 src/usr.sbin/sysinst/arch/landisk/md.c:1.12
--- src/usr.sbin/sysinst/arch/landisk/md.c:1.11	Wed Aug 14 12:55:36 2019
+++ src/usr.sbin/sysinst/arch/landisk/md.c	Thu Jan  9 13:22:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.11 2019/08/14 12:55:36 martin Exp $	*/
+/*	$NetBSD: md.c,v 1.12 2020/01/09 13:22:32 martin Exp $	*/
 
 /*
  * Copyright 1997,2002 Piermont Information Systems Inc.
@@ -72,7 +72,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 

Index: src/usr.sbin/sysinst/arch/luna68k/md.c
diff -u src/usr.sbin/sysinst/arch/luna68k/md.c:1.7 src/usr.sbin/sysinst/arch/luna68k/md.c:1.8
--- src/usr.sbin/sysinst/arch/luna68k/md.c:1.7	Sat Jul 13 17:13:38 2019
+++ src/usr.sbin/sysinst/arch/luna68k/md.c	Thu Jan  9 13:22:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.7 2019/07/13 17:13:38 martin Exp $	*/
+/*	$NetBSD: md.c,v 1.8 2020/01/09 13:22:32 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -193,11 +193,11 @@ md_post_newfs(struct install_partition_d
 
 	if (!install->infos[0].parts->pscheme->get_part_device(
 	    install->infos[0].parts, install->infos[0].cur_part_id,
- 	    rdisk, sizeof rdisk, NULL, raw_dev_name, true))
+ 	    rdisk, sizeof rdisk, NULL, raw_dev_name, true, true))
 		return 1;
 	if (!install->infos[0].parts->pscheme->get_part_device(
 	    install->infos[0].parts, install->infos[0].cur_part_id,
-	    disk, sizeof disk, NULL, plain_name, true))
+	    disk, sizeof disk, NULL, plain_name, true, true))
 		return 1;
 
 	if (run_program(RUN_DISPLAY | RUN_PROGRESS,
@@ -246,7 +246,7 @@ md_update(struct install_partition_desc 
 
 	if (!install->infos[0].parts->pscheme->get_part_device(
 	    install->infos[0].parts, install->infos[0].cur_part_id,
- 	    disk, sizeof disk, NULL, plain_name, true))
+ 	    disk, sizeof disk, NULL, plain_name, true, true))
 		return 0;
 
 	/*

Index: src/usr.sbin/sysinst/arch/ofppc/md.c
diff -u src/usr.sbin/sysinst/arch/ofppc/md.c:1.8 src/usr.sbin/sysinst/arch/ofppc/md.c:1.9
--- src/usr.sbin/sysinst/arch/ofppc/md.c:1.8	Wed Aug 14 12:55:37 2019
+++ src/usr.sbin/sysinst/arch/ofppc/md.c	Thu Jan  9 13:22:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.8 2019/08/14 12:55:37 martin Exp $	*/
+/*	$NetBSD: md.c,v 1.9 2020/01/09 13:22:32 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -93,7 +93,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 
@@ -447,18 +447,18 @@ md_post_extract(struct install_partition
 			parts = parts->parent;		/* MBR */
 
 		parts->pscheme->get_part_device(parts, bootpart_prep,
-		    bootdev, sizeof bootdev, NULL, raw_dev_name, true);
+		    bootdev, sizeof bootdev, NULL, raw_dev_name, true, true);
 		parts->pscheme->get_part_device(parts, bootpart_prep,
-		    bootbdev, sizeof bootbdev, NULL, plain_name, true);
+		    bootbdev, sizeof bootbdev, NULL, plain_name, true, true);
 		run_program(RUN_DISPLAY, "/bin/dd if=/dev/zero of=%s bs=512",
 		    bootdev);
 		run_program(RUN_DISPLAY, "/bin/dd if=/usr/mdec/ofwboot "
 		    "of=%s bs=512", bootbdev);
 
 		parts->pscheme->get_part_device(parts, bootpart_binfo,
-		    bootdev, sizeof bootdev, NULL, raw_dev_name, true);
+		    bootdev, sizeof bootdev, NULL, raw_dev_name, true, true);
 		parts->pscheme->get_part_device(parts, bootpart_binfo,
-		    bootbdev, sizeof bootbdev, NULL, plain_name, true);
+		    bootbdev, sizeof bootbdev, NULL, plain_name, true, true);
 		run_program(RUN_DISPLAY, "/bin/dd if=/dev/zero of=%s bs=512",
 		    bootdev);
 		run_program(RUN_DISPLAY, "/bin/dd if=/tmp/bootinfo.txt "

Index: src/usr.sbin/sysinst/arch/playstation2/md.c
diff -u src/usr.sbin/sysinst/arch/playstation2/md.c:1.6 src/usr.sbin/sysinst/arch/playstation2/md.c:1.7
--- src/usr.sbin/sysinst/arch/playstation2/md.c:1.6	Wed Aug 14 12:55:37 2019
+++ src/usr.sbin/sysinst/arch/playstation2/md.c	Thu Jan  9 13:22:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.6 2019/08/14 12:55:37 martin Exp $ */
+/*	$NetBSD: md.c,v 1.7 2020/01/09 13:22:32 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -77,7 +77,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 

Index: src/usr.sbin/sysinst/arch/prep/md.c
diff -u src/usr.sbin/sysinst/arch/prep/md.c:1.10 src/usr.sbin/sysinst/arch/prep/md.c:1.11
--- src/usr.sbin/sysinst/arch/prep/md.c:1.10	Sat Dec 14 12:00:40 2019
+++ src/usr.sbin/sysinst/arch/prep/md.c	Thu Jan  9 13:22:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.10 2019/12/14 12:00:40 martin Exp $	*/
+/*	$NetBSD: md.c,v 1.11 2020/01/09 13:22:32 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -77,7 +77,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 

Index: src/usr.sbin/sysinst/arch/sandpoint/md.c
diff -u src/usr.sbin/sysinst/arch/sandpoint/md.c:1.6 src/usr.sbin/sysinst/arch/sandpoint/md.c:1.7
--- src/usr.sbin/sysinst/arch/sandpoint/md.c:1.6	Wed Aug 14 12:55:37 2019
+++ src/usr.sbin/sysinst/arch/sandpoint/md.c	Thu Jan  9 13:22:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.6 2019/08/14 12:55:37 martin Exp $ */
+/*	$NetBSD: md.c,v 1.7 2020/01/09 13:22:32 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -106,7 +106,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 

Index: src/usr.sbin/sysinst/arch/zaurus/md.c
diff -u src/usr.sbin/sysinst/arch/zaurus/md.c:1.6 src/usr.sbin/sysinst/arch/zaurus/md.c:1.7
--- src/usr.sbin/sysinst/arch/zaurus/md.c:1.6	Wed Aug 14 12:55:37 2019
+++ src/usr.sbin/sysinst/arch/zaurus/md.c	Thu Jan  9 13:22:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.6 2019/08/14 12:55:37 martin Exp $	*/
+/*	$NetBSD: md.c,v 1.7 2020/01/09 13:22:32 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -86,7 +86,7 @@ md_get_info(struct install_partition_des
 
 		struct disk_partitions *parts =
 		   (*ps->create_new_for_disk)(pm->diskdev,
-		   0, pm->dlsize, pm->dlsize, true);
+		   0, pm->dlsize, pm->dlsize, true, NULL);
 		if (!parts)
 			return false;
 

Reply via email to