Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/distrib/utils/sysinst - Add 2 functions in label.c, getparto...
details: https://anonhg.NetBSD.org/src/rev/5bd859545240
branches: trunk
changeset: 471796:5bd859545240
user: bouyer <bouyer%NetBSD.org@localhost>
date: Sun Apr 11 22:40:19 1999 +0000
description:
- Add 2 functions in label.c, getpartoff()/getpartsize() used to let the user
enter partitions offet and size. The user can chose unit independantly of
the unit used for display ('M'/'c'/'s'). These functions do the proper
bound checks and alignement/roudups. Used in the edfspart menu and
i386 md_make_bsd_partitions() (other ports should do the change as
well).
- now that getpartsize() does the rigth thing, kill the swapadj hack (which was
buggy anyway).
- in i386 md_make_bsd_partitions(), don't propose defaults that don't fit on
the disk. If the disk is too small, fallback to custom instead.
- fix a bug in mbr.c, where the partition flags would not have always been
reset. sysinst created me a MBR with 2 active partition. The boot code
doesn't like it :)
- added a message for eventual mount failures.
- killed donewfs and extracting messages, as we run the commands in a
subwindow these messages just flashed on the screen.
- Changes a few exit(1) to return(1), to give the user a second chance.
- added msg_clear() or wclear(stdscr) in a place or two, to make
display a bit nicer.
- in run_cmd(), if the command succeeded, don't wait for the user to
press enter.
diffstat:
distrib/utils/sysinst/arch/alpha/md.c | 8 +-
distrib/utils/sysinst/arch/arm32/md.c | 8 +-
distrib/utils/sysinst/arch/bebox/md.c | 8 +-
distrib/utils/sysinst/arch/i386/md.c | 52 +++++----
distrib/utils/sysinst/arch/i386/menus.md.eng | 4 +-
distrib/utils/sysinst/arch/i386/menus.md.fr | 4 +-
distrib/utils/sysinst/arch/i386/msg.md.eng | 23 +++-
distrib/utils/sysinst/arch/i386/msg.md.fr | 30 ++++--
distrib/utils/sysinst/arch/macppc/md.c | 8 +-
distrib/utils/sysinst/arch/pmax/md.c | 8 +-
distrib/utils/sysinst/arch/sparc/md.c | 8 +-
distrib/utils/sysinst/arch/vax/md.c | 8 +-
distrib/utils/sysinst/defs.h | 6 +-
distrib/utils/sysinst/disks.c | 9 +-
distrib/utils/sysinst/install.c | 4 +-
distrib/utils/sysinst/label.c | 133 ++++++++++++++++++++++++++-
distrib/utils/sysinst/mbr.c | 9 +-
distrib/utils/sysinst/menus.mi.eng | 15 +--
distrib/utils/sysinst/menus.mi.fr | 21 +---
distrib/utils/sysinst/msg.mi.eng | 25 +++-
distrib/utils/sysinst/msg.mi.fr | 25 +++-
distrib/utils/sysinst/net.c | 4 +-
distrib/utils/sysinst/run.c | 8 +-
distrib/utils/sysinst/util.c | 6 +-
24 files changed, 300 insertions(+), 134 deletions(-)
diffs (truncated from 1027 to 300 lines):
diff -r 30b43d3b8145 -r 5bd859545240 distrib/utils/sysinst/arch/alpha/md.c
--- a/distrib/utils/sysinst/arch/alpha/md.c Sun Apr 11 22:15:25 1999 +0000
+++ b/distrib/utils/sysinst/arch/alpha/md.c Sun Apr 11 22:40:19 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md.c,v 1.11 1999/04/09 10:43:56 bouyer Exp $ */
+/* $NetBSD: md.c,v 1.12 1999/04/11 22:40:22 bouyer Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -228,7 +228,7 @@
i = NUMSEC(layoutkind * 2 * (rammb < 32 ? 32 : rammb),
MEG/sectorsize, dlcylsize) + partstart;
partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize,
- dlcylsize) - partstart - swapadj;
+ dlcylsize) - partstart;
bsdlabel[B].pi_offset = partstart;
bsdlabel[B].pi_size = partsize;
partstart += partsize;
@@ -267,11 +267,11 @@
i = NUMSEC(2 * (rammb < 32 ? 32 : rammb),
MEG/sectorsize, dlcylsize) + partstart;
partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize,
- dlcylsize) - partstart - swapadj;
+ dlcylsize) - partstart;
snprintf (isize, 20, "%d", partsize/sizemult);
msg_prompt_add (MSG_askfsswap, isize, isize, 20,
remain/sizemult, multname);
- partsize = NUMSEC(atoi(isize),sizemult, dlcylsize) - swapadj;
+ partsize = NUMSEC(atoi(isize),sizemult, dlcylsize);
bsdlabel[B].pi_offset = partstart;
bsdlabel[B].pi_size = partsize;
partstart += partsize;
diff -r 30b43d3b8145 -r 5bd859545240 distrib/utils/sysinst/arch/arm32/md.c
--- a/distrib/utils/sysinst/arch/arm32/md.c Sun Apr 11 22:15:25 1999 +0000
+++ b/distrib/utils/sysinst/arch/arm32/md.c Sun Apr 11 22:40:19 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md.c,v 1.17 1999/04/09 10:43:59 bouyer Exp $ */
+/* $NetBSD: md.c,v 1.18 1999/04/11 22:40:23 bouyer Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -388,7 +388,7 @@
i = NUMSEC(layoutkind * 2 * (rammb < 32 ? 32 : rammb),
MEG/sectorsize, dlcylsize) + partstart;
partsize = NUMSEC(i/(MEG/sectorsize)+1, MEG/sectorsize,
- dlcylsize) - partstart - swapadj;
+ dlcylsize) - partstart;
bsdlabel[B].pi_offset = partstart;
bsdlabel[B].pi_size = partsize;
partstart += partsize;
@@ -429,11 +429,11 @@
i = NUMSEC(4 * (rammb < 32 ? 32 : rammb),
MEG/sectorsize, dlcylsize) + partstart;
partsize = NUMSEC(i/(MEG/sectorsize)+1, MEG/sectorsize,
- dlcylsize) - partstart - swapadj;
+ dlcylsize) - partstart;
snprintf(isize, 20, "%d", partsize/sizemult);
msg_prompt_add(MSG_askfsswap, isize, isize, 20,
remain/sizemult, multname);
- partsize = NUMSEC(atoi(isize),sizemult, dlcylsize) - swapadj;
+ partsize = NUMSEC(atoi(isize),sizemult, dlcylsize);
bsdlabel[B].pi_offset = partstart;
bsdlabel[B].pi_size = partsize;
partstart += partsize;
diff -r 30b43d3b8145 -r 5bd859545240 distrib/utils/sysinst/arch/bebox/md.c
--- a/distrib/utils/sysinst/arch/bebox/md.c Sun Apr 11 22:15:25 1999 +0000
+++ b/distrib/utils/sysinst/arch/bebox/md.c Sun Apr 11 22:40:19 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md.c,v 1.9 1999/04/09 10:43:59 bouyer Exp $ */
+/* $NetBSD: md.c,v 1.10 1999/04/11 22:40:23 bouyer Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -178,7 +178,7 @@
i = NUMSEC(layoutkind * 2 * (rammb < 16 ? 16 : rammb),
MEG/sectorsize, dlcylsize) + partstart;
partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize,
- dlcylsize) - partstart - swapadj;
+ dlcylsize) - partstart;
bsdlabel[B].pi_offset = partstart;
bsdlabel[B].pi_size = partsize;
partstart += partsize;
@@ -219,11 +219,11 @@
i = NUMSEC( 2 * (rammb < 16 ? 16 : rammb),
MEG/sectorsize, dlcylsize) + partstart;
partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize,
- dlcylsize) - partstart - swapadj;
+ dlcylsize) - partstart;
snprintf (isize, 20, "%d", partsize/sizemult);
msg_prompt_add (MSG_askfsswap, isize, isize, 20,
remain/sizemult, multname);
- partsize = NUMSEC(atoi(isize),sizemult, dlcylsize) - swapadj;
+ partsize = NUMSEC(atoi(isize),sizemult, dlcylsize);
bsdlabel[B].pi_offset = partstart;
bsdlabel[B].pi_size = partsize;
partstart += partsize;
diff -r 30b43d3b8145 -r 5bd859545240 distrib/utils/sysinst/arch/i386/md.c
--- a/distrib/utils/sysinst/arch/i386/md.c Sun Apr 11 22:15:25 1999 +0000
+++ b/distrib/utils/sysinst/arch/i386/md.c Sun Apr 11 22:40:19 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md.c,v 1.22 1999/04/09 10:24:40 bouyer Exp $ */
+/* $NetBSD: md.c,v 1.23 1999/04/11 22:40:23 bouyer Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -149,10 +149,9 @@
{
/* boot blocks ... */
msg_display(MSG_dobootblks, diskdev);
- run_prog(0, 1, NULL, "/usr/mdec/installboot -v /usr/mdec/biosboot.sym "
- "/dev/r%sa", diskdev);
- /* Failing to install boot block is not a fatal error ... */
- return 0;
+ return run_prog(0, 1, NULL,
+ "/usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/r%sa",
+ diskdev);
}
int
@@ -189,7 +188,6 @@
int part;
int maxpart = getmaxpartitions();
int remain;
- char isize[20];
editlab:
/* Ask for layout type -- standard or special */
@@ -232,6 +230,15 @@
case 2: /* standard X: a root, b swap (big), c/d "unused", e /usr */
partstart = ptstart;
+ /* check that we have enouth space */
+ i = NUMSEC(20+2*rammb, MEG/sectorsize, dlcylsize);
+ i += NUMSEC(layoutkind * 2 * (rammb < 16 ? 16 : rammb),
+ MEG/sectorsize, dlcylsize);
+ if ( i > fsptsize) {
+ msg_display(MSG_disktoosmall);
+ process_menu(MENU_ok);
+ goto custom;
+ }
/* Root */
i = NUMSEC(20+2*rammb, MEG/sectorsize, dlcylsize) + partstart;
partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize,
@@ -247,7 +254,7 @@
i = NUMSEC(layoutkind * 2 * (rammb < 16 ? 16 : rammb),
MEG/sectorsize, dlcylsize) + partstart;
partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize,
- dlcylsize) - partstart - swapadj;
+ dlcylsize) - partstart;
bsdlabel[B].pi_offset = partstart;
bsdlabel[B].pi_size = partsize;
partstart += partsize;
@@ -260,11 +267,10 @@
bsdlabel[E].pi_bsize = 8192;
bsdlabel[E].pi_fsize = 1024;
strcpy (fsmount[E], "/usr");
-
break;
case 3: /* custom: ask user for all sizes */
- ask_sizemult();
+custom: ask_sizemult();
partstart = ptstart;
remain = fsptsize;
@@ -272,10 +278,10 @@
i = NUMSEC(20+2*rammb, MEG/sectorsize, dlcylsize) + partstart;
partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize,
dlcylsize) - partstart;
- snprintf (isize, 20, "%d", partsize/sizemult);
- msg_prompt (MSG_askfsroot, isize, isize, 20,
- remain/sizemult, multname);
- partsize = NUMSEC(atoi(isize),sizemult, dlcylsize);
+ if (partsize > remain)
+ partsize = remain;
+ msg_display(MSG_askfsroot1, remain/sizemult, multname);
+ partsize = getpartsize(MSG_askfsroot2, partstart, partsize);
bsdlabel[A].pi_offset = partstart;
bsdlabel[A].pi_size = partsize;
bsdlabel[A].pi_bsize = 8192;
@@ -288,11 +294,11 @@
i = NUMSEC( 2 * (rammb < 16 ? 16 : rammb),
MEG/sectorsize, dlcylsize) + partstart;
partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize,
- dlcylsize) - partstart - swapadj;
- snprintf(isize, 20, "%d", partsize/sizemult);
- msg_prompt_add(MSG_askfsswap, isize, isize, 20,
- remain/sizemult, multname);
- partsize = NUMSEC(atoi(isize),sizemult, dlcylsize) - swapadj;
+ dlcylsize) - partstart;
+ if (partsize > remain)
+ partsize = remain;
+ msg_display(MSG_askfsswap1, remain/sizemult, multname);
+ partsize = getpartsize(MSG_askfsswap2, partstart, partsize);
bsdlabel[B].pi_offset = partstart;
bsdlabel[B].pi_size = partsize;
partstart += partsize;
@@ -303,12 +309,10 @@
if (remain > 0)
msg_display (MSG_otherparts);
while (remain > 0 && part <= H) {
- partsize = remain;
- snprintf (isize, 20, "%d", partsize/sizemult);
- msg_prompt_add (MSG_askfspart, isize, isize, 20,
- diskdev, partname[part],
- remain/sizemult, multname);
- partsize = NUMSEC(atoi(isize),sizemult, dlcylsize);
+ msg_display_add(MSG_askfspart1, diskdev,
+ partname[part], remain/sizemult, multname);
+ partsize = getpartsize(MSG_askfspart2, partstart,
+ remain);
if (partsize > 0) {
if (remain - partsize < sizemult)
partsize = remain;
diff -r 30b43d3b8145 -r 5bd859545240 distrib/utils/sysinst/arch/i386/menus.md.eng
--- a/distrib/utils/sysinst/arch/i386/menus.md.eng Sun Apr 11 22:15:25 1999 +0000
+++ b/distrib/utils/sysinst/arch/i386/menus.md.eng Sun Apr 11 22:40:19 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: menus.md.eng,v 1.18 1999/03/31 00:44:49 fvdl Exp $ */
+/* $NetBSD: menus.md.eng,v 1.19 1999/04/11 22:40:26 bouyer Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -162,7 +162,7 @@
c1024_resp = 3;
};
-menu editfsparts, y=12, exit;
+menu editfsparts, y=13, exit;
display action {
ask_sizemult();
msg_display(MSG_fspart, multname);
diff -r 30b43d3b8145 -r 5bd859545240 distrib/utils/sysinst/arch/i386/menus.md.fr
--- a/distrib/utils/sysinst/arch/i386/menus.md.fr Sun Apr 11 22:15:25 1999 +0000
+++ b/distrib/utils/sysinst/arch/i386/menus.md.fr Sun Apr 11 22:40:19 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: menus.md.fr,v 1.14 1999/04/09 10:24:41 bouyer Exp $ */
+/* $NetBSD: menus.md.fr,v 1.15 1999/04/11 22:40:26 bouyer Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -163,7 +163,7 @@
c1024_resp = 3;
};
-menu editfsparts, y=12, exit;
+menu editfsparts, y=13, exit;
display action {
ask_sizemult();
msg_display(MSG_fspart, multname);
diff -r 30b43d3b8145 -r 5bd859545240 distrib/utils/sysinst/arch/i386/msg.md.eng
--- a/distrib/utils/sysinst/arch/i386/msg.md.eng Sun Apr 11 22:15:25 1999 +0000
+++ b/distrib/utils/sysinst/arch/i386/msg.md.eng Sun Apr 11 22:40:19 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.md.eng,v 1.10 1999/04/09 10:24:41 bouyer Exp $ */
+/* $NetBSD: msg.md.eng,v 1.11 1999/04/11 22:40:26 bouyer Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -151,16 +151,22 @@
{Installing boot blocks on %s....
}
-message askfsroot
+message askfsroot1
{I will be asking for partition information.
First the root partition. You have %d %s left on your disk.
-Root partition size? }
+}
-message askfsswap
+message askfsroot2
+{Root partition size? }
+
+message askfsswap1
{
Next the swap partition. You have %d %s left on your disk.
-Swap partition size? }
+}
+
+message askfsswap2
+{Swap partition size? }
message otherparts
{You still have some space remaining unallocated on your disk. Please
@@ -168,9 +174,12 @@
}
-message askfspart
+message askfspart1
{The next partition is /dev/%s%c. You have %d %s left on your disk.
-Partition size? }
+}
+
+message askfspart2
+{Partition size? }
message cyl1024
Home |
Main Index |
Thread Index |
Old Index