Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sysinst Add an (expert) option to manually edit par...
details: https://anonhg.NetBSD.org/src/rev/4c9fe1cceba9
branches: trunk
changeset: 372645:4c9fe1cceba9
user: martin <martin%NetBSD.org@localhost>
date: Thu Dec 15 15:32:04 2022 +0000
description:
Add an (expert) option to manually edit partitions, inspired by PR 57100.
diffstat:
usr.sbin/sysinst/bsddisklabel.c | 30 ++++++++++++++++++++++++++++--
usr.sbin/sysinst/defs.h | 5 ++++-
usr.sbin/sysinst/msg.mi.de | 8 +++++++-
usr.sbin/sysinst/msg.mi.en | 8 +++++++-
usr.sbin/sysinst/msg.mi.es | 8 +++++++-
usr.sbin/sysinst/msg.mi.fr | 8 +++++++-
usr.sbin/sysinst/msg.mi.pl | 8 +++++++-
usr.sbin/sysinst/util.c | 12 +++++++++++-
8 files changed, 78 insertions(+), 9 deletions(-)
diffs (227 lines):
diff -r 0d87add4c209 -r 4c9fe1cceba9 usr.sbin/sysinst/bsddisklabel.c
--- a/usr.sbin/sysinst/bsddisklabel.c Thu Dec 15 15:29:51 2022 +0000
+++ b/usr.sbin/sysinst/bsddisklabel.c Thu Dec 15 15:32:04 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bsddisklabel.c,v 1.68 2022/12/15 15:11:44 martin Exp $ */
+/* $NetBSD: bsddisklabel.c,v 1.69 2022/12/15 15:32:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -779,6 +779,13 @@
return 0;
}
+static int
+set_use_empty_parts(menudesc *m, void *arg)
+{
+ ((arg_rep_int*)arg)->rv = LY_USENONE;
+ return 0;
+}
+
/*
* Check if there is a reasonable pre-existing partition for
* NetBSD.
@@ -813,7 +820,7 @@
const char *args[2];
int menu;
size_t num_opts;
- menu_ent options[4], *opt;
+ menu_ent options[5], *opt;
args[0] = msg_string(parts->pscheme->name);
args[1] = msg_string(parts->pscheme->short_name);
@@ -844,6 +851,12 @@
opt++;
num_opts++;
+ opt->opt_name = MSG_Use_Empty_Parts;
+ opt->opt_flags = OPT_EXIT;
+ opt->opt_action = set_use_empty_parts;
+ opt++;
+ num_opts++;
+
if (num_available_part_schemes > 1 &&
parts->parent == NULL) {
opt->opt_name = MSG_Use_Different_Part_Scheme;
@@ -1833,6 +1846,19 @@
if (layoutkind == LY_OTHERSCHEME) {
parts->pscheme->destroy_part_scheme(parts);
return -1;
+ } else if (layoutkind == LY_USENONE) {
+ struct disk_part_free_space space;
+ size_t cnt;
+
+ empty_usage_set_from_parts(&wanted, parts);
+ cnt = parts->pscheme->get_free_spaces(parts, &space, 1,
+ 0, parts->pscheme->get_part_alignment(parts), 0, -1);
+ p_start = p_size = 0;
+ if (cnt == 1) {
+ p_start = space.start;
+ p_size = space.size;
+ wanted.cur_free_space = space.size;
+ }
} else if (layoutkind == LY_USEDEFAULT) {
replace_by_default(parts, p_start, p_size,
&wanted);
diff -r 0d87add4c209 -r 4c9fe1cceba9 usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h Thu Dec 15 15:29:51 2022 +0000
+++ b/usr.sbin/sysinst/defs.h Thu Dec 15 15:32:04 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.87 2022/07/11 15:12:24 martin Exp $ */
+/* $NetBSD: defs.h,v 1.88 2022/12/15 15:32:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -117,6 +117,7 @@
LY_SETSIZES, /* edit sizes */
LY_USEDEFAULT, /* use default sizes */
LY_USEFULL, /* use full disk for NetBSD */
+ LY_USENONE, /* start with empty partitions, manual mode */
LY_ERROR /* used for "abort" in menu */
};
@@ -894,6 +895,8 @@
const char *safectime(time_t *);
bool use_tgz_for_set(const char*);
const char *set_postfix(const char*);
+bool empty_usage_set_from_parts(struct partition_usage_set*,
+ struct disk_partitions*);
bool usage_set_from_parts(struct partition_usage_set*,
struct disk_partitions*);
bool usage_set_from_install_desc(struct partition_usage_set*,
diff -r 0d87add4c209 -r 4c9fe1cceba9 usr.sbin/sysinst/msg.mi.de
--- a/usr.sbin/sysinst/msg.mi.de Thu Dec 15 15:29:51 2022 +0000
+++ b/usr.sbin/sysinst/msg.mi.de Thu Dec 15 15:32:04 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.mi.de,v 1.42 2022/11/30 15:53:35 martin Exp $ */
+/* $NetBSD: msg.mi.de,v 1.43 2022/12/15 15:32:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -1109,6 +1109,12 @@
*/
message Use_Default_Parts {Standard-Partitionsgößen verwenden}
+/* Called with: Example
+ * $0 = partitioning name Master Boot Record (MBR)
+ * $1 = short version of $0 MBR
+ */
+message Use_Empty_Parts {Partitionen frei definieren}
+
/* Called with: Example
* $0 = current partitioning name Master Boot Record (MBR)
* $1 = short version of $0 MBR
diff -r 0d87add4c209 -r 4c9fe1cceba9 usr.sbin/sysinst/msg.mi.en
--- a/usr.sbin/sysinst/msg.mi.en Thu Dec 15 15:29:51 2022 +0000
+++ b/usr.sbin/sysinst/msg.mi.en Thu Dec 15 15:32:04 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.mi.en,v 1.45 2022/11/30 15:53:35 martin Exp $ */
+/* $NetBSD: msg.mi.en,v 1.46 2022/12/15 15:32:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -1044,6 +1044,12 @@
message Use_Default_Parts {Use default partition sizes}
/* Called with: Example
+ * $0 = partitioning name Master Boot Record (MBR)
+ * $1 = short version of $0 MBR
+ */
+message Use_Empty_Parts {Manually define partitions}
+
+/* Called with: Example
* $0 = current partitioning name Master Boot Record (MBR)
* $1 = short version of $0 MBR
*/
diff -r 0d87add4c209 -r 4c9fe1cceba9 usr.sbin/sysinst/msg.mi.es
--- a/usr.sbin/sysinst/msg.mi.es Thu Dec 15 15:29:51 2022 +0000
+++ b/usr.sbin/sysinst/msg.mi.es Thu Dec 15 15:32:04 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.mi.es,v 1.38 2022/11/30 15:53:35 martin Exp $ */
+/* $NetBSD: msg.mi.es,v 1.39 2022/12/15 15:32:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -1071,6 +1071,12 @@
message Use_Default_Parts {Use default partition sizes}
/* Called with: Example
+ * $0 = partitioning name Master Boot Record (MBR)
+ * $1 = short version of $0 MBR
+ */
+message Use_Empty_Parts {Manually define partitions}
+
+/* Called with: Example
* $0 = current partitioning name Master Boot Record (MBR)
* $1 = short version of $0 MBR
*/
diff -r 0d87add4c209 -r 4c9fe1cceba9 usr.sbin/sysinst/msg.mi.fr
--- a/usr.sbin/sysinst/msg.mi.fr Thu Dec 15 15:29:51 2022 +0000
+++ b/usr.sbin/sysinst/msg.mi.fr Thu Dec 15 15:32:04 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.mi.fr,v 1.43 2022/11/30 15:53:35 martin Exp $ */
+/* $NetBSD: msg.mi.fr,v 1.44 2022/12/15 15:32:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -1121,6 +1121,12 @@
message Use_Default_Parts {Use default partition sizes}
/* Called with: Example
+ * $0 = partitioning name Master Boot Record (MBR)
+ * $1 = short version of $0 MBR
+ */
+message Use_Empty_Parts {Manually define partitions}
+
+/* Called with: Example
* $0 = current partitioning name Master Boot Record (MBR)
* $1 = short version of $0 MBR
*/
diff -r 0d87add4c209 -r 4c9fe1cceba9 usr.sbin/sysinst/msg.mi.pl
--- a/usr.sbin/sysinst/msg.mi.pl Thu Dec 15 15:29:51 2022 +0000
+++ b/usr.sbin/sysinst/msg.mi.pl Thu Dec 15 15:32:04 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.mi.pl,v 1.44 2022/11/30 15:53:35 martin Exp $ */
+/* $NetBSD: msg.mi.pl,v 1.45 2022/12/15 15:32:04 martin Exp $ */
/* Based on english version: */
/* NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp */
@@ -1037,6 +1037,12 @@
message Use_Default_Parts {Uzyj domyslnych rozmiarow partycji}
/* Called with: Example
+ * $0 = partitioning name Master Boot Record (MBR)
+ * $1 = short version of $0 MBR
+ */
+message Use_Empty_Parts {Manually define partitions}
+
+/* Called with: Example
* $0 = current partitioning name Master Boot Record (MBR)
* $1 = short version of $0 MBR
*/
diff -r 0d87add4c209 -r 4c9fe1cceba9 usr.sbin/sysinst/util.c
--- a/usr.sbin/sysinst/util.c Thu Dec 15 15:29:51 2022 +0000
+++ b/usr.sbin/sysinst/util.c Thu Dec 15 15:32:04 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.69 2022/07/10 10:52:41 martin Exp $ */
+/* $NetBSD: util.c,v 1.70 2022/12/15 15:32:04 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -2459,6 +2459,16 @@
}
bool
+empty_usage_set_from_parts(struct partition_usage_set *wanted,
+ struct disk_partitions *parts)
+{
+ memset(wanted, 0, sizeof(*wanted));
+ wanted->parts = parts;
+
+ return true;
+}
+
+bool
usage_set_from_parts(struct partition_usage_set *wanted,
struct disk_partitions *parts)
{
Home |
Main Index |
Thread Index |
Old Index