Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/sysinst Remove 'menu_ent' parameter from actio...



details:   https://anonhg.NetBSD.org/src/rev/7708083850e4
branches:  trunk
changeset: 549984:7708083850e4
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sun Jul 27 07:45:08 2003 +0000

description:
Remove 'menu_ent' parameter from action routines.
Add menu for all disklabel partition types.
Default 'partition type' and 'sizechoice' menus to current value.
Change 'standard/use existing' to 'set sizes/use existing'.

diffstat:

 distrib/utils/sysinst/bsddisklabel.c |   8 +-
 distrib/utils/sysinst/disks.c        |   4 +-
 distrib/utils/sysinst/label.c        |  98 +++++++++++++++++------------------
 distrib/utils/sysinst/main.c         |   6 +-
 distrib/utils/sysinst/mbr.c          |  25 ++++----
 distrib/utils/sysinst/menus.mi       |  29 ++++++++-
 distrib/utils/sysinst/msg.mi.en      |  12 ++-
 distrib/utils/sysinst/msg.mi.fr      |   9 ++-
 distrib/utils/sysinst/msg.mi.pl      |  10 ++-
 distrib/utils/sysinst/run.c          |  10 +-
 distrib/utils/sysinst/util.c         |  24 ++++----
 11 files changed, 131 insertions(+), 104 deletions(-)

diffs (truncated from 719 to 300 lines):

diff -r e848b54f4ec9 -r 7708083850e4 distrib/utils/sysinst/bsddisklabel.c
--- a/distrib/utils/sysinst/bsddisklabel.c      Sun Jul 27 07:21:57 2003 +0000
+++ b/distrib/utils/sysinst/bsddisklabel.c      Sun Jul 27 07:45:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bsddisklabel.c,v 1.21 2003/07/26 17:07:39 salo Exp $   */
+/*     $NetBSD: bsddisklabel.c,v 1.22 2003/07/27 07:45:08 dsl Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -91,7 +91,7 @@
 #define DEFSWAPSIZE    128
 #endif
 
-static int set_ptn_size(menudesc *, menu_ent *, void *);
+static int set_ptn_size(menudesc *, void *);
 
 #define NUM_PTN_MENU   (MAXPARTITIONS + 4)
 
@@ -218,7 +218,7 @@
 }
 
 static int
-set_ptn_size(menudesc *m, menu_ent *opt, void *arg)
+set_ptn_size(menudesc *m, void *arg)
 {
        struct ptn_info *pi = arg;
        struct ptn_size *p;
@@ -228,7 +228,7 @@
        int size;
        int mult;
 
-       p = pi->ptn_sizes + (opt - m->opts);
+       p = pi->ptn_sizes + m->cursel;
 
        if (pi->free_parts == 0 && p->size == 0)
                /* Don't allow 'free_parts' to go negative */
diff -r e848b54f4ec9 -r 7708083850e4 distrib/utils/sysinst/disks.c
--- a/distrib/utils/sysinst/disks.c     Sun Jul 27 07:21:57 2003 +0000
+++ b/distrib/utils/sysinst/disks.c     Sun Jul 27 07:45:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disks.c,v 1.65 2003/07/25 08:26:21 dsl Exp $ */
+/*     $NetBSD: disks.c,v 1.66 2003/07/27 07:45:08 dsl Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -131,7 +131,7 @@
 }
 
 static int
-set_dsk_select(menudesc *m, menu_ent *opt, void *arg)
+set_dsk_select(menudesc *m, void *arg)
 {
        *(int *)arg = m->cursel;
        return 1;
diff -r e848b54f4ec9 -r 7708083850e4 distrib/utils/sysinst/label.c
--- a/distrib/utils/sysinst/label.c     Sun Jul 27 07:21:57 2003 +0000
+++ b/distrib/utils/sysinst/label.c     Sun Jul 27 07:45:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: label.c,v 1.36 2003/07/25 08:26:21 dsl Exp $   */
+/*     $NetBSD: label.c,v 1.37 2003/07/27 07:45:08 dsl 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.36 2003/07/25 08:26:21 dsl Exp $");
+__RCSID("$NetBSD: label.c,v 1.37 2003/07/27 07:45:08 dsl Exp $");
 #endif
 
 #include <sys/types.h>
@@ -162,7 +162,7 @@
 }
 
 static int
-edit_fs_start(menudesc *m, menu_ent *e, void *arg)
+edit_fs_start(menudesc *m, void *arg)
 {
        partinfo *p = arg;
        int start, size;
@@ -181,7 +181,7 @@
 }
 
 static int
-edit_fs_size(menudesc *m, menu_ent *e, void *arg)
+edit_fs_size(menudesc *m, void *arg)
 {
        partinfo *p = arg;
        int size;
@@ -216,7 +216,7 @@
 }
 
 static int
-edit_fs_preserve(menudesc *m, menu_ent *e, void *arg)
+edit_fs_preserve(menudesc *m, void *arg)
 {
        partinfo *p = arg;
 
@@ -225,7 +225,7 @@
 }
 
 static int
-edit_fs_mount(menudesc *m, menu_ent *e, void *arg)
+edit_fs_mount(menudesc *m, void *arg)
 {
        partinfo *p = arg;
 
@@ -234,7 +234,7 @@
 }
 
 static int
-edit_fs_mountpt(menudesc *m, menu_ent *e, void *arg)
+edit_fs_mountpt(menudesc *m, void *arg)
 {
        partinfo *p = arg;
        char buff[4];
@@ -266,7 +266,7 @@
 }
 
 static int
-edit_restore(menudesc *m, menu_ent *e, void *arg)
+edit_restore(menudesc *m, void *arg)
 {
        partinfo *p = arg;
 
@@ -291,10 +291,28 @@
        }
 }
 
+static int
+set_fstype(menudesc *m, void *arg)
+{
+       partinfo *p = arg;
+
+       p->pi_fstype = m->cursel;
+       return 1;
+}
+
+static void
+get_fstype(menudesc *m, void *arg)
+{
+       partinfo *p = arg;
+
+       m->cursel = p->pi_fstype;
+}
+
 static void set_ptn_label(menudesc *m, int opt, void *arg);
+int all_fstype_menu = -1;
 
 static int
-edit_ptn(menudesc *menu, menu_ent *opt, void *arg)
+edit_ptn(menudesc *menu, void *arg)
 {
        static menu_ent fs_fields[] = {
 #define PTN_MENU_FSKIND                0
@@ -319,11 +337,11 @@
            {MSG_restore, OPT_NOMENU, 0, edit_restore},
        };
        static int fspart_menu = -1;
+       static menu_ent all_fstypes[FSMAXTYPES];
        partinfo *p, p_save;
+       int i;
 
        if (fspart_menu == -1) {
-               if (!check_lfs_progs())
-                       set_menu_numopts(MENU_selfskind, 4);
                fspart_menu = new_menu(NULL, fs_fields, nelem(fs_fields),
                        0, 7, 0, 70,
                        MC_NOBOX | MC_NOCLEAR | MC_SCROLL,
@@ -331,7 +349,20 @@
                        NULL, MSG_partition_sizes_ok);
        }
 
-       p = bsdlabel + (opt - menu->opts);
+       if (all_fstype_menu == -1) {
+               for (i = 0; i < nelem(all_fstypes); i++) {
+                       all_fstypes[i].opt_name = fstypenames[i];
+                       all_fstypes[i].opt_menu = OPT_NOMENU;
+                       all_fstypes[i].opt_flags = 0;
+                       all_fstypes[i].opt_action = set_fstype;
+               }
+               all_fstype_menu = new_menu(MSG_Select_the_type,
+                       all_fstypes, nelem(all_fstypes),
+                       -1, 15, 10, 0, MC_SCROLL,
+                       get_fstype, NULL, NULL, NULL, MSG_unchanged);
+       }
+
+       p = bsdlabel + menu->cursel;
        p->pi_flags &= ~PIF_RESET;
        p_save = *p;
        for (;;) {
@@ -400,7 +431,7 @@
 }
 
 static int
-show_all_unused(menudesc *m, menu_ent *opt, void *arg)
+show_all_unused(menudesc *m, void *arg)
 {
        struct ptn_menu_info *pi = arg;
 
@@ -523,43 +554,6 @@
        memset(lp, 0, sizeof *lp);
 }
 
-#if 0
-/*
- * XXX MSDOS?
- */
-void
-translate_partinfo(partinfo *lp, struct partition *pp)
-{
-
-       lp->pi_fstype = pp->p_fstype;
-
-       switch (pp->p_fstype) {
-
-       case FS_UNUSED:                         /* XXX */
-       case FS_SWAP:
-               break;
-
-       case FS_BSDLFS:
-       case FS_BSDFFS:
-               (*lp).pi_offset = 0;
-               (*lp).pi_size = 0;
-               (*lp).pi_frag = pp->p_frag;
-               (*lp).pi_fsize = pp->p_fsize;
-               break;
-
-       case FS_EX2FS:
-               (*lp).pi_fstype = FS_UNUSED;    /* XXX why? */
-               (*lp).pi_frag = pp->p_frag;
-               (*lp).pi_fsize = pp->p_fsize;
-               break;
-
-       default:
-               (*lp).pi_fstype = FS_UNUSED;
-               break;
-       }
-}
-#endif
-
 /*
  * Read a label from disk into a sysinst label structure.
  */
@@ -588,6 +582,8 @@
        pp = &lab.d_partitions[0];
        for (i = 0; i < maxpart; lp++, pp++, i++) {
                lp->pi_partition = *pp;
+               if (lp->pi_fstype >= FSMAXTYPES)
+                       lp->pi_fstype = FS_OTHER;
                strlcpy(lp->pi_mount, get_last_mounted(fd, pp->p_offset),
                        sizeof lp->pi_mount);
        }
@@ -637,7 +633,7 @@
                if (*sbp != 0)
                        continue;
 
-               /* If start of disk check for other fs types */
+               /* If start of partition check for other fs types */
                if (sblk[0x42] == 0x29 && memcmp(sblk + 0x52, "FAT", 3) == 0) {
                        /* Probably a FAT filesystem, report volume name */
                        cp = strchr(sblk + 0x47, ' ');
diff -r e848b54f4ec9 -r 7708083850e4 distrib/utils/sysinst/main.c
--- a/distrib/utils/sysinst/main.c      Sun Jul 27 07:21:57 2003 +0000
+++ b/distrib/utils/sysinst/main.c      Sun Jul 27 07:45:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.39 2003/07/18 09:46:11 dsl Exp $    */
+/*     $NetBSD: main.c,v 1.40 2003/07/27 07:45:08 dsl Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -165,11 +165,11 @@
 }
 
 static int
-set_language(menudesc *m, menu_ent *e, void *arg)
+set_language(menudesc *m, void *arg)
 {
        char **fnames = arg;
 
-       msg_file(fnames[e - m->opts]);
+       msg_file(fnames[m->cursel]);
        return 1;
 }
 
diff -r e848b54f4ec9 -r 7708083850e4 distrib/utils/sysinst/mbr.c
--- a/distrib/utils/sysinst/mbr.c       Sun Jul 27 07:21:57 2003 +0000
+++ b/distrib/utils/sysinst/mbr.c       Sun Jul 27 07:45:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mbr.c,v 1.49 2003/07/25 08:26:22 dsl Exp $ */
+/*     $NetBSD: mbr.c,v 1.50 2003/07/27 07:45:08 dsl Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -224,7 +224,7 @@
 }
 
 static int
-set_mbr_type(menudesc *m, menu_ent *ent, void *arg)



Home | Main Index | Thread Index | Old Index