Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sysinst Rework internal data structures and "interf...
details: https://anonhg.NetBSD.org/src/rev/6bfe85a9d6c1
branches: trunk
changeset: 451920:6bfe85a9d6c1
user: martin <martin%NetBSD.org@localhost>
date: Wed Jun 12 06:20:17 2019 +0000
description:
Rework internal data structures and "interfaces to user interface" functions
to get rid of all disklabel assumptions.
Previously (even for GPT partitioning) struct disklabel was used, which
obviously breaks large disk setups. Also many MD parts and parts of the
user interface assumed (a) a struct disklabel is used internally to
store partitioning information and (b) partitions are named 'a' ... $MAXPART.
Get rid of this and replace it with a quite abstract interface that should
be able to deal with all variants in partition storage:
- partitions are stored in a (partly abstract) struct disk_partitions
and most parts of it are only accessed via accessor functions provided
by a "partitioning scheme".
- implement partitioning schemes for MBR, disklabel and GPT (with likely
RDB [amiga] and Apple Partition Map [mac*] to follow soon)
- partitioning schemes may be cascaded, e.g. on x86 when using MBR as
"outer partitions", we have disklabel as "inner partitions".
- all user interface goes via accessor functions in the partitioning scheme,
some of which return pointers to special user interface descriptors
(e.g. to allow editing partition flags, which are scheme specific)
Overall the user interface changes (in this initial step) are minimal but
noticable. A new Anita is needed for automatic test setups - many thanks
to Andreas Gustafsson for lots of early testing and a new Anita version,
and to Manuel Bouyer for cooperation and tests of the Anita release.
This work was sponsored by The NetBSD Foundation, Inc.
diffstat:
usr.sbin/sysinst/Makefile.inc | 57 +-
usr.sbin/sysinst/aout2elf.c | 8 +-
usr.sbin/sysinst/arch/acorn32/md.c | 70 +-
usr.sbin/sysinst/arch/alpha/md.c | 68 +-
usr.sbin/sysinst/arch/amd64/Makefile | 5 +-
usr.sbin/sysinst/arch/amd64/md.h | 7 +-
usr.sbin/sysinst/arch/amiga/md.c | 67 +-
usr.sbin/sysinst/arch/arc/Makefile | 5 +-
usr.sbin/sysinst/arch/arc/md.c | 314 +-
usr.sbin/sysinst/arch/arc/md.h | 22 +-
usr.sbin/sysinst/arch/atari/Makefile | 3 +-
usr.sbin/sysinst/arch/atari/md.c | 76 +-
usr.sbin/sysinst/arch/bebox/Makefile | 5 +-
usr.sbin/sysinst/arch/bebox/md.c | 93 +-
usr.sbin/sysinst/arch/cats/md.c | 74 +-
usr.sbin/sysinst/arch/cobalt/Makefile | 5 +-
usr.sbin/sysinst/arch/cobalt/md.c | 313 +-
usr.sbin/sysinst/arch/cobalt/md.h | 23 +-
usr.sbin/sysinst/arch/dummy/md.c | 8 +-
usr.sbin/sysinst/arch/emips/md.c | 66 +-
usr.sbin/sysinst/arch/evbarm/Makefile | 5 +-
usr.sbin/sysinst/arch/evbarm/md.c | 221 +-
usr.sbin/sysinst/arch/evbarm/md.h | 16 +-
usr.sbin/sysinst/arch/evbmips/Makefile | 5 +-
usr.sbin/sysinst/arch/evbmips/md.c | 90 +-
usr.sbin/sysinst/arch/evbppc/Makefile | 5 +-
usr.sbin/sysinst/arch/evbppc/md.c | 94 +-
usr.sbin/sysinst/arch/evbsh3/md.c | 67 +-
usr.sbin/sysinst/arch/ews4800mips/md.c | 93 +-
usr.sbin/sysinst/arch/ews4800mips/md.h | 14 +-
usr.sbin/sysinst/arch/hp300/md.c | 102 +-
usr.sbin/sysinst/arch/hp300/md.h | 8 +-
usr.sbin/sysinst/arch/hp300/msg.md.en | 8 +-
usr.sbin/sysinst/arch/hpcarm/Makefile | 5 +-
usr.sbin/sysinst/arch/hpcarm/md.c | 92 +-
usr.sbin/sysinst/arch/hpcmips/Makefile | 5 +-
usr.sbin/sysinst/arch/hpcmips/md.c | 97 +-
usr.sbin/sysinst/arch/hpcsh/Makefile | 5 +-
usr.sbin/sysinst/arch/hpcsh/md.c | 88 +-
usr.sbin/sysinst/arch/hppa/md.c | 80 +-
usr.sbin/sysinst/arch/i386/Makefile | 5 +-
usr.sbin/sysinst/arch/i386/md.c | 654 ++--
usr.sbin/sysinst/arch/i386/md.h | 6 +-
usr.sbin/sysinst/arch/landisk/Makefile | 5 +-
usr.sbin/sysinst/arch/landisk/md.c | 97 +-
usr.sbin/sysinst/arch/luna68k/md.c | 109 +-
usr.sbin/sysinst/arch/luna68k/md.h | 13 +-
usr.sbin/sysinst/arch/mac68k/Makefile | 8 +-
usr.sbin/sysinst/arch/mac68k/md.c | 92 +-
usr.sbin/sysinst/arch/mac68k/menus.md.de | 4 +-
usr.sbin/sysinst/arch/mac68k/menus.md.en | 4 +-
usr.sbin/sysinst/arch/mac68k/menus.md.es | 4 +-
usr.sbin/sysinst/arch/mac68k/menus.md.pl | 4 +-
usr.sbin/sysinst/arch/mac68k/msg.md.de | 10 +-
usr.sbin/sysinst/arch/mac68k/msg.md.en | 10 +-
usr.sbin/sysinst/arch/mac68k/msg.md.es | 10 +-
usr.sbin/sysinst/arch/mac68k/msg.md.pl | 10 +-
usr.sbin/sysinst/arch/macppc/md.c | 68 +-
usr.sbin/sysinst/arch/mipsco/md.c | 65 +-
usr.sbin/sysinst/arch/mvme68k/md.c | 100 +-
usr.sbin/sysinst/arch/news68k/md.c | 66 +-
usr.sbin/sysinst/arch/newsmips/md.c | 65 +-
usr.sbin/sysinst/arch/ofppc/Makefile | 5 +-
usr.sbin/sysinst/arch/ofppc/md.c | 263 +-
usr.sbin/sysinst/arch/ofppc/md.h | 26 +-
usr.sbin/sysinst/arch/playstation2/Makefile | 5 +-
usr.sbin/sysinst/arch/playstation2/md.c | 142 +-
usr.sbin/sysinst/arch/pmax/md.c | 67 +-
usr.sbin/sysinst/arch/prep/Makefile | 5 +-
usr.sbin/sysinst/arch/prep/md.c | 177 +-
usr.sbin/sysinst/arch/prep/md.h | 15 +-
usr.sbin/sysinst/arch/sandpoint/Makefile | 5 +-
usr.sbin/sysinst/arch/sandpoint/md.c | 95 +-
usr.sbin/sysinst/arch/sgimips/md.c | 70 +-
usr.sbin/sysinst/arch/sgimips/md.h | 11 +-
usr.sbin/sysinst/arch/shark/md.c | 82 +-
usr.sbin/sysinst/arch/sparc/md.c | 110 +-
usr.sbin/sysinst/arch/sparc64/md.c | 110 +-
usr.sbin/sysinst/arch/sparc64/md.h | 6 +-
usr.sbin/sysinst/arch/vax/md.c | 66 +-
usr.sbin/sysinst/arch/x68k/md.c | 100 +-
usr.sbin/sysinst/arch/zaurus/Makefile | 5 +-
usr.sbin/sysinst/arch/zaurus/md.c | 94 +-
usr.sbin/sysinst/bsddisklabel.c | 1705 +++++++++---
usr.sbin/sysinst/configmenu.c | 21 +-
usr.sbin/sysinst/defs.h | 534 ++-
usr.sbin/sysinst/defsizes.h | 16 +-
usr.sbin/sysinst/disklabel.c | 987 +++++++
usr.sbin/sysinst/disks.c | 1022 +++---
usr.sbin/sysinst/geom.c | 23 +-
usr.sbin/sysinst/gpt.c | 1556 +++++++++++
usr.sbin/sysinst/gpt_uuid.c | 4 +
usr.sbin/sysinst/install.c | 133 +-
usr.sbin/sysinst/label.c | 2173 +++++++++++----
usr.sbin/sysinst/main.c | 41 +-
usr.sbin/sysinst/mbr.c | 3587 ++++++++++++++++----------
usr.sbin/sysinst/mbr.h | 46 +-
usr.sbin/sysinst/menus.mbr | 40 -
usr.sbin/sysinst/menus.mi | 213 +-
usr.sbin/sysinst/menus.pm | 154 +-
usr.sbin/sysinst/msg.mbr.de | 160 +-
usr.sbin/sysinst/msg.mbr.en | 155 +-
usr.sbin/sysinst/msg.mbr.es | 156 +-
usr.sbin/sysinst/msg.mbr.fr | 154 +-
usr.sbin/sysinst/msg.mbr.pl | 151 +-
usr.sbin/sysinst/msg.mi.de | 689 +++-
usr.sbin/sysinst/msg.mi.en | 676 +++-
usr.sbin/sysinst/msg.mi.es | 666 +++-
usr.sbin/sysinst/msg.mi.fr | 671 +++-
usr.sbin/sysinst/msg.mi.pl | 658 +++-
usr.sbin/sysinst/msg.pm.de | 155 +
usr.sbin/sysinst/msg.pm.en | 157 +
usr.sbin/sysinst/msg.pm.es | 156 +
usr.sbin/sysinst/msg.pm.fr | 156 +
usr.sbin/sysinst/msg.pm.pl | 156 +
usr.sbin/sysinst/net.c | 6 +-
usr.sbin/sysinst/part_edit.c | 1308 +++++++++
usr.sbin/sysinst/partitions.c | 142 +
usr.sbin/sysinst/partitions.h | 531 +++
usr.sbin/sysinst/partman.c | 1651 ++++++-----
usr.sbin/sysinst/savenewlabel.c | 138 -
usr.sbin/sysinst/sizemultname.c | 33 +-
usr.sbin/sysinst/target.c | 70 +-
usr.sbin/sysinst/upgrade.c | 50 +-
usr.sbin/sysinst/util.c | 277 +-
usr.sbin/sysinst/wskbd.c | 13 +-
126 files changed, 18146 insertions(+), 8501 deletions(-)
diffs (truncated from 36254 to 300 lines):
diff -r 009e49917e5f -r 6bfe85a9d6c1 usr.sbin/sysinst/Makefile.inc
--- a/usr.sbin/sysinst/Makefile.inc Wed Jun 12 04:20:18 2019 +0000
+++ b/usr.sbin/sysinst/Makefile.inc Wed Jun 12 06:20:17 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.19 2019/02/12 18:32:15 martin Exp $
+# $NetBSD: Makefile.inc,v 1.20 2019/06/12 06:20:17 martin Exp $
#
# Makefile for sysinst
@@ -13,14 +13,17 @@
SRCS+= menu_defs.c msg_defs.c main.c install.c upgrade.c \
txtwalk.c run.c factor.c net.c disks.c disks_lfs.c util.c geom.c \
- label.c target.c md.c sizemultname.c configmenu.c checkrc.c
+ label.c target.c md.c sizemultname.c configmenu.c checkrc.c \
+ disklabel.c partitions.c part_edit.c
SRCS+= ${MD_OPTIONS:MAOUT2ELF:S/AOUT2ELF/aout2elf.c/}
-SRCS+= ${MENUS_MD:Mmenus.mbr:S/menus.mbr/mbr.c/}
SRCS+= ${CPPFLAGS:M-DWSKBD:S/-DWSKBD/wskbd.c/}
-SRCS+= ${NODISKLABEL:D:Ubsddisklabel.c savenewlabel.c}
+SRCS+= ${NODISKLABEL:D:Ubsddisklabel.c}
SRCS+= ${NOPARTMAN:D:Upartman.c}
+.PATH: ${.CURDIR}/../../../../sbin/fsck
+SRCS+=partutil.c
+
DPSRCS+= defs.h
SYSINSTLANG?= en
@@ -29,6 +32,18 @@
MENUS_MI= menus.mi
MENUS_MI+= ${NOPARTMAN:D:Umenus.pm}
+.if ${NO_GPT:Uno} != "yes"
+CPPFLAGS+= -DHAVE_GPT
+GPT_DIR=${.CURDIR}/../../../../sbin/gpt
+SRCS+= gpt.c gpt_uuid.c
+CPPFLAGS.gpt_uuid.c+= -I${GPT_DIR}
+CPPFLAGS.gpt.c+= -I${GPT_DIR}
+.endif
+.if ${NO_MBR:Uyes} != "yes"
+CPPFLAGS+= -DHAVE_MBR
+SRCS+= mbr.c
+.endif
+
MSG_MD?= msg.md.${SYSINSTLANG}
MENUS_MD?= menus.md.${SYSINSTLANG}
@@ -41,16 +56,18 @@
_MKSHTARGET_CREATE?= ${_MKSHMSG_CREATE} ${.CURDIR:T}/${.TARGET}
-DPADD= ${LIBCURSES} ${LIBTERMLIB} ${LIBUTIL}
-LDADD= -lcurses -ltermlib -lutil
+DPADD= ${LIBCURSES} ${LIBTERMLIB} ${LIBPROP} ${LIBUTIL}
+LDADD= -lcurses -ltermlib -lprop -lutil
UNIF_AWK= ${.CURDIR}/../../unif.awk
MSG_XLAT_SH= ${.CURDIR}/../../msg_xlat.sh
+MSG_CMP_SH= ${.CURDIR}/../../msg_cmp.sh
SETS_TAR_SUFF=${"${USE_XZ_SETS:Uno}"!="no":?"tar.xz":"tgz"}
CATALOGDIR= /usr/share/sysinst/catalog
CPPFLAGS+= -I. -I${.CURDIR}/../.. -I${.CURDIR} \
+ -I${.CURDIR}/../../../../sbin/fsck \
-DSETS_TAR_SUFF=${SETS_TAR_SUFF:Q} \
-DREL=\"${DISTRIBVER}\" -DMACH=\"${MACHINE}\" \
-DMACH_${MACHINE} -DARCH_${MACHINE_ARCH} \
@@ -81,6 +98,7 @@
CPPFLAGS+= -DPKG_SUBDIR="\"${DISTRIBVER:C/_.*$//}\""
.endif
.endif
+CPPFLAGS+= -DNETBSD_MAJOR='"${DISTRIBVER:C/\..*//}"'
.if !defined(DEBUG)
CPPFLAGS+= -DCATALOG_DIR=\"${CATALOGDIR}\"
@@ -108,19 +126,6 @@
COPTS+=-Wno-format-truncation # most useless gcc warning ever
.endif
-.if defined(HAVE_GCC) || defined(HAVE_PCC)
-COPTS.label.c+= -Wno-pointer-sign
-.endif
-COPTS.main.c += -Wno-format-nonliteral
-COPTS.disks.c += -Wno-format-nonliteral
-COPTS.util.c += -Wno-format-nonliteral
-COPTS.label.c += -Wno-format-nonliteral
-COPTS.target.c += -Wno-format-nonliteral
-COPTS.mbr.c += -Wno-format-nonliteral
-COPTS.msg_defs.c += -Wno-format-nonliteral
-COPTS.bsddisklabel.c += -Wno-format-nonliteral
-COPTS.md.c += -Wno-format-nonliteral
-COPTS.partman.c += -Wno-format-nonliteral -Wno-stack-protector
# Host to ftp from. Default:
# "ftp.NetBSD.org"
@@ -180,6 +185,10 @@
msgtouch: ${DISTRIBVERDEP}
touch ${.TARGET}
+.if !defined(NOPARTMAN)
+MSG_MD+= msg.pm.${SYSINSTLANG}
+.endif
+
msg.def: msg.mi.${SYSINSTLANG} ${MSG_MD} msgtouch
${_MKTARGET_CREATE}
${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" ${.ALLSRC} | \
@@ -213,4 +222,14 @@
# FILESDIR_sysinstmsgs.${LANG}= ${CATALOGDIR}
.endfor
+.PHONY: check-lang
+check-lang: msg.def msg_defs.h
+ ${_MKTARGET_CREATE}
+ ${TOOL_SED} "s/@@VERSION@@/${DISTRIBVER}/" msg.def | \
+ ${TOOL_SED} "s/@@MACHINE@@/${MACHINE}/" | \
+ ${TOOL_AWK} -f ${UNIF_AWK} -v defines="${MD_OPTIONS}" | \
+ ${HOST_SH} ${MSG_XLAT_SH} -i > /tmp/sysinst.en
+ ${HOST_SH} ${MSG_CMP_SH} msg_defs.h /tmp/sysinst.en sysinstmsgs.${LANG}
+ @rm /tmp/sysinst.en
+
.include <bsd.prog.mk>
diff -r 009e49917e5f -r 6bfe85a9d6c1 usr.sbin/sysinst/aout2elf.c
--- a/usr.sbin/sysinst/aout2elf.c Wed Jun 12 04:20:18 2019 +0000
+++ b/usr.sbin/sysinst/aout2elf.c Wed Jun 12 06:20:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aout2elf.c,v 1.1 2014/07/26 19:30:44 dholland Exp $
+/* $NetBSD: aout2elf.c,v 1.2 2019/06/12 06:20:17 martin Exp $
*
* Copyright 1997 Piermont Information Systems Inc.
* All rights reserved.
@@ -195,8 +195,7 @@
__dead static void
abort_libupdate(void)
{
- msg_display(MSG_aoutfail);
- process_menu(MENU_ok, NULL);
+ hit_enter_to_continue(MSG_aoutfail, NULL);
exit(1);
}
@@ -294,8 +293,7 @@
handle_aout_x_libs(src, concat_paths(prefix, "usr/X11R6/lib"));
if (backedup) {
- msg_display(MSG_emulbackup);
- process_menu(MENU_ok, NULL);
+ hit_enter_to_continue(MSG_emulbackup, NULL);
}
return n;
diff -r 009e49917e5f -r 6bfe85a9d6c1 usr.sbin/sysinst/arch/acorn32/md.c
--- a/usr.sbin/sysinst/arch/acorn32/md.c Wed Jun 12 04:20:18 2019 +0000
+++ b/usr.sbin/sysinst/arch/acorn32/md.c Wed Jun 12 06:20:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md.c,v 1.3 2018/01/24 09:04:46 skrll Exp $ */
+/* $NetBSD: md.c,v 1.4 2019/06/12 06:20:18 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -40,7 +40,6 @@
#include <fcntl.h>
#include <util.h>
#include <sys/types.h>
-#include <sys/disklabel.h>
#include <sys/disklabel_acorn.h>
#include <sys/ioctl.h>
#include <sys/param.h>
@@ -63,8 +62,8 @@
(void)flags;
}
-int
-md_get_info(void)
+bool
+md_get_info(struct install_partition_desc *install)
{
struct disklabel disklabel;
int fd;
@@ -73,11 +72,6 @@
struct filecore_bootblock *fcbb = (struct filecore_bootblock *)bb;
int offset = 0;
- if (strncmp(pm->diskdev, "wd", 2) == 0)
- pm->disktype = "ST506";
- else
- pm->disktype = "SCSI";
-
snprintf(dev_name, 100, "/dev/r%s%c", pm->diskdev, 'a' + getrawpartition());
fd = open(dev_name, O_RDONLY, 0);
@@ -202,23 +196,23 @@
printf("secpun=%d\n", disklabel.d_secperunit);
backtowin();*/
- return 1;
+ return true;
}
/*
* md back-end code for menu-driven BSD disklabel editor.
*/
-int
-md_make_bsd_partitions(void)
+bool
+md_make_bsd_partitions(struct install_partition_desc *install)
{
- return make_bsd_partitions();
+ return make_bsd_partitions(install);
}
/*
* any additional partition validation
*/
-int
-md_check_partitions(void)
+bool
+md_check_partitions(struct install_partition_desc *install)
{
return 1;
}
@@ -226,8 +220,9 @@
/*
* hook called before writing new disklabel.
*/
-int
-md_pre_disklabel(void)
+bool
+md_pre_disklabel(struct install_partition_desc *install,
+ struct disk_partitions *part)
{
return 0;
}
@@ -235,10 +230,11 @@
/*
* hook called after writing disklabel to new target disk.
*/
-int
-md_post_disklabel(void)
+bool
+md_post_disklabel(struct install_partition_desc *install,
+ struct disk_partitions *part)
{
- return 0;
+ return true;
}
/*
@@ -247,19 +243,19 @@
* ``disks are now set up'' message.
*/
int
-md_post_newfs(void)
+md_post_newfs(struct install_partition_desc *install)
{
return 0;
}
int
-md_post_extract(void)
+md_post_extract(struct install_partition_desc *install)
{
return 0;
}
void
-md_cleanup_install(void)
+md_cleanup_install(struct install_partition_desc *install)
{
#ifndef DEBUG
enable_rc_conf();
@@ -267,16 +263,16 @@
}
int
-md_pre_update(void)
+md_pre_update(struct install_partition_desc *install)
{
return 1;
}
/* Upgrade support */
int
-md_update(void)
+md_update(struct install_partition_desc *install)
{
- md_post_newfs();
+ md_post_newfs(install);
return 1;
}
@@ -350,7 +346,27 @@
}
int
-md_pre_mount()
+md_pre_mount(struct install_partition_desc *install)
{
Home |
Main Index |
Thread Index |
Old Index