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).
This commit is contained in:
martin 2020-10-12 16:14:32 +00:00
parent f476d77f98
commit 957b5cd6f4
55 changed files with 458 additions and 161 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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)
{

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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);

View File

@ -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);

View File

@ -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)
{

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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)
{

View File

@ -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;
}
/*

View File

@ -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);

View File

@ -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);

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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));

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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*);

View File

@ -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,
};

View File

@ -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,
};

View File

@ -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;
}

View File

@ -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

View File

@ -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);

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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 {

View File

@ -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);
};