From 957b5cd6f458f76fceef8141be7caf06a21678b1 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 12 Oct 2020 16:14:32 +0000 Subject: [PATCH] PR 55536: when we find existing partition tables and have alternative formats available, offer to delete partitions and create new ones from scratch (in some other or the same on-disk format). --- usr.sbin/sysinst/arch/acorn32/md.c | 4 +- usr.sbin/sysinst/arch/alpha/md.c | 4 +- usr.sbin/sysinst/arch/amiga/md.c | 4 +- usr.sbin/sysinst/arch/arc/md.c | 16 +++++-- usr.sbin/sysinst/arch/atari/md.c | 4 +- usr.sbin/sysinst/arch/bebox/md.c | 16 +++++-- usr.sbin/sysinst/arch/cats/md.c | 4 +- usr.sbin/sysinst/arch/cobalt/md.c | 16 +++++-- usr.sbin/sysinst/arch/dummy/md.c | 4 +- usr.sbin/sysinst/arch/emips/md.c | 4 +- usr.sbin/sysinst/arch/evbarm/md.c | 17 +++++-- usr.sbin/sysinst/arch/evbmips/md.c | 16 +++++-- usr.sbin/sysinst/arch/evbppc/md.c | 16 +++++-- usr.sbin/sysinst/arch/evbsh3/md.c | 4 +- usr.sbin/sysinst/arch/ews4800mips/md.c | 4 +- usr.sbin/sysinst/arch/hp300/md.c | 4 +- usr.sbin/sysinst/arch/hpcarm/md.c | 16 +++++-- usr.sbin/sysinst/arch/hpcmips/md.c | 16 +++++-- usr.sbin/sysinst/arch/hpcsh/md.c | 16 +++++-- usr.sbin/sysinst/arch/hppa/md.c | 4 +- usr.sbin/sysinst/arch/i386/md.c | 17 +++++-- usr.sbin/sysinst/arch/landisk/md.c | 16 +++++-- usr.sbin/sysinst/arch/luna68k/md.c | 4 +- usr.sbin/sysinst/arch/mac68k/md.c | 14 +++--- usr.sbin/sysinst/arch/macppc/md.c | 4 +- usr.sbin/sysinst/arch/mipsco/md.c | 4 +- usr.sbin/sysinst/arch/mvme68k/md.c | 4 +- usr.sbin/sysinst/arch/news68k/md.c | 4 +- usr.sbin/sysinst/arch/newsmips/md.c | 4 +- usr.sbin/sysinst/arch/ofppc/md.c | 15 ++++-- usr.sbin/sysinst/arch/playstation2/md.c | 17 +++++-- usr.sbin/sysinst/arch/pmax/md.c | 4 +- usr.sbin/sysinst/arch/prep/md.c | 16 +++++-- usr.sbin/sysinst/arch/sandpoint/md.c | 16 +++++-- usr.sbin/sysinst/arch/sgimips/md.c | 4 +- usr.sbin/sysinst/arch/shark/md.c | 4 +- usr.sbin/sysinst/arch/sparc/md.c | 4 +- usr.sbin/sysinst/arch/sparc64/md.c | 4 +- usr.sbin/sysinst/arch/vax/md.c | 4 +- usr.sbin/sysinst/arch/x68k/md.c | 4 +- usr.sbin/sysinst/arch/zaurus/md.c | 15 ++++-- usr.sbin/sysinst/bsddisklabel.c | 64 +++++++++++++++---------- usr.sbin/sysinst/defs.h | 26 ++++++++-- usr.sbin/sysinst/disklabel.c | 11 ++++- usr.sbin/sysinst/gpt.c | 11 ++++- usr.sbin/sysinst/install.c | 16 +++++-- usr.sbin/sysinst/mbr.c | 28 ++++++++++- usr.sbin/sysinst/mbr.h | 5 +- usr.sbin/sysinst/msg.mi.de | 9 +++- usr.sbin/sysinst/msg.mi.en | 9 +++- usr.sbin/sysinst/msg.mi.es | 9 +++- usr.sbin/sysinst/msg.mi.fr | 9 +++- usr.sbin/sysinst/msg.mi.pl | 9 +++- usr.sbin/sysinst/part_edit.c | 41 ++++++++++++---- usr.sbin/sysinst/partitions.h | 5 +- 55 files changed, 458 insertions(+), 161 deletions(-) diff --git a/usr.sbin/sysinst/arch/acorn32/md.c b/usr.sbin/sysinst/arch/acorn32/md.c index 7bf8589a902f..ba91e724a049 100644 --- a/usr.sbin/sysinst/arch/acorn32/md.c +++ b/usr.sbin/sysinst/arch/acorn32/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.6 2020/09/29 02:58:53 msaitoh Exp $ */ +/* $NetBSD: md.c,v 1.7 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -202,7 +202,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/alpha/md.c b/usr.sbin/sysinst/arch/alpha/md.c index 323bc25fbbd9..473ee5c27671 100644 --- a/usr.sbin/sysinst/arch/alpha/md.c +++ b/usr.sbin/sysinst/arch/alpha/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.8 2020/03/09 17:10:31 martin Exp $ */ +/* $NetBSD: md.c,v 1.9 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -104,7 +104,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/amiga/md.c b/usr.sbin/sysinst/arch/amiga/md.c index 0d2a80e9f37f..7a598c1ad90c 100644 --- a/usr.sbin/sysinst/arch/amiga/md.c +++ b/usr.sbin/sysinst/arch/amiga/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.5 2019/07/13 17:13:36 martin Exp $ */ +/* $NetBSD: md.c,v 1.6 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -65,7 +65,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return 1; diff --git a/usr.sbin/sysinst/arch/arc/md.c b/usr.sbin/sysinst/arch/arc/md.c index 8745e09e4ea8..bee7e576d07b 100644 --- a/usr.sbin/sysinst/arch/arc/md.c +++ b/usr.sbin/sysinst/arch/arc/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.12 2020/01/27 21:21:22 martin Exp $ */ +/* $NetBSD: md.c,v 1.13 2020/10/12 16:14:33 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -65,10 +65,12 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { + int res; if (pm->no_mbr || pm->no_part) return true; +again: if (pm->parts == NULL) { const struct disk_partitioning_scheme *ps = @@ -88,13 +90,21 @@ md_get_info(struct install_partition_desc *install) pm->dlsize = ps->size_limit; } - return set_bios_geom_with_mbr_guess(pm->parts); + res = set_bios_geom_with_mbr_guess(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { diff --git a/usr.sbin/sysinst/arch/atari/md.c b/usr.sbin/sysinst/arch/atari/md.c index 57123b1b6edb..5b237eed4379 100644 --- a/usr.sbin/sysinst/arch/atari/md.c +++ b/usr.sbin/sysinst/arch/atari/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.6 2019/07/13 17:13:36 martin Exp $ */ +/* $NetBSD: md.c,v 1.7 2020/10/12 16:14:33 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -65,7 +65,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { msg_fmt_display(MSG_infoahdilabel, "%s", pm->diskdev); diff --git a/usr.sbin/sysinst/arch/bebox/md.c b/usr.sbin/sysinst/arch/bebox/md.c index 6398371a5cf7..d3c77dde231c 100644 --- a/usr.sbin/sysinst/arch/bebox/md.c +++ b/usr.sbin/sysinst/arch/bebox/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.8 2020/01/27 21:21:22 martin Exp $ */ +/* $NetBSD: md.c,v 1.9 2020/10/12 16:14:33 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -58,10 +58,12 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { + int res; if (pm->no_mbr || pm->no_part) return true; +again: if (pm->parts == NULL) { const struct disk_partitioning_scheme *ps = @@ -81,13 +83,21 @@ md_get_info(struct install_partition_desc *install) pm->dlsize = ps->size_limit; } - return set_bios_geom_with_mbr_guess(pm->parts); + res = set_bios_geom_with_mbr_guess(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/cats/md.c b/usr.sbin/sysinst/arch/cats/md.c index daf08f8cbb29..c08c9b860076 100644 --- a/usr.sbin/sysinst/arch/cats/md.c +++ b/usr.sbin/sysinst/arch/cats/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.4 2019/07/13 17:13:36 martin Exp $ */ +/* $NetBSD: md.c,v 1.5 2020/10/12 16:14:33 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -123,7 +123,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/cobalt/md.c b/usr.sbin/sysinst/arch/cobalt/md.c index 39b492ae5de3..0a799ab25fb5 100644 --- a/usr.sbin/sysinst/arch/cobalt/md.c +++ b/usr.sbin/sysinst/arch/cobalt/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.13 2020/06/10 16:56:22 tsutsui Exp $ */ +/* $NetBSD: md.c,v 1.14 2020/10/12 16:14:33 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -65,10 +65,12 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { + int res; if (pm->no_mbr || pm->no_part) return true; +again: if (pm->parts == NULL) { const struct disk_partitioning_scheme *ps = @@ -88,13 +90,21 @@ md_get_info(struct install_partition_desc *install) pm->dlsize = ps->size_limit; } - return set_bios_geom_with_mbr_guess(pm->parts); + res = set_bios_geom_with_mbr_guess(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/dummy/md.c b/usr.sbin/sysinst/arch/dummy/md.c index 33fd4ca620cb..0974746af03f 100644 --- a/usr.sbin/sysinst/arch/dummy/md.c +++ b/usr.sbin/sysinst/arch/dummy/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.5 2019/07/13 17:13:37 martin Exp $ */ +/* $NetBSD: md.c,v 1.6 2020/10/12 16:14:33 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -55,7 +55,7 @@ md_get_info(struct install_partition_desc *desc) return true; } -bool +int md_make_bsd_partitions(struct install_partition_desc *desc) { return make_bsd_partitions(desc); diff --git a/usr.sbin/sysinst/arch/emips/md.c b/usr.sbin/sysinst/arch/emips/md.c index 0977db6ac54f..8b1d6a65dc41 100644 --- a/usr.sbin/sysinst/arch/emips/md.c +++ b/usr.sbin/sysinst/arch/emips/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.8 2019/12/15 13:39:24 martin Exp $ */ +/* $NetBSD: md.c,v 1.9 2020/10/12 16:14:33 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -109,7 +109,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/evbarm/md.c b/usr.sbin/sysinst/arch/evbarm/md.c index 4258e7145af7..b6929d4485e5 100644 --- a/usr.sbin/sysinst/arch/evbarm/md.c +++ b/usr.sbin/sysinst/arch/evbarm/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.16 2020/05/29 10:25:06 jmcneill Exp $ */ +/* $NetBSD: md.c,v 1.17 2020/10/12 16:14:33 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -92,10 +92,12 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { + int res; if (pm->no_mbr || pm->no_part) return true; +again: if (pm->parts == NULL) { const struct disk_partitioning_scheme *ps = @@ -115,13 +117,22 @@ md_get_info(struct install_partition_desc *install) pm->dlsize = ps->size_limit; } - return edit_outer_parts(pm->parts); + + res = edit_outer_parts(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/evbmips/md.c b/usr.sbin/sysinst/arch/evbmips/md.c index d24f7d62d09e..f63d3366d9bc 100644 --- a/usr.sbin/sysinst/arch/evbmips/md.c +++ b/usr.sbin/sysinst/arch/evbmips/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.8 2020/01/27 21:21:22 martin Exp $ */ +/* $NetBSD: md.c,v 1.9 2020/10/12 16:14:33 martin Exp $ */ /* * Copyright 1997,2002 Piermont Information Systems Inc. @@ -58,10 +58,12 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { + int res; if (pm->no_mbr || pm->no_part) return true; +again: if (pm->parts == NULL) { const struct disk_partitioning_scheme *ps = @@ -81,13 +83,21 @@ md_get_info(struct install_partition_desc *install) pm->dlsize = ps->size_limit; } - return set_bios_geom_with_mbr_guess(pm->parts); + res = set_bios_geom_with_mbr_guess(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/evbppc/md.c b/usr.sbin/sysinst/arch/evbppc/md.c index cc877250f26b..43056f2033ef 100644 --- a/usr.sbin/sysinst/arch/evbppc/md.c +++ b/usr.sbin/sysinst/arch/evbppc/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.8 2020/01/27 21:21:22 martin Exp $ */ +/* $NetBSD: md.c,v 1.9 2020/10/12 16:14:34 martin Exp $ */ /* * Copyright 1997,2002 Piermont Information Systems Inc. @@ -58,10 +58,12 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { + int res; if (pm->no_mbr || pm->no_part) return true; +again: if (pm->parts == NULL) { const struct disk_partitioning_scheme *ps = @@ -81,13 +83,21 @@ md_get_info(struct install_partition_desc *install) pm->dlsize = ps->size_limit; } - return set_bios_geom_with_mbr_guess(pm->parts); + res = set_bios_geom_with_mbr_guess(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/evbsh3/md.c b/usr.sbin/sysinst/arch/evbsh3/md.c index 17efd1c5c310..66476921be0b 100644 --- a/usr.sbin/sysinst/arch/evbsh3/md.c +++ b/usr.sbin/sysinst/arch/evbsh3/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.5 2019/07/13 17:13:37 martin Exp $ */ +/* $NetBSD: md.c,v 1.6 2020/10/12 16:14:34 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -124,7 +124,7 @@ md_post_newfs(struct install_partition_desc *install) return 0; } -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { diff --git a/usr.sbin/sysinst/arch/ews4800mips/md.c b/usr.sbin/sysinst/arch/ews4800mips/md.c index 41f0c02b5d7e..6222f4748011 100644 --- a/usr.sbin/sysinst/arch/ews4800mips/md.c +++ b/usr.sbin/sysinst/arch/ews4800mips/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.6 2020/09/29 02:49:56 msaitoh Exp $ */ +/* $NetBSD: md.c,v 1.7 2020/10/12 16:14:34 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -106,7 +106,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { diff --git a/usr.sbin/sysinst/arch/hp300/md.c b/usr.sbin/sysinst/arch/hp300/md.c index d056619833c4..3683c3d834a6 100644 --- a/usr.sbin/sysinst/arch/hp300/md.c +++ b/usr.sbin/sysinst/arch/hp300/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.10 2020/02/03 13:09:29 martin Exp $ */ +/* $NetBSD: md.c,v 1.11 2020/10/12 16:14:34 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -116,7 +116,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { diff --git a/usr.sbin/sysinst/arch/hpcarm/md.c b/usr.sbin/sysinst/arch/hpcarm/md.c index 2083c89a1d19..3a612fc8167f 100644 --- a/usr.sbin/sysinst/arch/hpcarm/md.c +++ b/usr.sbin/sysinst/arch/hpcarm/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.8 2020/01/27 21:21:22 martin Exp $ */ +/* $NetBSD: md.c,v 1.9 2020/10/12 16:14:34 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -87,10 +87,12 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { + int res; if (pm->no_mbr || pm->no_part) return true; +again: if (pm->parts == NULL) { const struct disk_partitioning_scheme *ps = @@ -110,13 +112,21 @@ md_get_info(struct install_partition_desc *install) pm->dlsize = ps->size_limit; } - return set_bios_geom_with_mbr_guess(pm->parts); + res = set_bios_geom_with_mbr_guess(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/hpcmips/md.c b/usr.sbin/sysinst/arch/hpcmips/md.c index dc48d7fbf2e8..ed43b9bc4f00 100644 --- a/usr.sbin/sysinst/arch/hpcmips/md.c +++ b/usr.sbin/sysinst/arch/hpcmips/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.8 2020/01/27 21:21:22 martin Exp $ */ +/* $NetBSD: md.c,v 1.9 2020/10/12 16:14:34 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -61,10 +61,12 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { + int res; if (pm->no_mbr || pm->no_part) return true; +again: if (pm->parts == NULL) { const struct disk_partitioning_scheme *ps = @@ -84,13 +86,21 @@ md_get_info(struct install_partition_desc *install) pm->dlsize = ps->size_limit; } - return set_bios_geom_with_mbr_guess(pm->parts); + res = set_bios_geom_with_mbr_guess(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/hpcsh/md.c b/usr.sbin/sysinst/arch/hpcsh/md.c index 4b75ca2f008a..bc8c733f06aa 100644 --- a/usr.sbin/sysinst/arch/hpcsh/md.c +++ b/usr.sbin/sysinst/arch/hpcsh/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.9 2020/01/27 21:21:23 martin Exp $ */ +/* $NetBSD: md.c,v 1.10 2020/10/12 16:14:34 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -62,10 +62,12 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { + int res; if (pm->no_mbr || pm->no_part) return true; +again: if (pm->parts == NULL) { const struct disk_partitioning_scheme *ps = @@ -85,13 +87,21 @@ md_get_info(struct install_partition_desc *install) pm->dlsize = ps->size_limit; } - return set_bios_geom_with_mbr_guess(pm->parts); + res = set_bios_geom_with_mbr_guess(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { diff --git a/usr.sbin/sysinst/arch/hppa/md.c b/usr.sbin/sysinst/arch/hppa/md.c index cf98186802a6..508ea8ef4cf4 100644 --- a/usr.sbin/sysinst/arch/hppa/md.c +++ b/usr.sbin/sysinst/arch/hppa/md.c @@ -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/10/12 16:14:34 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -117,7 +117,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/i386/md.c b/usr.sbin/sysinst/arch/i386/md.c index cc059342eb21..512aeb0fe9e5 100644 --- a/usr.sbin/sysinst/arch/i386/md.c +++ b/usr.sbin/sysinst/arch/i386/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.31 2020/10/10 19:42:19 martin Exp $ */ +/* $NetBSD: md.c,v 1.32 2020/10/12 16:14:34 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -107,11 +107,12 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { - int bcyl = 0, bhead = 0, bsec = 0; + int bcyl = 0, bhead = 0, bsec = 0, res; if (pm->no_mbr || pm->no_part) return true; +again: if (pm->parts == NULL) { const struct disk_partitioning_scheme *ps = @@ -149,13 +150,21 @@ md_get_info(struct install_partition_desc *install) if (pm->no_mbr || pm->no_part) return true; - return edit_outer_parts(pm->parts); + res = edit_outer_parts(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/landisk/md.c b/usr.sbin/sysinst/arch/landisk/md.c index db3b6f29ae12..d65e1f2435f8 100644 --- a/usr.sbin/sysinst/arch/landisk/md.c +++ b/usr.sbin/sysinst/arch/landisk/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.13 2020/01/27 21:21:23 martin Exp $ */ +/* $NetBSD: md.c,v 1.14 2020/10/12 16:14:34 martin Exp $ */ /* * Copyright 1997,2002 Piermont Information Systems Inc. @@ -58,10 +58,12 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { + int res; if (pm->no_mbr || pm->no_part) return true; +again: if (pm->parts == NULL) { const struct disk_partitioning_scheme *ps = @@ -81,13 +83,21 @@ md_get_info(struct install_partition_desc *install) pm->dlsize = ps->size_limit; } - return set_bios_geom_with_mbr_guess(pm->parts); + res = set_bios_geom_with_mbr_guess(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/luna68k/md.c b/usr.sbin/sysinst/arch/luna68k/md.c index 554f3bf1d642..1c6c01102d12 100644 --- a/usr.sbin/sysinst/arch/luna68k/md.c +++ b/usr.sbin/sysinst/arch/luna68k/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.8 2020/01/09 13:22:32 martin Exp $ */ +/* $NetBSD: md.c,v 1.9 2020/10/12 16:14:35 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -110,7 +110,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { diff --git a/usr.sbin/sysinst/arch/mac68k/md.c b/usr.sbin/sysinst/arch/mac68k/md.c index 82a951f9c1bd..c291729f16d8 100644 --- a/usr.sbin/sysinst/arch/mac68k/md.c +++ b/usr.sbin/sysinst/arch/mac68k/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.9 2020/02/10 16:08:58 martin Exp $ */ +/* $NetBSD: md.c,v 1.10 2020/10/12 16:14:35 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -244,7 +244,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { int i, j, rv; @@ -265,7 +265,7 @@ md_make_bsd_partitions(struct install_partition_desc *install) if (check_for_errors()) { process_menu (MENU_sanity, &rv); if (rv < 0) - return false; + return 0; else if (rv) break; edit_diskmap(); @@ -317,7 +317,7 @@ md_make_bsd_partitions(struct install_partition_desc *install) pid = pm->parts->pscheme->add_outer_partition(pm->parts, &info, NULL); if (pid == NO_PART) - return false; + return 0; } } } @@ -327,11 +327,11 @@ md_make_bsd_partitions(struct install_partition_desc *install) /* Write the converted partitions */ if (!pm->parts->pscheme->write_to_disk(pm->parts)) - return false; + return 0; /* now convert to install info */ if (!install_desc_from_parts(install, pm->parts)) - return false; + return 0; /* set newfs flag for all FFS partitions */ for (ndx = 0; ndx < install->num; ndx++) { @@ -341,7 +341,7 @@ md_make_bsd_partitions(struct install_partition_desc *install) install->infos[ndx].instflags |= PUIINST_NEWFS; } - return true; + return 1; } /* diff --git a/usr.sbin/sysinst/arch/macppc/md.c b/usr.sbin/sysinst/arch/macppc/md.c index 68202becb9ce..f8828155ce67 100644 --- a/usr.sbin/sysinst/arch/macppc/md.c +++ b/usr.sbin/sysinst/arch/macppc/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.5 2019/07/13 17:13:38 martin Exp $ */ +/* $NetBSD: md.c,v 1.6 2020/10/12 16:14:35 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -104,7 +104,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/mipsco/md.c b/usr.sbin/sysinst/arch/mipsco/md.c index c8ec6d6dab50..625543f31d7c 100644 --- a/usr.sbin/sysinst/arch/mipsco/md.c +++ b/usr.sbin/sysinst/arch/mipsco/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.7 2019/12/15 13:39:24 martin Exp $ */ +/* $NetBSD: md.c,v 1.8 2020/10/12 16:14:35 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -110,7 +110,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/mvme68k/md.c b/usr.sbin/sysinst/arch/mvme68k/md.c index 2aee14fd4d90..5bf96da6ab07 100644 --- a/usr.sbin/sysinst/arch/mvme68k/md.c +++ b/usr.sbin/sysinst/arch/mvme68k/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.10 2020/02/03 13:09:29 martin Exp $ */ +/* $NetBSD: md.c,v 1.11 2020/10/12 16:14:35 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -116,7 +116,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { diff --git a/usr.sbin/sysinst/arch/news68k/md.c b/usr.sbin/sysinst/arch/news68k/md.c index d06efb0baeda..92a4b5c336a4 100644 --- a/usr.sbin/sysinst/arch/news68k/md.c +++ b/usr.sbin/sysinst/arch/news68k/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.6 2019/07/13 17:13:39 martin Exp $ */ +/* $NetBSD: md.c,v 1.7 2020/10/12 16:14:35 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -105,7 +105,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { diff --git a/usr.sbin/sysinst/arch/newsmips/md.c b/usr.sbin/sysinst/arch/newsmips/md.c index f500c748fc84..9437836ac170 100644 --- a/usr.sbin/sysinst/arch/newsmips/md.c +++ b/usr.sbin/sysinst/arch/newsmips/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.5 2019/07/13 17:13:39 martin Exp $ */ +/* $NetBSD: md.c,v 1.6 2020/10/12 16:14:35 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -104,7 +104,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/ofppc/md.c b/usr.sbin/sysinst/arch/ofppc/md.c index 947aa7ca96d6..8e59dc8146e8 100644 --- a/usr.sbin/sysinst/arch/ofppc/md.c +++ b/usr.sbin/sysinst/arch/ofppc/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.10 2020/01/27 21:21:23 martin Exp $ */ +/* $NetBSD: md.c,v 1.11 2020/10/12 16:14:35 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -75,6 +75,7 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { + int res; if (check_rdb()) return true; @@ -102,13 +103,21 @@ md_get_info(struct install_partition_desc *install) pm->dlsize = ps->size_limit; } - return set_bios_geom_with_mbr_guess(pm->parts); + res = set_bios_geom_with_mbr_guess(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { #if 0 diff --git a/usr.sbin/sysinst/arch/playstation2/md.c b/usr.sbin/sysinst/arch/playstation2/md.c index 729a48bc8c72..f4b688edbace 100644 --- a/usr.sbin/sysinst/arch/playstation2/md.c +++ b/usr.sbin/sysinst/arch/playstation2/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.8 2020/01/27 21:21:23 martin Exp $ */ +/* $NetBSD: md.c,v 1.9 2020/10/12 16:14:35 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -62,11 +62,12 @@ md_init_set_status(int minimal) bool md_get_info(struct install_partition_desc *install) { - int cyl, head, sec; + int cyl, head, sec, res; if (pm->no_mbr || pm->no_part) return true; +again: if (pm->parts == NULL) { const struct disk_partitioning_scheme *ps = @@ -107,13 +108,21 @@ md_get_info(struct install_partition_desc *install) if (pm->no_mbr || pm->no_part) return true; - return edit_outer_parts(pm->parts); + res = edit_outer_parts(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/pmax/md.c b/usr.sbin/sysinst/arch/pmax/md.c index 753ac0292351..4b966df52a14 100644 --- a/usr.sbin/sysinst/arch/pmax/md.c +++ b/usr.sbin/sysinst/arch/pmax/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.7 2019/12/15 13:39:24 martin Exp $ */ +/* $NetBSD: md.c,v 1.8 2020/10/12 16:14:36 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -109,7 +109,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/prep/md.c b/usr.sbin/sysinst/arch/prep/md.c index 5208ecf04da5..d57409586a9f 100644 --- a/usr.sbin/sysinst/arch/prep/md.c +++ b/usr.sbin/sysinst/arch/prep/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.12 2020/01/27 21:21:23 martin Exp $ */ +/* $NetBSD: md.c,v 1.13 2020/10/12 16:14:36 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -63,10 +63,12 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { + int res; if (pm->no_mbr || pm->no_part) return true; +again: if (pm->parts == NULL) { const struct disk_partitioning_scheme *ps = @@ -86,13 +88,21 @@ md_get_info(struct install_partition_desc *install) pm->dlsize = ps->size_limit; } - return set_bios_geom_with_mbr_guess(pm->parts); + res = set_bios_geom_with_mbr_guess(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/sandpoint/md.c b/usr.sbin/sysinst/arch/sandpoint/md.c index c2cca066534a..30227b130818 100644 --- a/usr.sbin/sysinst/arch/sandpoint/md.c +++ b/usr.sbin/sysinst/arch/sandpoint/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.8 2020/01/27 21:21:23 martin Exp $ */ +/* $NetBSD: md.c,v 1.9 2020/10/12 16:14:36 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -92,10 +92,12 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { + int res; if (pm->no_mbr || pm->no_part) return true; +again: if (pm->parts == NULL) { const struct disk_partitioning_scheme *ps = @@ -115,13 +117,21 @@ md_get_info(struct install_partition_desc *install) pm->dlsize = ps->size_limit; } - return set_bios_geom_with_mbr_guess(pm->parts); + res = set_bios_geom_with_mbr_guess(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/sgimips/md.c b/usr.sbin/sysinst/arch/sgimips/md.c index 0b1d48d82df9..6ae206c45be9 100644 --- a/usr.sbin/sysinst/arch/sgimips/md.c +++ b/usr.sbin/sysinst/arch/sgimips/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.8 2019/07/13 17:13:40 martin Exp $ */ +/* $NetBSD: md.c,v 1.9 2020/10/12 16:14:36 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -126,7 +126,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/shark/md.c b/usr.sbin/sysinst/arch/shark/md.c index 050bd9c142df..734fbb5d8ade 100644 --- a/usr.sbin/sysinst/arch/shark/md.c +++ b/usr.sbin/sysinst/arch/shark/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.5 2019/07/13 17:13:40 martin Exp $ */ +/* $NetBSD: md.c,v 1.6 2020/10/12 16:14:36 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -107,7 +107,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/sparc/md.c b/usr.sbin/sysinst/arch/sparc/md.c index 13836cdb782c..f3a7c9979ed8 100644 --- a/usr.sbin/sysinst/arch/sparc/md.c +++ b/usr.sbin/sysinst/arch/sparc/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.5 2019/07/13 17:13:40 martin Exp $ */ +/* $NetBSD: md.c,v 1.6 2020/10/12 16:14:36 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -73,7 +73,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return(make_bsd_partitions(install)); diff --git a/usr.sbin/sysinst/arch/sparc64/md.c b/usr.sbin/sysinst/arch/sparc64/md.c index 22808d9efaaa..e6302ef89576 100644 --- a/usr.sbin/sysinst/arch/sparc64/md.c +++ b/usr.sbin/sysinst/arch/sparc64/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.5 2019/07/13 17:13:40 martin Exp $ */ +/* $NetBSD: md.c,v 1.6 2020/10/12 16:14:36 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -74,7 +74,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/vax/md.c b/usr.sbin/sysinst/arch/vax/md.c index 930baeae36f2..cee3f3abb2fd 100644 --- a/usr.sbin/sysinst/arch/vax/md.c +++ b/usr.sbin/sysinst/arch/vax/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.6 2019/07/13 17:13:40 martin Exp $ */ +/* $NetBSD: md.c,v 1.7 2020/10/12 16:14:36 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -112,7 +112,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/x68k/md.c b/usr.sbin/sysinst/arch/x68k/md.c index 3dd30a10ec94..36f6279d27d5 100644 --- a/usr.sbin/sysinst/arch/x68k/md.c +++ b/usr.sbin/sysinst/arch/x68k/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.10 2020/02/03 13:09:29 martin Exp $ */ +/* $NetBSD: md.c,v 1.11 2020/10/12 16:14:36 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -145,7 +145,7 @@ md_get_info(struct install_partition_desc *install) /* * md back-end code for menu-driven BSD disklabel editor. */ -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/arch/zaurus/md.c b/usr.sbin/sysinst/arch/zaurus/md.c index 062d2ce5d1d2..005075ee9c2b 100644 --- a/usr.sbin/sysinst/arch/zaurus/md.c +++ b/usr.sbin/sysinst/arch/zaurus/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.8 2020/01/27 21:21:23 martin Exp $ */ +/* $NetBSD: md.c,v 1.9 2020/10/12 16:14:37 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -72,6 +72,7 @@ md_init_set_status(int flags) bool md_get_info(struct install_partition_desc *install) { + int res; if (pm->no_mbr || pm->no_part) return true; @@ -95,10 +96,18 @@ md_get_info(struct install_partition_desc *install) pm->dlsize = ps->size_limit; } - return set_bios_geom_with_mbr_guess(pm->parts); + res = set_bios_geom_with_mbr_guess(pm->parts); + if (res == 0) + return false; + else if (res == 1) + return true; + + pm->parts->pscheme->destroy_part_scheme(pm->parts); + pm->parts = NULL; + goto again; } -bool +int md_make_bsd_partitions(struct install_partition_desc *install) { return make_bsd_partitions(install); diff --git a/usr.sbin/sysinst/bsddisklabel.c b/usr.sbin/sysinst/bsddisklabel.c index 42443c2c2e32..dbc5ebc3fe93 100644 --- a/usr.sbin/sysinst/bsddisklabel.c +++ b/usr.sbin/sysinst/bsddisklabel.c @@ -1,4 +1,4 @@ -/* $NetBSD: bsddisklabel.c,v 1.51 2020/10/12 12:17:29 martin Exp $ */ +/* $NetBSD: bsddisklabel.c,v 1.52 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -754,6 +754,13 @@ set_keep_existing(menudesc *m, void *arg) return 0; } +static int +set_switch_scheme(menudesc *m, void *arg) +{ + ((arg_rep_int*)arg)->rv = LY_OTHERSCHEME; + return 0; +} + static int set_edit_part_sizes(menudesc *m, void *arg) { @@ -802,14 +809,14 @@ ask_layout(struct disk_partitions *parts, bool have_existing) const char *args[2]; int menu; size_t num_opts; - menu_ent options[3], *opt; + menu_ent options[4], *opt; args[0] = msg_string(parts->pscheme->name); args[1] = msg_string(parts->pscheme->short_name); ai.args.argv = args; ai.args.argc = 2; - ai.rv = LY_SETSIZES; - + ai.rv = LY_ERROR; + memset(options, 0, sizeof(options)); num_opts = 0; opt = &options[0]; @@ -833,8 +840,17 @@ ask_layout(struct disk_partitions *parts, bool have_existing) opt++; num_opts++; + if (have_existing && num_available_part_schemes > 1 && + parts->parent == NULL) { + opt->opt_name = MSG_Use_Different_Part_Scheme; + opt->opt_flags = OPT_EXIT; + opt->opt_action = set_switch_scheme; + opt++; + num_opts++; + } + menu = new_menu(MSG_Select_your_choice, options, num_opts, - -1, -10, 0, 0, MC_NOEXITOPT, NULL, NULL, NULL, NULL, NULL); + -1, -10, 0, 0, 0, NULL, NULL, NULL, NULL, MSG_cancel); if (menu != -1) { get_menudesc(menu)->expand_act = expand_all_option_texts; process_menu(menu, &ai); @@ -1692,10 +1708,10 @@ edit_with_defaults(struct disk_partitions *parts, /* * md back-end code for menu-driven BSD disklabel editor. - * returns 0 on failure, 1 on success. + * returns 0 on failure, 1 on success, -1 for restart. * fills the install target with a list for newfs/fstab. */ -bool +int make_bsd_partitions(struct install_partition_desc *install) { struct disk_partitions *parts = pm->parts; @@ -1706,16 +1722,15 @@ make_bsd_partitions(struct install_partition_desc *install) bool have_existing; if (pm && pm->no_part && parts == NULL) - return true; - + return 1; if (parts == NULL) { pscheme = select_part_scheme(pm, NULL, !pm->no_mbr, NULL); if (pscheme == NULL) - return false; + return 0; parts = pscheme->create_new_for_disk(pm->diskdev, 0, pm->dlsize, true, NULL); if (parts == NULL) - return false; + return 0; pm->parts = parts; } else { pscheme = parts->pscheme; @@ -1734,19 +1749,13 @@ make_bsd_partitions(struct install_partition_desc *install) have_existing = check_existing_netbsd(parts); /* - * Initialize global variables that track space used on this disk. + * Make sure the cylinder size multiplier/divisor and disk sieze are + * valid */ - if (pm->ptsize == 0) - pm->ptsize = pm->dlsize - pm->ptstart; - if (pm->dlsize == 0) - pm->dlsize = pm->ptstart + pm->ptsize; - - if (logfp) fprintf(logfp, "dlsize=%" PRId64 " ptsize=%" PRId64 - " ptstart=%" PRId64 "\n", - pm->dlsize, pm->ptsize, pm->ptstart); - if (pm->current_cylsize == 0) pm->current_cylsize = pm->dlcylsize; + if (pm->ptsize == 0) + pm->ptsize = pm->dlsize; /* Ask for layout type -- standard or special */ if (partman_go == 0) { @@ -1776,6 +1785,8 @@ make_bsd_partitions(struct install_partition_desc *install) bsd_size, min_size, x_size); msg_display_add("\n\n"); layoutkind = ask_layout(parts, have_existing); + if (layoutkind == LY_ERROR) + return 0; } if (layoutkind == LY_USEDEFAULT || layoutkind == LY_SETSIZES) { @@ -1787,14 +1798,17 @@ make_bsd_partitions(struct install_partition_desc *install) parts->parent->pscheme->guess_install_target( parts->parent, &p_start, &p_size); } - if (layoutkind == LY_USEDEFAULT) { + if (layoutkind == LY_OTHERSCHEME) { + parts->pscheme->destroy_part_scheme(parts); + return -1; + } else if (layoutkind == LY_USEDEFAULT) { replace_by_default(parts, p_start, p_size, &wanted); } else if (layoutkind == LY_SETSIZES) { if (!edit_with_defaults(parts, p_start, p_size, &wanted)) { free_usage_set(&wanted); - return false; + return 0; } } else { usage_set_from_parts(&wanted, parts); @@ -1889,7 +1903,7 @@ make_bsd_partitions(struct install_partition_desc *install) if (rv == 0) { msg_display(MSG_abort_part); free_usage_set(&wanted); - return false; + return 0; } /* update install infos */ install->num = wanted.num; @@ -1907,7 +1921,7 @@ make_bsd_partitions(struct install_partition_desc *install) free_usage_set(&wanted); /* Everything looks OK. */ - return true; + return 1; } #ifndef MD_NEED_BOOTBLOCK diff --git a/usr.sbin/sysinst/defs.h b/usr.sbin/sysinst/defs.h index 89d4d9909686..26dcd14f9fc2 100644 --- a/usr.sbin/sysinst/defs.h +++ b/usr.sbin/sysinst/defs.h @@ -1,4 +1,4 @@ -/* $NetBSD: defs.h,v 1.65 2020/10/09 18:33:00 martin Exp $ */ +/* $NetBSD: defs.h,v 1.66 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -103,7 +103,15 @@ const char *getfslabelname(uint, uint); #define RUN_XFER_DIR 0x0200 /* cd to xfer_dir in child */ /* for bsddisklabel.c */ -enum layout_type { LY_KEEPEXISTING, LY_SETSIZES, LY_USEDEFAULT, LY_USEFULL }; +enum layout_type { + LY_KEEPEXISTING, /* keep exisiting partitions */ + LY_OTHERSCHEME, /* delete all, select new partitioning scheme */ + LY_SETSIZES, /* edit sizes */ + LY_USEDEFAULT, /* use default sizes */ + LY_USEFULL, /* use full disk for NetBSD */ + LY_ERROR /* used for "abort" in menu */ +}; + enum setup_type { SY_NEWRAID, SY_NEWCGD, SY_NEWLVM }; /* Installation sets */ @@ -619,7 +627,8 @@ void md_init_set_status(int); /* SFLAG_foo */ /* MD functions if user selects install - in order called */ bool md_get_info(struct install_partition_desc*); -bool md_make_bsd_partitions(struct install_partition_desc*); +/* returns -1 to restart partitioning, 0 for error, 1 for success */ +int md_make_bsd_partitions(struct install_partition_desc*); bool md_check_partitions(struct install_partition_desc*); #ifdef HAVE_GPT /* @@ -786,7 +795,13 @@ int err_msg_win(const char*); const struct disk_partitioning_scheme *select_part_scheme(struct pm_devs *dev, const struct disk_partitioning_scheme *skip, bool bootable, const char *title); -bool edit_outer_parts(struct disk_partitions*); +/* + * return value: + * 0 -> abort + * 1 -> ok, continue + * -1 -> partitions have been deleted, start from scratch +*/ +int edit_outer_parts(struct disk_partitions*); bool parts_use_wholedisk(struct disk_partitions*, size_t add_ext_parts, const struct disk_part_info *ext_parts); @@ -952,7 +967,8 @@ extern int have_raid, have_vnd, have_cgd, have_lvm, have_gpt, have_dk; void check_available_binaries(void); /* from bsddisklabel.c */ -bool make_bsd_partitions(struct install_partition_desc*); +/* returns -1 to restart partitioning, 0 for error, 1 for success */ +int make_bsd_partitions(struct install_partition_desc*); void set_ptn_titles(menudesc *, int, void *); int set_ptn_size(menudesc *, void *); bool get_ptn_sizes(struct partition_usage_set*); diff --git a/usr.sbin/sysinst/disklabel.c b/usr.sbin/sysinst/disklabel.c index 24976bbdd7eb..3902001ea2e2 100644 --- a/usr.sbin/sysinst/disklabel.c +++ b/usr.sbin/sysinst/disklabel.c @@ -1,4 +1,4 @@ -/* $NetBSD: disklabel.c,v 1.40 2020/10/03 18:54:18 martin Exp $ */ +/* $NetBSD: disklabel.c,v 1.41 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 2018 The NetBSD Foundation, Inc. @@ -1259,6 +1259,14 @@ disklabel_free(struct disk_partitions *arg) free(arg); } +static void +disklabel_destroy_part_scheme(struct disk_partitions *arg) +{ + + run_program(RUN_SILENT, "disklabel -D %s", arg->disk); + free(arg); +} + const struct disk_partitioning_scheme disklabel_parts = { .name = MSG_parttype_disklabel, @@ -1297,4 +1305,5 @@ disklabel_parts = { .get_free_spaces = disklabel_get_free_spaces, .get_part_device = disklabel_get_part_device, .free = disklabel_free, + .destroy_part_scheme = disklabel_destroy_part_scheme, }; diff --git a/usr.sbin/sysinst/gpt.c b/usr.sbin/sysinst/gpt.c index bfe620cff23d..4cee660afdb5 100644 --- a/usr.sbin/sysinst/gpt.c +++ b/usr.sbin/sysinst/gpt.c @@ -1,4 +1,4 @@ -/* $NetBSD: gpt.c,v 1.19 2020/10/03 18:54:18 martin Exp $ */ +/* $NetBSD: gpt.c,v 1.20 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 2018 The NetBSD Foundation, Inc. @@ -1609,6 +1609,14 @@ gpt_free(struct disk_partitions *arg) free(parts); } +static void +gpt_destroy_part_scheme(struct disk_partitions *arg) +{ + + run_program(RUN_SILENT, "gpt destroy %s", arg->disk); + gpt_free(arg); +} + static bool gpt_custom_attribute_writable(const struct disk_partitions *arg, part_id ptn, size_t attr_no) @@ -1835,5 +1843,6 @@ gpt_parts = { .delete_partition = gpt_delete_partition, .write_to_disk = gpt_write_to_disk, .free = gpt_free, + .destroy_part_scheme = gpt_destroy_part_scheme, .cleanup = gpt_cleanup, }; diff --git a/usr.sbin/sysinst/install.c b/usr.sbin/sysinst/install.c index 029266306373..113ecc4d110f 100644 --- a/usr.sbin/sysinst/install.c +++ b/usr.sbin/sysinst/install.c @@ -1,4 +1,4 @@ -/* $NetBSD: install.c,v 1.17 2020/09/22 16:18:54 martin Exp $ */ +/* $NetBSD: install.c,v 1.18 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -153,7 +153,7 @@ void do_install(void) { int find_disks_ret; - int retcode = 0; + int retcode = 0, res; struct install_partition_desc install = {}; struct disk_partitions *parts; @@ -195,8 +195,16 @@ do_install(void) } } - if (!md_get_info(&install) || - !md_make_bsd_partitions(&install)) { + for (;;) { + if (md_get_info(&install)) { + res = md_make_bsd_partitions(&install); + if (res == -1) { + pm->parts = NULL; + continue; + } else if (res == 1) { + break; + } + } hit_enter_to_continue(MSG_abort_inst, NULL); goto error; } diff --git a/usr.sbin/sysinst/mbr.c b/usr.sbin/sysinst/mbr.c index ebf8226ea44e..8b5fa6110377 100644 --- a/usr.sbin/sysinst/mbr.c +++ b/usr.sbin/sysinst/mbr.c @@ -1,4 +1,4 @@ -/* $NetBSD: mbr.c,v 1.35 2020/10/10 18:49:27 martin Exp $ */ +/* $NetBSD: mbr.c,v 1.36 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -318,7 +318,7 @@ free_mbr_info(mbr_info_t *m) /* * To be used only on ports which cannot provide any bios geometry */ -bool +int set_bios_geom_with_mbr_guess(struct disk_partitions *parts) { int cyl, head, sec; @@ -2686,6 +2686,29 @@ mbr_free(struct disk_partitions *arg) free(parts); } +static void +mbr_destroy_part_scheme(struct disk_partitions *arg) +{ + struct mbr_disk_partitions *parts = (struct mbr_disk_partitions*)arg; + char diskpath[MAXPATHLEN]; + int fd; + + if (parts->dlabel != NULL) + parts->dlabel->pscheme->destroy_part_scheme(parts->dlabel); + fd = opendisk(arg->disk, O_RDWR, diskpath, sizeof(diskpath), 0); + if (fd != -1) { + char *buf; + + buf = calloc(arg->bytes_per_sector, 1); + if (buf != NULL) { + write(fd, buf, arg->bytes_per_sector); + free(buf); + } + close(fd); + } + mbr_free(arg); +} + static bool mbr_verify_for_update(struct disk_partitions *arg) { @@ -3177,6 +3200,7 @@ mbr_parts = { .post_edit_verify = mbr_verify, .pre_update_verify = mbr_verify_for_update, .free = mbr_free, + .destroy_part_scheme = mbr_destroy_part_scheme, }; #endif diff --git a/usr.sbin/sysinst/mbr.h b/usr.sbin/sysinst/mbr.h index deaeb2297b5b..f7958379c73f 100644 --- a/usr.sbin/sysinst/mbr.h +++ b/usr.sbin/sysinst/mbr.h @@ -1,4 +1,4 @@ -/* $NetBSD: mbr.h,v 1.5 2020/04/22 23:43:12 joerg Exp $ */ +/* $NetBSD: mbr.h,v 1.6 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 1997, 1988 Piermont Information Systems Inc. @@ -102,7 +102,8 @@ int partsoverlap(struct mbr_partition *, int, int); /* from mbr.c */ int guess_biosgeom_from_parts(struct disk_partitions*, int *, int *, int *); -bool set_bios_geom_with_mbr_guess(struct disk_partitions*); +/* same return values as edit_outer_parts() */ +int set_bios_geom_with_mbr_guess(struct disk_partitions*); void set_bios_geom(struct disk_partitions *, int *cyl, int *head, int *sec); int otherpart(int); int ourpart(int); diff --git a/usr.sbin/sysinst/msg.mi.de b/usr.sbin/sysinst/msg.mi.de index 6c8d345a7130..f670cd0fdedc 100644 --- a/usr.sbin/sysinst/msg.mi.de +++ b/usr.sbin/sysinst/msg.mi.de @@ -1,4 +1,4 @@ -/* $NetBSD: msg.mi.de,v 1.22 2020/05/18 21:19:36 jmcneill Exp $ */ +/* $NetBSD: msg.mi.de,v 1.23 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -1068,6 +1068,13 @@ message Set_Sizes {Gr */ message Use_Default_Parts {Standard-Partitionsgößen verwenden} +/* Called with: Example + * $0 = current partitioning name Master Boot Record (MBR) + * $1 = short version of $0 MBR + */ +message Use_Different_Part_Scheme +{Alles löschen, anderes Partitionierungsverfahren statt $1 verwenden} + message Gigabytes {Gigabytes} message Megabytes {Megabytes} message Cylinders {Zylinder} diff --git a/usr.sbin/sysinst/msg.mi.en b/usr.sbin/sysinst/msg.mi.en index b1a352dfd5ab..3461392941a4 100644 --- a/usr.sbin/sysinst/msg.mi.en +++ b/usr.sbin/sysinst/msg.mi.en @@ -1,4 +1,4 @@ -/* $NetBSD: msg.mi.en,v 1.30 2020/05/26 15:20:45 snj Exp $ */ +/* $NetBSD: msg.mi.en,v 1.31 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -1006,6 +1006,13 @@ message Set_Sizes {Set sizes of NetBSD partitions} */ message Use_Default_Parts {Use default partition sizes} +/* Called with: Example + * $0 = current partitioning name Master Boot Record (MBR) + * $1 = short version of $0 MBR + */ +message Use_Different_Part_Scheme +{Delete everything, use different partitions (not $1)} + message Gigabytes {Gigabytes} message Megabytes {Megabytes} message Cylinders {Cylinders} diff --git a/usr.sbin/sysinst/msg.mi.es b/usr.sbin/sysinst/msg.mi.es index 295a5b416ca8..a3b404ac611f 100644 --- a/usr.sbin/sysinst/msg.mi.es +++ b/usr.sbin/sysinst/msg.mi.es @@ -1,4 +1,4 @@ -/* $NetBSD: msg.mi.es,v 1.24 2020/05/26 15:20:45 snj Exp $ */ +/* $NetBSD: msg.mi.es,v 1.25 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -1033,6 +1033,13 @@ message Set_Sizes {Establecer los tama */ message Use_Default_Parts {Use default partition sizes} +/* Called with: Example + * $0 = current partitioning name Master Boot Record (MBR) + * $1 = short version of $0 MBR + */ +message Use_Different_Part_Scheme +{Delete everything, use different partitions (not $1)} + message Gigabytes {Gigabytes} message Megabytes {Megabytes} message Cylinders {Cilindros} diff --git a/usr.sbin/sysinst/msg.mi.fr b/usr.sbin/sysinst/msg.mi.fr index 12094de8ee6d..2f1382de80df 100644 --- a/usr.sbin/sysinst/msg.mi.fr +++ b/usr.sbin/sysinst/msg.mi.fr @@ -1,4 +1,4 @@ -/* $NetBSD: msg.mi.fr,v 1.29 2020/09/27 17:36:40 martin Exp $ */ +/* $NetBSD: msg.mi.fr,v 1.30 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -1096,6 +1096,13 @@ message Set_Sizes {Sp */ message Use_Default_Parts {Use default partition sizes} +/* Called with: Example + * $0 = current partitioning name Master Boot Record (MBR) + * $1 = short version of $0 MBR + */ +message Use_Different_Part_Scheme +{Delete everything, use different partitions (not $1)} + message Gigabytes {Gigaoctets} message Megabytes {Mégaoctets} message Cylinders {Cylindres} diff --git a/usr.sbin/sysinst/msg.mi.pl b/usr.sbin/sysinst/msg.mi.pl index 1efcc8eb110d..882c5629d8c0 100644 --- a/usr.sbin/sysinst/msg.mi.pl +++ b/usr.sbin/sysinst/msg.mi.pl @@ -1,4 +1,4 @@ -/* $NetBSD: msg.mi.pl,v 1.30 2020/05/18 21:19:36 jmcneill Exp $ */ +/* $NetBSD: msg.mi.pl,v 1.31 2020/10/12 16:14:32 martin Exp $ */ /* Based on english version: */ /* NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp */ @@ -1001,6 +1001,13 @@ message Set_Sizes {Ustaw rozmiary partycji NetBSD} */ message Use_Default_Parts {Uzyj domyslnych rozmiarow partycji} +/* Called with: Example + * $0 = current partitioning name Master Boot Record (MBR) + * $1 = short version of $0 MBR + */ +message Use_Different_Part_Scheme +{Delete everything, use different partitions (not $1)} + message Gigabytes {Gigabajty} message Megabytes {Megabajty} message Cylinders {Cylindry} diff --git a/usr.sbin/sysinst/part_edit.c b/usr.sbin/sysinst/part_edit.c index ab110192d9de..ef1f5f06dc80 100644 --- a/usr.sbin/sysinst/part_edit.c +++ b/usr.sbin/sysinst/part_edit.c @@ -1,4 +1,4 @@ -/* $NetBSD: part_edit.c,v 1.22 2020/10/12 11:23:45 martin Exp $ */ +/* $NetBSD: part_edit.c,v 1.23 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -1038,6 +1038,13 @@ set_use_entire_disk(menudesc *m, void *arg) return 0; } +static int +set_switch_scheme(menudesc *m, void *arg) +{ + ((arg_rep_int*)arg)->rv = LY_OTHERSCHEME; + return 0; +} + static enum layout_type ask_fullpart(struct disk_partitions *parts) { @@ -1045,14 +1052,15 @@ ask_fullpart(struct disk_partitions *parts) const char *args[2]; int menu; size_t num_opts; - menu_ent options[3], *opt; + menu_ent options[4], *opt; daddr_t start, size; + bool have_existing = false; args[0] = msg_string(pm->parts->pscheme->name); args[1] = msg_string(pm->parts->pscheme->short_name); ai.args.argv = args; ai.args.argc = 2; - ai.rv = LY_SETSIZES; + ai.rv = LY_ERROR; memset(options, 0, sizeof(options)); num_opts = 0; @@ -1064,6 +1072,7 @@ ask_fullpart(struct disk_partitions *parts) opt->opt_action = set_keep_existing; opt++; num_opts++; + have_existing = true; } opt->opt_name = MSG_Use_only_part_of_the_disk; opt->opt_flags = OPT_EXIT; @@ -1077,8 +1086,16 @@ ask_fullpart(struct disk_partitions *parts) opt++; num_opts++; + if (have_existing && num_available_part_schemes > 1) { + opt->opt_name = MSG_Use_Different_Part_Scheme; + opt->opt_flags = OPT_EXIT; + opt->opt_action = set_switch_scheme; + opt++; + num_opts++; + } + menu = new_menu(MSG_Select_your_choice, options, num_opts, - -1, -10, 0, 0, MC_NOEXITOPT, NULL, NULL, NULL, NULL, NULL); + -1, -10, 0, 0, 0, NULL, NULL, NULL, NULL, MSG_cancel); if (menu != -1) { get_menudesc(menu)->expand_act = expand_all_option_texts; process_menu(menu, &ai); @@ -1227,7 +1244,7 @@ ask_outer_partsizes(struct disk_partitions *parts) return data.av.rv == 0; } -bool +int edit_outer_parts(struct disk_partitions *parts) { part_id i; @@ -1236,13 +1253,13 @@ edit_outer_parts(struct disk_partitions *parts) /* If targeting a wedge, do not ask for further partitioning */ if (pm && (pm->no_part || pm->no_mbr)) - return true; + return 1; /* Make sure parts has been properly initialized */ assert(parts && parts->pscheme); if (parts->pscheme->secondary_scheme == NULL) - return true; /* no outer parts */ + return 1; /* no outer parts */ if (partman_go) { layout = LY_SETSIZES; @@ -1275,6 +1292,10 @@ edit_outer_parts(struct disk_partitions *parts) msg_display_add("\n\n"); layout = ask_fullpart(parts); + if (layout == LY_ERROR) + return 0; + else if (layout == LY_OTHERSCHEME) + return -1; } if (layout == LY_USEFULL) { @@ -1303,18 +1324,18 @@ edit_outer_parts(struct disk_partitions *parts) (void)fprintf(logfp, "User answered no to destroy " "other data, aborting.\n"); - return false; + return 0; } } if (!md_parts_use_wholedisk(parts)) { hit_enter_to_continue(MSG_No_free_space, NULL); - return false; + return 0; } if (parts->pscheme->post_edit_verify) { return parts->pscheme->post_edit_verify(parts, true) == 2; } - return true; + return 1; } else if (layout == LY_SETSIZES) { return ask_outer_partsizes(parts); } else { diff --git a/usr.sbin/sysinst/partitions.h b/usr.sbin/sysinst/partitions.h index 1dcfa219f6dd..284684518d4b 100644 --- a/usr.sbin/sysinst/partitions.h +++ b/usr.sbin/sysinst/partitions.h @@ -1,4 +1,4 @@ -/* $NetBSD: partitions.h,v 1.17 2020/10/03 18:54:18 martin Exp $ */ +/* $NetBSD: partitions.h,v 1.18 2020/10/12 16:14:32 martin Exp $ */ /* * Copyright 2018 The NetBSD Foundation, Inc. @@ -542,6 +542,9 @@ struct disk_partitioning_scheme { /* Free all the data */ void (*free)(struct disk_partitions*); + /* Wipe all on-disk state, leave blank disk - and free data */ + void (*destroy_part_scheme)(struct disk_partitions*); + /* Scheme global cleanup */ void (*cleanup)(void); };