Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sysinst PR 55536: when we find existing partition t...



details:   https://anonhg.NetBSD.org/src/rev/26d2a08f2873
branches:  trunk
changeset: 955812:26d2a08f2873
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Oct 12 16:14:32 2020 +0000

description:
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).

diffstat:

 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(-)

diffs (truncated from 1874 to 300 lines):

diff -r af5eb2917c05 -r 26d2a08f2873 usr.sbin/sysinst/arch/acorn32/md.c
--- a/usr.sbin/sysinst/arch/acorn32/md.c        Mon Oct 12 15:24:16 2020 +0000
+++ b/usr.sbin/sysinst/arch/acorn32/md.c        Mon Oct 12 16:14:32 2020 +0000
@@ -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 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 -r af5eb2917c05 -r 26d2a08f2873 usr.sbin/sysinst/arch/alpha/md.c
--- a/usr.sbin/sysinst/arch/alpha/md.c  Mon Oct 12 15:24:16 2020 +0000
+++ b/usr.sbin/sysinst/arch/alpha/md.c  Mon Oct 12 16:14:32 2020 +0000
@@ -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 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 -r af5eb2917c05 -r 26d2a08f2873 usr.sbin/sysinst/arch/amiga/md.c
--- a/usr.sbin/sysinst/arch/amiga/md.c  Mon Oct 12 15:24:16 2020 +0000
+++ b/usr.sbin/sysinst/arch/amiga/md.c  Mon Oct 12 16:14:32 2020 +0000
@@ -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 back-end code for menu-driven BSD disklabel editor.
  */
-bool
+int
 md_make_bsd_partitions(struct install_partition_desc *install)
 {
        return 1;
diff -r af5eb2917c05 -r 26d2a08f2873 usr.sbin/sysinst/arch/arc/md.c
--- a/usr.sbin/sysinst/arch/arc/md.c    Mon Oct 12 15:24:16 2020 +0000
+++ b/usr.sbin/sysinst/arch/arc/md.c    Mon Oct 12 16:14:32 2020 +0000
@@ -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 @@
 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 @@
                        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 -r af5eb2917c05 -r 26d2a08f2873 usr.sbin/sysinst/arch/atari/md.c
--- a/usr.sbin/sysinst/arch/atari/md.c  Mon Oct 12 15:24:16 2020 +0000
+++ b/usr.sbin/sysinst/arch/atari/md.c  Mon Oct 12 16:14:32 2020 +0000
@@ -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 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 -r af5eb2917c05 -r 26d2a08f2873 usr.sbin/sysinst/arch/bebox/md.c
--- a/usr.sbin/sysinst/arch/bebox/md.c  Mon Oct 12 15:24:16 2020 +0000
+++ b/usr.sbin/sysinst/arch/bebox/md.c  Mon Oct 12 16:14:32 2020 +0000
@@ -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 @@
 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 @@
                        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 -r af5eb2917c05 -r 26d2a08f2873 usr.sbin/sysinst/arch/cats/md.c
--- a/usr.sbin/sysinst/arch/cats/md.c   Mon Oct 12 15:24:16 2020 +0000
+++ b/usr.sbin/sysinst/arch/cats/md.c   Mon Oct 12 16:14:32 2020 +0000
@@ -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 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 -r af5eb2917c05 -r 26d2a08f2873 usr.sbin/sysinst/arch/cobalt/md.c
--- a/usr.sbin/sysinst/arch/cobalt/md.c Mon Oct 12 15:24:16 2020 +0000
+++ b/usr.sbin/sysinst/arch/cobalt/md.c Mon Oct 12 16:14:32 2020 +0000
@@ -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 @@
 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 @@
                        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 -r af5eb2917c05 -r 26d2a08f2873 usr.sbin/sysinst/arch/dummy/md.c
--- a/usr.sbin/sysinst/arch/dummy/md.c  Mon Oct 12 15:24:16 2020 +0000
+++ b/usr.sbin/sysinst/arch/dummy/md.c  Mon Oct 12 16:14:32 2020 +0000
@@ -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 @@
        return true;
 }
 
-bool
+int
 md_make_bsd_partitions(struct install_partition_desc *desc)
 {
        return make_bsd_partitions(desc);
diff -r af5eb2917c05 -r 26d2a08f2873 usr.sbin/sysinst/arch/emips/md.c
--- a/usr.sbin/sysinst/arch/emips/md.c  Mon Oct 12 15:24:16 2020 +0000
+++ b/usr.sbin/sysinst/arch/emips/md.c  Mon Oct 12 16:14:32 2020 +0000
@@ -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 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 -r af5eb2917c05 -r 26d2a08f2873 usr.sbin/sysinst/arch/evbarm/md.c
--- a/usr.sbin/sysinst/arch/evbarm/md.c Mon Oct 12 15:24:16 2020 +0000
+++ b/usr.sbin/sysinst/arch/evbarm/md.c Mon Oct 12 16:14:32 2020 +0000
@@ -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 @@
 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 @@
                        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;



Home | Main Index | Thread Index | Old Index