Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sysinst Make cloning support optional, so we can sa...
details: https://anonhg.NetBSD.org/src/rev/338e6d423abd
branches: trunk
changeset: 461032:338e6d423abd
user: martin <martin%NetBSD.org@localhost>
date: Wed Nov 13 18:57:26 2019 +0000
description:
Make cloning support optional, so we can save some space on very small
install media.
diffstat:
usr.sbin/sysinst/Makefile.inc | 5 ++++-
usr.sbin/sysinst/bsddisklabel.c | 32 ++++++++++++++++++++++++++++----
usr.sbin/sysinst/defs.h | 7 ++++++-
usr.sbin/sysinst/disks.c | 5 ++++-
usr.sbin/sysinst/install.c | 6 +++++-
usr.sbin/sysinst/label.c | 21 +++++++++++++++++----
usr.sbin/sysinst/part_edit.c | 23 +++++++++++++++++++----
usr.sbin/sysinst/util.c | 4 +++-
8 files changed, 86 insertions(+), 17 deletions(-)
diffs (truncated from 459 to 300 lines):
diff -r c8a68836b3ef -r 338e6d423abd usr.sbin/sysinst/Makefile.inc
--- a/usr.sbin/sysinst/Makefile.inc Wed Nov 13 17:59:56 2019 +0000
+++ b/usr.sbin/sysinst/Makefile.inc Wed Nov 13 18:57:26 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.28 2019/10/31 09:44:13 martin Exp $
+# $NetBSD: Makefile.inc,v 1.29 2019/11/13 18:57:26 martin Exp $
#
# Makefile for sysinst
@@ -43,6 +43,9 @@
CPPFLAGS+= -DHAVE_MBR
SRCS+= mbr.c
.endif
+.if ${NO_CLONES:Uno} == "yes"
+CPPFLAGS+= -DNO_CLONES
+.endif
MSG_MD?= msg.md.${SYSINSTLANG}
MENUS_MD?= menus.md.${SYSINSTLANG}
diff -r c8a68836b3ef -r 338e6d423abd usr.sbin/sysinst/bsddisklabel.c
--- a/usr.sbin/sysinst/bsddisklabel.c Wed Nov 13 17:59:56 2019 +0000
+++ b/usr.sbin/sysinst/bsddisklabel.c Wed Nov 13 18:57:26 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bsddisklabel.c,v 1.30 2019/11/12 16:33:14 martin Exp $ */
+/* $NetBSD: bsddisklabel.c,v 1.31 2019/11/13 18:57:26 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -251,11 +251,13 @@
mount = swap;
} else if (pset->infos[opt].mount[0]) {
mount = pset->infos[opt].mount;
+#ifndef NO_CLONES
} else if (pset->infos[opt].flags & PUIFLG_CLONE_PARTS) {
snprintf(swap, sizeof swap, "%zu %s",
pset->infos[opt].clone_src->num_sel,
msg_string(MSG_clone_target_disp));
mount = swap;
+#endif
} else {
mount = NULL;
if (pset->infos[opt].parts->pscheme->other_partition_identifier
@@ -353,6 +355,7 @@
return -1;
}
+#ifndef NO_CLONES
static int
inst_ext_clone(menudesc *menu, void *arg)
{
@@ -430,6 +433,7 @@
free_selected_partitions(&selected);
return 0;
}
+#endif
static size_t
fill_ptn_menu(struct partition_usage_set *pset)
@@ -440,7 +444,14 @@
size_t i;
daddr_t free_space;
- memset(pset->menu_opts, 0, (pset->num+4)*sizeof(*pset->menu_opts));
+#ifdef NO_CLONES
+#define ADD_ITEMS 3
+#else
+#define ADD_ITEMS 4
+#endif
+
+ memset(pset->menu_opts, 0, (pset->num+ADD_ITEMS)
+ *sizeof(*pset->menu_opts));
for (m = pset->menu_opts, p = pset->infos, i = 0; i < pset->num;
m++, p++, i++) {
if (p->flags & PUIFLG_CLONE_PARTS)
@@ -457,9 +468,11 @@
m->opt_action = add_other_ptn_size;
m++;
+#ifndef NO_CLONES
m->opt_name = MSG_clone_from_elsewhere;
m->opt_action = inst_ext_clone;
m++;
+#endif
m->opt_name = MSG_askunits;
m->opt_menu = MENU_sizechoice;
@@ -1136,6 +1149,7 @@
pset->infos = infos;
}
+#ifndef NO_CLONES
/*
* Convert clone entries with more than one source into
* several entries with a single source each.
@@ -1188,6 +1202,7 @@
free(*infos);
*infos = ui;
}
+#endif
static void
apply_settings_to_partitions(struct pm_devs *p, struct disk_partitions *parts,
@@ -1195,13 +1210,18 @@
{
size_t i, exp_ndx = ~0U;
daddr_t planned_space = 0, nsp, from, align;
- struct disk_part_info *infos, cinfo, srcinfo;
+ struct disk_part_info *infos;
+#ifndef NO_CLONES
+ struct disk_part_info cinfo, srcinfo;
+ struct selected_partition *sp;
+#endif
struct disk_part_free_space space;
struct disk_partitions *ps = NULL;
- struct selected_partition *sp;
part_id pno, new_part_id;
+#ifndef NO_CLONES
normalize_clones(&wanted->infos, &wanted->num);
+#endif
infos = calloc(wanted->num, sizeof(*infos));
if (infos == NULL) {
@@ -1329,6 +1349,7 @@
continue;
if (want->flags & (PUIFLG_JUST_MOUNTPOINT|PUIFLG_IS_OUTER))
continue;
+#ifndef NO_CLONES
if ((want->flags & PUIFLG_CLONE_PARTS) &&
want->clone_src != NULL &&
want->clone_ndx < want->clone_src->num_sel) {
@@ -1358,6 +1379,9 @@
new_part_id = wanted->parts->pscheme->add_partition(
wanted->parts, &infos[i], NULL);
} else {
+#else
+ {
+#endif
if (want->size <= 0)
continue;
size_t cnt = wanted->parts->pscheme->get_free_spaces(
diff -r c8a68836b3ef -r 338e6d423abd usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h Wed Nov 13 17:59:56 2019 +0000
+++ b/usr.sbin/sysinst/defs.h Wed Nov 13 18:57:26 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.46 2019/11/12 16:33:14 martin Exp $ */
+/* $NetBSD: defs.h,v 1.47 2019/11/13 18:57:26 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -283,6 +283,7 @@
unsigned int instflags; /* installer handling flags */
uint fs_type, fs_version; /* e.g. FS_LFS, or FS_BSDFS,
* version = 2 for FFSv2 */
+#ifndef NO_CLONES
/*
* Only != NULL when PUIFLG_CLONE_PARTS is set, describes the
* source partitions to clone here.
@@ -294,6 +295,7 @@
* (>= 0 && <= clone_src->num_sel, or all of them if clone_ndx = ~0U.
*/
size_t clone_ndx;
+#endif
};
/*
@@ -619,6 +621,8 @@
bool is_bootable_device(const char *dev);
bool is_partitionable_device(const char *dev);
bool convert_scheme(struct pm_devs *p, bool is_boot_drive, const char **err_msg);
+
+#ifndef NO_CLONES
/* a single partition selected for cloning (etc) */
struct selected_partition {
struct disk_partitions *parts;
@@ -643,6 +647,7 @@
int clone_target_select(menudesc *m, void *arg);
bool clone_partition_data(struct disk_partitions *dest_parts, part_id did,
struct disk_partitions *src_parts, part_id sid);
+#endif
struct menudesc;
void disp_cur_fspart(int, int);
diff -r c8a68836b3ef -r 338e6d423abd usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c Wed Nov 13 17:59:56 2019 +0000
+++ b/usr.sbin/sysinst/disks.c Wed Nov 13 18:57:26 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disks.c,v 1.55 2019/11/12 16:33:14 martin Exp $ */
+/* $NetBSD: disks.c,v 1.56 2019/11/13 18:57:26 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -2046,6 +2046,7 @@
return dkwl.dkwl_nwedges;
}
+#ifndef NO_CLONES
/*
* Helper structures used in the partition select menu
*/
@@ -2514,3 +2515,5 @@
"progress -f %s -b 1m dd bs=1m of=%s",
src_dev, target_dev) == 0;
}
+#endif
+
diff -r c8a68836b3ef -r 338e6d423abd usr.sbin/sysinst/install.c
--- a/usr.sbin/sysinst/install.c Wed Nov 13 17:59:56 2019 +0000
+++ b/usr.sbin/sysinst/install.c Wed Nov 13 18:57:26 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: install.c,v 1.12 2019/11/12 16:33:14 martin Exp $ */
+/* $NetBSD: install.c,v 1.13 2019/11/13 18:57:26 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -50,7 +50,9 @@
write_all_parts(struct install_partition_desc *install)
{
struct disk_partitions **allparts, *parts;
+#ifndef NO_CLONES
struct selected_partition *src;
+#endif
size_t num_parts, i, j;
bool found, res;
@@ -100,6 +102,7 @@
/* phase 3: now we may have a first chance to enable swap space */
set_swap_if_low_ram(install);
+#ifndef NO_CLONES
/* phase 4: copy any cloned partitions data (if requested) */
for (i = 0; i < install->num; i++) {
if ((install->infos[i].flags & PUIFLG_CLONE_PARTS) == 0
@@ -112,6 +115,7 @@
install->infos[i].cur_part_id,
src->parts, src->id);
}
+#endif
/* phase 5: post disklabel (used for updating boot loaders) */
for (i = 0; i < num_parts; i++) {
diff -r c8a68836b3ef -r 338e6d423abd usr.sbin/sysinst/label.c
--- a/usr.sbin/sysinst/label.c Wed Nov 13 17:59:56 2019 +0000
+++ b/usr.sbin/sysinst/label.c Wed Nov 13 18:57:26 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: label.c,v 1.13 2019/11/12 16:33:14 martin Exp $ */
+/* $NetBSD: label.c,v 1.14 2019/11/13 18:57:26 martin Exp $ */
/*
* Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.13 2019/11/12 16:33:14 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.14 2019/11/13 18:57:26 martin Exp $");
#endif
#include <sys/types.h>
@@ -1187,12 +1187,15 @@
static const char *Yes;
char flag_str[MENUSTRSIZE], *fp;
unsigned inst_flags;
+#ifndef NO_CLONES
size_t clone_cnt;
+#endif
bool with_inst_flag = pset->parts->parent == NULL;
if (Yes == NULL)
Yes = msg_string(MSG_Yes);
+#ifndef NO_CLONES
if ((pset->infos[ptn].flags & PUIFLG_CLONE_PARTS) &&
pset->infos[ptn].cur_part_id == NO_PART) {
psize = pset->infos[ptn].size / sizemult;
@@ -1220,6 +1223,7 @@
m->opts[ptn].opt_flags &= ~OPT_IGNORE;
return;
}
+#endif
if (!real_partition(pset, ptn))
return;
@@ -1296,6 +1300,7 @@
info.last_mounted[0] ? info.last_mounted : "");
}
+#ifndef NO_CLONES
static int
part_ext_clone(menudesc *m, void *arg)
{
@@ -1442,6 +1447,7 @@
free_selected_partitions(&selected);
return 0;
}
+#endif
static int
edit_fspart_pack(menudesc *m, void *arg)
@@ -1594,8 +1600,13 @@
Home |
Main Index |
Thread Index |
Old Index