Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/utils/sysinst Rework the MBR code, and some of the l...



details:   https://anonhg.NetBSD.org/src/rev/a65937e4e483
branches:  trunk
changeset: 467910:a65937e4e483
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Wed Mar 31 00:44:48 1999 +0000

description:
Rework the MBR code, and some of the labelling code.

        * Use structures, not 2-dimensional arrays..
        * Use the DIOCGDEFLABEL ioctl to get the disk information,
          to avoid confusion with (older) labels.
        * Don't ever call fdisk for partitioning. This was the
          source of much confusion.
        * For the i386, use the BIOS geometry information passed by
          the bootblocks.

Lots of things left to do, but it's a start.

diffstat:

 distrib/utils/sysinst/TODO                    |    5 +-
 distrib/utils/sysinst/arch/alpha/md.c         |   76 ++--
 distrib/utils/sysinst/arch/arm32/md.c         |   72 ++--
 distrib/utils/sysinst/arch/bebox/Makefile     |    4 +-
 distrib/utils/sysinst/arch/bebox/md.c         |  143 +++------
 distrib/utils/sysinst/arch/bebox/menus.md.eng |   53 +--
 distrib/utils/sysinst/arch/bebox/menus.md.fr  |   55 +--
 distrib/utils/sysinst/arch/i386/Makefile      |    4 +-
 distrib/utils/sysinst/arch/i386/md.c          |  308 ++++++++++++-------
 distrib/utils/sysinst/arch/i386/md.h          |   14 +-
 distrib/utils/sysinst/arch/i386/menus.md.eng  |   97 +++--
 distrib/utils/sysinst/arch/i386/menus.md.fr   |   55 +--
 distrib/utils/sysinst/arch/i386/msg.md.eng    |   47 +--
 distrib/utils/sysinst/arch/macppc/md.c        |   76 ++--
 distrib/utils/sysinst/arch/pc532/md.c         |   94 ++---
 distrib/utils/sysinst/arch/pmax/md.c          |   88 ++--
 distrib/utils/sysinst/arch/sparc/md.c         |   76 ++--
 distrib/utils/sysinst/arch/vax/md.c           |   76 ++--
 distrib/utils/sysinst/defs.h                  |   31 +-
 distrib/utils/sysinst/disks.c                 |  191 ++++-------
 distrib/utils/sysinst/endian.h                |   26 +
 distrib/utils/sysinst/fdisk.c                 |  142 ---------
 distrib/utils/sysinst/label.c                 |   76 ++--
 distrib/utils/sysinst/main.c                  |    9 +-
 distrib/utils/sysinst/mbr.c                   |  407 ++++++++++++++++++++-----
 distrib/utils/sysinst/mbr.h                   |   34 +-
 distrib/utils/sysinst/menus.mi.eng            |   81 +---
 distrib/utils/sysinst/menus.mi.fr             |   81 +---
 distrib/utils/sysinst/msg.mi.eng              |   44 +--
 distrib/utils/sysinst/msg.mi.fr               |   39 +--
 30 files changed, 1199 insertions(+), 1305 deletions(-)

diffs (truncated from 4188 to 300 lines):

diff -r 8469fa313c08 -r a65937e4e483 distrib/utils/sysinst/TODO
--- a/distrib/utils/sysinst/TODO        Wed Mar 31 00:11:41 1999 +0000
+++ b/distrib/utils/sysinst/TODO        Wed Mar 31 00:44:48 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: TODO,v 1.16 1999/03/19 15:44:59 he Exp $
+#      $NetBSD: TODO,v 1.17 1999/03/31 00:44:48 fvdl Exp $
 
 Things to do ....  in no specific order.
 
@@ -8,9 +8,6 @@
           the reverse is true.  Without this fix, extraction of base
           and comp will fail.
 
-       -  rework the fdisk/MBR code to be able to get the correct
-          MBR geometry with much better probability.
-
        -- On error messages, do something to allow the user to
           see any errors from anything run by run_prog().
           Ideas suggested  maximum entropy <entropy%zippy.bernstein.com@localhost>.
diff -r 8469fa313c08 -r a65937e4e483 distrib/utils/sysinst/arch/alpha/md.c
--- a/distrib/utils/sysinst/arch/alpha/md.c     Wed Mar 31 00:11:41 1999 +0000
+++ b/distrib/utils/sysinst/arch/alpha/md.c     Wed Mar 31 00:44:48 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.8 1999/01/25 23:34:24 garbled Exp $   */
+/*     $NetBSD: md.c,v 1.9 1999/03/31 00:44:49 fvdl Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -189,19 +189,19 @@
        emptylabel(bsdlabel);
 
        /* Partitions C is predefined (whole  disk). */
-       bsdlabel[C][D_FSTYPE] = T_UNUSED;
-       bsdlabel[C][D_OFFSET] = 0;
-       bsdlabel[C][D_SIZE] = dlsize;
+       bsdlabel[C].pi_fstype = FS_UNUSED;
+       bsdlabel[C].pi_offset = 0;
+       bsdlabel[C].pi_size = dlsize;
        
        /* Standard fstypes */
-       bsdlabel[A][D_FSTYPE] = T_42BSD;
-       bsdlabel[B][D_FSTYPE] = T_SWAP;
+       bsdlabel[A].pi_fstype = FS_BSDFFS;
+       bsdlabel[B].pi_fstype = FS_SWAP;
        /* Conventionally, C is whole disk. */
-       bsdlabel[D][D_FSTYPE] = T_UNUSED;       /* fill out below */
-       bsdlabel[E][D_FSTYPE] = T_UNUSED;
-       bsdlabel[F][D_FSTYPE] = T_UNUSED;
-       bsdlabel[G][D_FSTYPE] = T_UNUSED;
-       bsdlabel[H][D_FSTYPE] = T_UNUSED;
+       bsdlabel[D].pi_fstype = FS_UNUSED;      /* fill out below */
+       bsdlabel[E].pi_fstype = FS_UNUSED;
+       bsdlabel[F].pi_fstype = FS_UNUSED;
+       bsdlabel[G].pi_fstype = FS_UNUSED;
+       bsdlabel[H].pi_fstype = FS_UNUSED;
        part = D;
 
 
@@ -213,10 +213,10 @@
                /* Root */
                /* By convention, NetBSD/alpha uses a 128Mbyte root */
                partsize= NUMSEC(128, MEG/sectorsize, dlcylsize);
-               bsdlabel[A][D_OFFSET] = partstart;
-               bsdlabel[A][D_SIZE] = partsize;
-               bsdlabel[A][D_BSIZE] = 8192;
-               bsdlabel[A][D_FSIZE] = 1024;
+               bsdlabel[A].pi_offset = partstart;
+               bsdlabel[A].pi_size = partsize;
+               bsdlabel[A].pi_bsize = 8192;
+               bsdlabel[A].pi_fsize = 1024;
                strcpy (fsmount[A], "/");
                partstart += partsize;
 
@@ -225,17 +225,17 @@
                           MEG/sectorsize, dlcylsize) + partstart;
                partsize = NUMSEC (i/(MEG/sectorsize)+1, MEG/sectorsize,
                           dlcylsize) - partstart - swapadj;
-               bsdlabel[B][D_OFFSET] = partstart;
-               bsdlabel[B][D_SIZE] = partsize;
+               bsdlabel[B].pi_offset = partstart;
+               bsdlabel[B].pi_size = partsize;
                partstart += partsize;
 
                /* /usr */
                partsize = fsdsize - partstart;
-               bsdlabel[PART_USR][D_FSTYPE] = T_42BSD;
-               bsdlabel[PART_USR][D_OFFSET] = partstart;
-               bsdlabel[PART_USR][D_SIZE] = partsize;
-               bsdlabel[PART_USR][D_BSIZE] = 8192;
-               bsdlabel[PART_USR][D_FSIZE] = 1024;
+               bsdlabel[PART_USR].pi_fstype = FS_BSDFFS;
+               bsdlabel[PART_USR].pi_offset = partstart;
+               bsdlabel[PART_USR].pi_size = partsize;
+               bsdlabel[PART_USR].pi_bsize = 8192;
+               bsdlabel[PART_USR].pi_fsize = 1024;
                strcpy (fsmount[PART_USR], "/usr");
 
                break;
@@ -251,10 +251,10 @@
                msg_prompt (MSG_askfsroot, isize, isize, 20,
                            remain/sizemult, multname);
                partsize = NUMSEC(atoi(isize),sizemult, dlcylsize);
-               bsdlabel[A][D_OFFSET] = partstart;
-               bsdlabel[A][D_SIZE] = partsize;
-               bsdlabel[A][D_BSIZE] = 8192;
-               bsdlabel[A][D_FSIZE] = 1024;
+               bsdlabel[A].pi_offset = partstart;
+               bsdlabel[A].pi_size = partsize;
+               bsdlabel[A].pi_bsize = 8192;
+               bsdlabel[A].pi_fsize = 1024;
                strcpy (fsmount[A], "/");
                partstart += partsize;
                
@@ -268,8 +268,8 @@
                msg_prompt_add (MSG_askfsswap, isize, isize, 20,
                            remain/sizemult, multname);
                partsize = NUMSEC(atoi(isize),sizemult, dlcylsize) - swapadj;
-               bsdlabel[B][D_OFFSET] = partstart;
-               bsdlabel[B][D_SIZE] = partsize;
+               bsdlabel[B].pi_offset = partstart;
+               bsdlabel[B].pi_size = partsize;
                partstart += partsize;
                
                /* /usr */
@@ -281,11 +281,11 @@
                partsize = NUMSEC(atoi(isize),sizemult, dlcylsize);
                if (remain - partsize < sizemult)
                        partsize = remain;
-               bsdlabel[PART_USR][D_FSTYPE] = T_42BSD;
-               bsdlabel[PART_USR][D_OFFSET] = partstart;
-               bsdlabel[PART_USR][D_SIZE] = partsize;
-               bsdlabel[PART_USR][D_BSIZE] = 8192;
-               bsdlabel[PART_USR][D_FSIZE] = 1024;
+               bsdlabel[PART_USR].pi_fstype = FS_BSDFFS;
+               bsdlabel[PART_USR].pi_offset = partstart;
+               bsdlabel[PART_USR].pi_size = partsize;
+               bsdlabel[PART_USR].pi_bsize = 8192;
+               bsdlabel[PART_USR].pi_fsize = 1024;
                strcpy (fsmount[PART_USR], "/usr");
                partstart += partsize;
 
@@ -303,11 +303,11 @@
                        partsize = NUMSEC(atoi(isize),sizemult, dlcylsize);
                        if (remain - partsize < sizemult)
                                partsize = remain;
-                       bsdlabel[part][D_FSTYPE] = T_42BSD;
-                       bsdlabel[part][D_OFFSET] = partstart;
-                       bsdlabel[part][D_SIZE] = partsize;
-                       bsdlabel[part][D_BSIZE] = 8192;
-                       bsdlabel[part][D_FSIZE] = 1024;
+                       bsdlabel[part].pi_fstype = FS_BSDFFS;
+                       bsdlabel[part].pi_offset = partstart;
+                       bsdlabel[part].pi_size = partsize;
+                       bsdlabel[part].pi_bsize = 8192;
+                       bsdlabel[part].pi_fsize = 1024;
                        msg_prompt_add (MSG_mountpoint, NULL,
                                        fsmount[part], 20);
                        partstart += partsize;
diff -r 8469fa313c08 -r a65937e4e483 distrib/utils/sysinst/arch/arm32/md.c
--- a/distrib/utils/sysinst/arch/arm32/md.c     Wed Mar 31 00:11:41 1999 +0000
+++ b/distrib/utils/sysinst/arch/arm32/md.c     Wed Mar 31 00:44:48 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.14 1999/03/26 03:02:45 mark Exp $     */
+/*     $NetBSD: md.c,v 1.15 1999/03/31 00:44:49 fvdl Exp $     */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -344,23 +344,23 @@
        emptylabel(bsdlabel);
 
        /* Partitions C is predefined (whole  disk). */
-       bsdlabel[C][D_FSTYPE] = T_UNUSED;
-       bsdlabel[C][D_OFFSET] = 0;
-       bsdlabel[C][D_SIZE] = dlsize;
+       bsdlabel[C].pi_fstype = FS_UNUSED;
+       bsdlabel[C].pi_offset = 0;
+       bsdlabel[C].pi_size = dlsize;
        
        /* Standard fstypes */
-       bsdlabel[A][D_FSTYPE] = T_42BSD;
-       bsdlabel[B][D_FSTYPE] = T_SWAP;
+       bsdlabel[A].pi_fstype = FS_BSDFFS;
+       bsdlabel[B].pi_fstype = FS_SWAP;
        /* Conventionally, C is whole disk and D in the non NetBSD bit */
-       bsdlabel[D][D_FSTYPE] = T_UNUSED;
-       bsdlabel[D][D_OFFSET] = 0;
-       bsdlabel[D][D_SIZE]   = ptstart;
+       bsdlabel[D].pi_fstype = FS_UNUSED;
+       bsdlabel[D].pi_offset = 0;
+       bsdlabel[D].pi_size   = ptstart;
 /*     if (ptstart > 0)
-               bsdlabel[D][D_FSTYPE] = T_FILECORE;*/
-       bsdlabel[E][D_FSTYPE] = T_UNUSED;       /* fill out below */
-       bsdlabel[F][D_FSTYPE] = T_UNUSED;
-       bsdlabel[G][D_FSTYPE] = T_UNUSED;
-       bsdlabel[H][D_FSTYPE] = T_UNUSED;
+               bsdlabel[D].pi_fstype = T_FILECORE;*/
+       bsdlabel[E].pi_fstype = FS_UNUSED;      /* fill out below */
+       bsdlabel[F].pi_fstype = FS_UNUSED;
+       bsdlabel[G].pi_fstype = FS_UNUSED;
+       bsdlabel[H].pi_fstype = FS_UNUSED;
 
 
        switch (layoutkind) {
@@ -372,10 +372,10 @@
                i = NUMSEC(24+2*rammb, MEG/sectorsize, dlcylsize) + partstart;
                partsize = NUMSEC(i/(MEG/sectorsize)+1, MEG/sectorsize,
                    dlcylsize) - partstart;
-               bsdlabel[A][D_OFFSET] = partstart;
-               bsdlabel[A][D_SIZE] = partsize;
-               bsdlabel[A][D_BSIZE] = 8192;
-               bsdlabel[A][D_FSIZE] = 1024;
+               bsdlabel[A].pi_offset = partstart;
+               bsdlabel[A].pi_size = partsize;
+               bsdlabel[A].pi_bsize = 8192;
+               bsdlabel[A].pi_fsize = 1024;
                strcpy(fsmount[A], "/");
                partstart += partsize;
 
@@ -384,17 +384,17 @@
                    MEG/sectorsize, dlcylsize) + partstart;
                partsize = NUMSEC(i/(MEG/sectorsize)+1, MEG/sectorsize,
                    dlcylsize) - partstart - swapadj;
-               bsdlabel[B][D_OFFSET] = partstart;
-               bsdlabel[B][D_SIZE] = partsize;
+               bsdlabel[B].pi_offset = partstart;
+               bsdlabel[B].pi_size = partsize;
                partstart += partsize;
 
                /* /usr */
                partsize = fsptsize - (partstart - ptstart);
-               bsdlabel[E][D_FSTYPE] = T_42BSD;
-               bsdlabel[E][D_OFFSET] = partstart;
-               bsdlabel[E][D_SIZE] = partsize;
-               bsdlabel[E][D_BSIZE] = 8192;
-               bsdlabel[E][D_FSIZE] = 1024;
+               bsdlabel[E].pi_fstype = FS_BSDFFS;
+               bsdlabel[E].pi_offset = partstart;
+               bsdlabel[E].pi_size = partsize;
+               bsdlabel[E].pi_bsize = 8192;
+               bsdlabel[E].pi_fsize = 1024;
                strcpy(fsmount[E], "/usr");
 
                break;
@@ -412,10 +412,10 @@
                msg_prompt(MSG_askfsroot, isize, isize, 20,
                    remain/sizemult, multname);
                partsize = NUMSEC(atoi(isize), sizemult, dlcylsize);
-               bsdlabel[A][D_OFFSET] = partstart;
-               bsdlabel[A][D_SIZE] = partsize;
-               bsdlabel[A][D_BSIZE] = 8192;
-               bsdlabel[A][D_FSIZE] = 1024;
+               bsdlabel[A].pi_offset = partstart;
+               bsdlabel[A].pi_size = partsize;
+               bsdlabel[A].pi_bsize = 8192;
+               bsdlabel[A].pi_fsize = 1024;
                strcpy(fsmount[A], "/");
                partstart += partsize;
                remain -= partsize;
@@ -429,8 +429,8 @@
                msg_prompt_add(MSG_askfsswap, isize, isize, 20,
                    remain/sizemult, multname);
                partsize = NUMSEC(atoi(isize),sizemult, dlcylsize) - swapadj;
-               bsdlabel[B][D_OFFSET] = partstart;
-               bsdlabel[B][D_SIZE] = partsize;
+               bsdlabel[B].pi_offset = partstart;
+               bsdlabel[B].pi_size = partsize;
                partstart += partsize;
                remain -= partsize;
                
@@ -447,11 +447,11 @@
                        if (partsize > 0) {
                                if (remain - partsize < sizemult)
                                        partsize = remain;
-                               bsdlabel[part][D_FSTYPE] = T_42BSD;
-                               bsdlabel[part][D_OFFSET] = partstart;
-                               bsdlabel[part][D_SIZE] = partsize;
-                               bsdlabel[part][D_BSIZE] = 8192;
-                               bsdlabel[part][D_FSIZE] = 1024;
+                               bsdlabel[part].pi_fstype = FS_BSDFFS;
+                               bsdlabel[part].pi_offset = partstart;
+                               bsdlabel[part].pi_size = partsize;
+                               bsdlabel[part].pi_bsize = 8192;
+                               bsdlabel[part].pi_fsize = 1024;
                                if (part == E)
                                        strcpy(fsmount[E], "/usr");
                                msg_prompt_add(MSG_mountpoint, fsmount[part],
diff -r 8469fa313c08 -r a65937e4e483 distrib/utils/sysinst/arch/bebox/Makefile
--- a/distrib/utils/sysinst/arch/bebox/Makefile Wed Mar 31 00:11:41 1999 +0000
+++ b/distrib/utils/sysinst/arch/bebox/Makefile Wed Mar 31 00:44:48 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.1 1998/11/19 08:58:06 sakamoto Exp $
+#      $NetBSD: Makefile,v 1.2 1999/03/31 00:44:49 fvdl Exp $
 #
 # Makefile for bebox
 #
@@ -7,7 +7,7 @@
 
 SRCS=  menu_defs.c msg_defs.c main.c install.c upgrade.c \
        txtwalk.c run.c factor.c net.c disks.c util.c geom.c \



Home | Main Index | Thread Index | Old Index