On the i386, enable swapspace as soon as the disklabel has been written,

to play nice with low-memory systems.

Add a md_pre_update() hook, to do MD things before an upgrade operation.
On the i386, use it to enable swap.
This commit is contained in:
fvdl 2000-09-26 23:12:44 +00:00
parent f487c6c12e
commit 6bf2c525a2
17 changed files with 139 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.19 2000/03/14 22:42:50 fvdl Exp $ */
/* $NetBSD: md.c,v 1.20 2000/09/26 23:12:44 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -349,3 +349,9 @@ void
md_cleanup_install(void)
{
}
int
md_pre_update()
{
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2000/02/20 20:34:57 is Exp $ */
/* $NetBSD: md.c,v 1.2 2000/09/26 23:12:45 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -137,3 +137,9 @@ md_cleanup_install(void)
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
}
int
md_pre_update()
{
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.23 2000/03/14 22:42:50 fvdl Exp $ */
/* $NetBSD: md.c,v 1.24 2000/09/26 23:12:45 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -515,3 +515,9 @@ md_cleanup_install(void)
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
#endif
}
int
md_pre_update()
{
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.15 2000/03/14 22:42:51 fvdl Exp $ */
/* $NetBSD: md.c,v 1.16 2000/09/26 23:12:45 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -360,3 +360,9 @@ md_cleanup_install(void)
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
}
int
md_pre_update()
{
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.4 2000/03/14 22:42:51 fvdl Exp $ */
/* $NetBSD: md.c,v 1.5 2000/09/26 23:12:45 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -651,3 +651,9 @@ disp_bootsel(part, mbsp)
}
}
#endif
int
md_pre_update()
{
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.37 2000/09/20 19:53:36 hubertf Exp $ */
/* $NetBSD: md.c,v 1.38 2000/09/26 23:12:45 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -64,6 +64,7 @@ static int mbr_part_above_chs __P((struct mbr_partition *));
static int mbr_partstart_above_chs __P((struct mbr_partition *));
static void configure_bootsel __P((void));
static void md_upgrade_mbrtype __P((void));
static void md_enable_swap __P((partinfo *pp));
struct mbr_bootsel *mbs;
int defbootselpart, defbootseldisk;
@ -175,6 +176,8 @@ md_pre_disklabel()
int
md_post_disklabel(void)
{
md_enable_swap(bsdlabel);
/* Sector forwarding / badblocks ... */
if (*doessf) {
msg_display(MSG_dobad144);
@ -422,6 +425,38 @@ custom: ask_sizemult(dlcylsize);
return (1);
}
static void
md_enable_swap(pp)
partinfo *pp;
{
partinfo parts[16];
int i, maxpart;
if (pp == NULL) {
emptylabel(parts);
if (incorelabel(diskdev, parts) < 0)
return;
pp = parts;
}
maxpart = getmaxpartitions();
for (i = 0; i < maxpart; i++) {
if (pp[i].pi_fstype == FS_SWAP) {
run_prog(0, 0, NULL,
"/sbin/swapctl -a /dev/%s%c", diskdev, 'a' + i);
break;
}
}
}
int
md_pre_update(void)
{
md_enable_swap(NULL);
return 1;
}
/* Upgrade support */
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.12 1999/09/12 15:29:38 briggs Exp $ */
/* $NetBSD: md.c,v 1.13 2000/09/26 23:12:45 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -887,3 +887,8 @@ md_cleanup_install(void)
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
}
int
md_pre_update()
{
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.14 2000/03/14 22:42:52 fvdl Exp $ */
/* $NetBSD: md.c,v 1.15 2000/09/26 23:12:46 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -361,3 +361,9 @@ md_cleanup_install()
{
}
int
md_pre_update()
{
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.2 2000/03/14 22:42:52 fvdl Exp $ */
/* $NetBSD: md.c,v 1.3 2000/09/26 23:12:46 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -361,3 +361,9 @@ md_cleanup_install()
{
}
int
md_pre_update()
{
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.19 2000/03/14 22:42:52 fvdl Exp $ */
/* $NetBSD: md.c,v 1.20 2000/09/26 23:12:46 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -324,3 +324,9 @@ void
md_cleanup_install(void)
{
}
int
md_pre_update()
{
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.38 1999/11/28 06:32:21 simonb Exp $ */
/* $NetBSD: md.c,v 1.39 2000/09/26 23:12:46 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -222,3 +222,9 @@ md_cleanup_install(void)
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
}
int
md_pre_update()
{
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.18 1999/08/16 08:29:06 abs Exp $ */
/* $NetBSD: md.c,v 1.19 2000/09/26 23:12:46 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -215,3 +215,9 @@ md_cleanup_install(void)
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
}
int
md_pre_update()
{
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2000/08/19 13:22:40 mrg Exp $ */
/* $NetBSD: md.c,v 1.2 2000/09/26 23:12:46 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -208,3 +208,9 @@ md_cleanup_install(void)
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
}
int
md_pre_update()
{
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.10 1999/08/16 08:29:07 abs Exp $ */
/* $NetBSD: md.c,v 1.11 2000/09/26 23:12:46 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -207,3 +207,9 @@ md_cleanup_install(void)
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
}
int
md_pre_update()
{
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.7 2000/09/16 13:12:09 minoura Exp $ */
/* $NetBSD: md.c,v 1.8 2000/09/26 23:12:47 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -335,3 +335,9 @@ md_cleanup_install(void)
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
}
int
md_pre_update()
{
return 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.58 2000/09/26 13:26:02 fvdl Exp $ */
/* $NetBSD: defs.h,v 1.59 2000/09/26 23:12:44 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -256,6 +256,7 @@ int md_make_bsd_partitions __P((void));
int md_post_disklabel __P((void));
int md_post_newfs __P((void));
int md_pre_disklabel __P((void));
int md_pre_update __P((void));
int md_update __P((void));
/* from main.c */

View File

@ -1,4 +1,4 @@
/* $NetBSD: upgrade.c,v 1.22 2000/09/09 00:21:36 hubertf Exp $ */
/* $NetBSD: upgrade.c,v 1.23 2000/09/26 23:12:44 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -73,6 +73,9 @@ do_upgrade()
if (find_disks() < 0)
return;
if (md_pre_update() < 0)
return;
/* if we need the user to mount root, ask them to. */
if (must_mount_root()) {
msg_display(MSG_pleasemountroot, diskdev, diskdev, diskdev);