Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Backout the previous incorrect fix for PR 4...



details:   https://anonhg.NetBSD.org/src/rev/ce740060bd53
branches:  trunk
changeset: 338100:ce740060bd53
user:      martin <martin%NetBSD.org@localhost>
date:      Sun May 10 10:14:02 2015 +0000

description:
Backout the previous incorrect fix for PR 49440 and redo it more globaly:
get rid of the global "yesno", introduce utility functions "ask_yesno()"
and "ask_noyes()" instead, greatly simplifying a lot of code.
Pass in a pointer to the return value to various "set source" menus.

diffstat:

 usr.sbin/sysinst/arch/arc/md.c      |  11 ++---
 usr.sbin/sysinst/arch/atari/md.c    |   5 +-
 usr.sbin/sysinst/arch/cobalt/md.c   |  11 ++---
 usr.sbin/sysinst/arch/emips/md.c    |   5 +-
 usr.sbin/sysinst/arch/evbarm/md.c   |   5 +-
 usr.sbin/sysinst/arch/evbarm64/md.c |   5 +-
 usr.sbin/sysinst/arch/hp300/md.c    |   5 +-
 usr.sbin/sysinst/arch/i386/md.c     |  16 +++-----
 usr.sbin/sysinst/arch/mac68k/md.c   |   5 +-
 usr.sbin/sysinst/arch/mvme68k/md.c  |   5 +-
 usr.sbin/sysinst/arch/ofppc/md.c    |  17 +++------
 usr.sbin/sysinst/arch/prep/md.c     |  11 ++---
 usr.sbin/sysinst/arch/x68k/md.c     |   8 +--
 usr.sbin/sysinst/configmenu.c       |  19 +++++-----
 usr.sbin/sysinst/defs.h             |  12 +++++-
 usr.sbin/sysinst/disks.c            |   8 +--
 usr.sbin/sysinst/install.c          |   8 +--
 usr.sbin/sysinst/label.c            |   7 +--
 usr.sbin/sysinst/mbr.c              |  11 ++---
 usr.sbin/sysinst/menus.mi           |  66 +++++++++++++++++-------------------
 usr.sbin/sysinst/net.c              |  45 ++++++++++++------------
 usr.sbin/sysinst/partman.c          |  14 ++-----
 usr.sbin/sysinst/upgrade.c          |   8 +--
 usr.sbin/sysinst/util.c             |  61 ++++++++++++++++++++++++----------
 24 files changed, 179 insertions(+), 189 deletions(-)

diffs (truncated from 1133 to 300 lines):

diff -r 46a27aa946f9 -r ce740060bd53 usr.sbin/sysinst/arch/arc/md.c
--- a/usr.sbin/sysinst/arch/arc/md.c    Sun May 10 09:13:15 2015 +0000
+++ b/usr.sbin/sysinst/arch/arc/md.c    Sun May 10 10:14:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.3 2015/01/02 19:43:13 abs Exp $ */
+/*     $NetBSD: md.c,v 1.4 2015/05/10 10:14:02 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -299,8 +299,7 @@
                        if (part->mbrp_size < (MIN_FAT12_BOOT / 512)) {
                                msg_display(MSG_boottoosmall);
                                msg_display_add(MSG_nobootpart, 0);
-                               process_menu(MENU_yesno, NULL);
-                               if (!yesno)
+                               if (!ask_yesno(NULL))
                                        return 0;
                                nobootfs = 1;
                        }
@@ -339,16 +338,14 @@
        if (pm->bootsize < (MIN_FAT12_BOOT / 512)) {
                msg_display(MSG_boottoosmall);
                msg_display_add(MSG_reeditpart, 0);
-               process_menu(MENU_yesno, NULL);
-               if (!yesno)
+               if (!ask_yesno(NULL))
                        return 0;
                return 1;
        }
        if (pm->bootstart == 0 || pm->bootsize == 0) {
                msg_display(MSG_nobootpart);
                msg_display_add(MSG_reeditpart, 0);
-               process_menu(MENU_yesno, NULL);
-               if (!yesno)
+               if (!ask_yesno(NULL))
                        return 0;
                return 1;
        }
diff -r 46a27aa946f9 -r ce740060bd53 usr.sbin/sysinst/arch/atari/md.c
--- a/usr.sbin/sysinst/arch/atari/md.c  Sun May 10 09:13:15 2015 +0000
+++ b/usr.sbin/sysinst/arch/atari/md.c  Sun May 10 10:14:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
+/*     $NetBSD: md.c,v 1.3 2015/05/10 10:14:02 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -69,8 +69,7 @@
 md_make_bsd_partitions(void)
 {
        msg_display(MSG_infoahdilabel, pm->diskdev);
-       process_menu(MENU_noyes, NULL);
-       if (yesno) {
+       if (ask_noyes(NULL)) {
                run_program(RUN_DISPLAY, "ahdilabel /dev/r%sc", pm->diskdev);
        }
        if (!make_bsd_partitions())
diff -r 46a27aa946f9 -r ce740060bd53 usr.sbin/sysinst/arch/cobalt/md.c
--- a/usr.sbin/sysinst/arch/cobalt/md.c Sun May 10 09:13:15 2015 +0000
+++ b/usr.sbin/sysinst/arch/cobalt/md.c Sun May 10 10:14:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.3 2015/01/02 19:43:13 abs Exp $ */
+/*     $NetBSD: md.c,v 1.4 2015/05/10 10:14:02 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -317,8 +317,7 @@
                        if (part->mbrp_size < (MIN_EXT2FS_BOOT / 512)) {
                                msg_display(MSG_boottoosmall);
                                msg_display_add(MSG_nobootpart, 0);
-                               process_menu(MENU_yesno, NULL);
-                               if (!yesno)
+                               if (!ask_yesno(NULL))
                                        return 0;
                                nobootfs = 1;
                        }
@@ -357,16 +356,14 @@
        if (pm->bootsize < (MIN_EXT2FS_BOOT / 512)) {
                msg_display(MSG_boottoosmall);
                msg_display_add(MSG_reeditpart, 0);
-               process_menu(MENU_yesno, NULL);
-               if (!yesno)
+               if (!ask_yesno(NULL))
                        return 0;
                return 1;
        }
        if (pm->bootstart == 0 || pm->bootsize == 0) {
                msg_display(MSG_nobootpart);
                msg_display_add(MSG_reeditpart, 0);
-               process_menu(MENU_yesno, NULL);
-               if (!yesno)
+               if (!ask_yesno(NULL))
                        return 0;
                return 1;
        }
diff -r 46a27aa946f9 -r ce740060bd53 usr.sbin/sysinst/arch/emips/md.c
--- a/usr.sbin/sysinst/arch/emips/md.c  Sun May 10 09:13:15 2015 +0000
+++ b/usr.sbin/sysinst/arch/emips/md.c  Sun May 10 10:14:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $    */
+/*     $NetBSD: md.c,v 1.3 2015/05/10 10:14:02 martin Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -167,9 +167,8 @@
        strlcpy(ldr_path, target_expand("/boot.emips"), sizeof ldr_path);
 
        msg_display(MSG_dobootblks, "");
-       process_menu(MENU_noyes, NULL);
 
-       if (yesno) {
+       if (ask_noyes(NULL)) {
                if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
                    "/bin/dd if=%s of=/dev/reflash0c bs=512", ldr_path))
                        process_menu(MENU_ok, deconst("Warning: the system "
diff -r 46a27aa946f9 -r ce740060bd53 usr.sbin/sysinst/arch/evbarm/md.c
--- a/usr.sbin/sysinst/arch/evbarm/md.c Sun May 10 09:13:15 2015 +0000
+++ b/usr.sbin/sysinst/arch/evbarm/md.c Sun May 10 10:14:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.3 2015/03/12 11:32:16 joerg Exp $ */
+/*     $NetBSD: md.c,v 1.4 2015/05/10 10:14:02 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -276,8 +276,7 @@
                if (!hasboot) {
                        msg_display(MSG_nomsdospart);
                        msg_display_add(MSG_reeditpart, 0);
-                       process_menu(MENU_yesno, NULL);
-                       if (!yesno)
+                       if (!ask_yesno(NULL))
                                return 0;
                        return 1;
                }
diff -r 46a27aa946f9 -r ce740060bd53 usr.sbin/sysinst/arch/evbarm64/md.c
--- a/usr.sbin/sysinst/arch/evbarm64/md.c       Sun May 10 09:13:15 2015 +0000
+++ b/usr.sbin/sysinst/arch/evbarm64/md.c       Sun May 10 10:14:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.1 2014/12/28 11:51:11 martin Exp $ */
+/*     $NetBSD: md.c,v 1.2 2015/05/10 10:14:02 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -275,8 +275,7 @@
                if (!hasboot) {
                        msg_display(MSG_nomsdospart);
                        msg_display_add(MSG_reeditpart, 0);
-                       process_menu(MENU_yesno, NULL);
-                       if (!yesno)
+                       if (!ask_yesno(NULL))
                                return 0;
                        return 1;
                }
diff -r 46a27aa946f9 -r ce740060bd53 usr.sbin/sysinst/arch/hp300/md.c
--- a/usr.sbin/sysinst/arch/hp300/md.c  Sun May 10 09:13:15 2015 +0000
+++ b/usr.sbin/sysinst/arch/hp300/md.c  Sun May 10 10:14:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.3 2015/01/02 19:43:13 abs Exp $ */
+/*     $NetBSD: md.c,v 1.4 2015/05/10 10:14:02 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -150,8 +150,7 @@
                } else {
                        if (start >= pm->bsdlabel[part].pi_offset) {
                                msg_display(MSG_ordering, part+'a');
-                               process_menu(MENU_yesno, NULL);
-                               if (yesno)
+                               if (ask_yesno(NULL))
                                        return 0;
                        }
                        start = pm->bsdlabel[part].pi_offset;
diff -r 46a27aa946f9 -r ce740060bd53 usr.sbin/sysinst/arch/i386/md.c
--- a/usr.sbin/sysinst/arch/i386/md.c   Sun May 10 09:13:15 2015 +0000
+++ b/usr.sbin/sysinst/arch/i386/md.c   Sun May 10 10:14:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.5 2015/01/02 19:43:13 abs Exp $ */
+/*     $NetBSD: md.c,v 1.6 2015/05/10 10:14:02 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -110,8 +110,7 @@
        if (biosdisk != NULL && (biosdisk->bi_flags & BIFLAG_EXTINT13) == 0) {
                if (mbr_root_above_chs()) {
                        msg_display(MSG_partabovechs);
-                       process_menu(MENU_noyes, NULL);
-                       if (!yesno)
+                       if (!ask_noyes(NULL))
                                goto edit;
                        /* The user is shooting themselves in the foot here...*/
                } else
@@ -169,8 +168,7 @@
                 * don't all have bootmenu texts.
                 */
                msg_display(MSG_missing_bootmenu_text);
-               process_menu(MENU_yesno, NULL);
-               if (yesno)
+               if (ask_yesno(NULL))
                        goto edit;
        }
 
@@ -178,8 +176,7 @@
            (biosdisk == NULL || !(biosdisk->bi_flags & BIFLAG_EXTINT13))) {
                /* Need unsupported LBA reads to read boot sectors */
                msg_display(MSG_no_extended_bootmenu);
-               process_menu(MENU_noyes, NULL);
-               if (!yesno)
+               if (!ask_noyes(NULL))
                        goto edit;
        }
 
@@ -215,8 +212,7 @@
                /* Existing code would (probably) be ok */
                msg_display(MSG_updatembr);
 
-       process_menu(MENU_yesno, NULL);
-       if (!yesno)
+       if (!ask_yesno(NULL))
                /* User doesn't want to update mbr code */
                return 1;
 
@@ -226,7 +222,7 @@
 
        /* This shouldn't happen since the files are in the floppy fs... */
        msg_display("Can't find %s", bootcode);
-       process_menu(MENU_yesno, NULL);
+       ask_yesno(NULL);
 
        return 1;
 }
diff -r 46a27aa946f9 -r ce740060bd53 usr.sbin/sysinst/arch/mac68k/md.c
--- a/usr.sbin/sysinst/arch/mac68k/md.c Sun May 10 09:13:15 2015 +0000
+++ b/usr.sbin/sysinst/arch/mac68k/md.c Sun May 10 10:14:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
+/*     $NetBSD: md.c,v 1.3 2015/05/10 10:14:03 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1141,8 +1141,7 @@
        if (usefull) {
            if (map.usable_cnt > (map.root_cnt+map.swap_cnt+map.usr_cnt)) {
                msg_display (MSG_ovrwrite);
-               process_menu (MENU_noyes, NULL);
-               if (!yesno) {
+               if (!ask_noyes(NULL)) {
                        endwin();
                        return 0;
                }
diff -r 46a27aa946f9 -r ce740060bd53 usr.sbin/sysinst/arch/mvme68k/md.c
--- a/usr.sbin/sysinst/arch/mvme68k/md.c        Sun May 10 09:13:15 2015 +0000
+++ b/usr.sbin/sysinst/arch/mvme68k/md.c        Sun May 10 10:14:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.3 2015/01/02 19:43:13 abs Exp $       */
+/*     $NetBSD: md.c,v 1.4 2015/05/10 10:14:03 martin Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -148,8 +148,7 @@
                } else {
                        if (start > pm->bsdlabel[part].pi_offset) {
                                msg_display(MSG_ordering, part+'a');
-                               process_menu(MENU_yesno, NULL);
-                               if (yesno)
+                               if (ask_yesno(NULL))
                                        return 0;
                        }
                        start = pm->bsdlabel[part].pi_offset;
diff -r 46a27aa946f9 -r ce740060bd53 usr.sbin/sysinst/arch/ofppc/md.c
--- a/usr.sbin/sysinst/arch/ofppc/md.c  Sun May 10 09:13:15 2015 +0000
+++ b/usr.sbin/sysinst/arch/ofppc/md.c  Sun May 10 10:14:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $    */
+/*     $NetBSD: md.c,v 1.3 2015/05/10 10:14:03 martin Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -433,8 +433,7 @@
                            part->mbrp_size < (MIN_FAT12_BOOT/512)) {
                                msg_display(MSG_boottoosmall);
                                msg_display_add(MSG_nobootpartdisklabel, 0);
-                               process_menu(MENU_yesno, NULL);
-                               if (!yesno)
+                               if (!ask_yesno(NULL))
                                        return 0;
                                nobootfix = 1;
                        }
@@ -498,8 +497,7 @@
                    bprepsize >= (MIN_PREP_BOOT/512)))) {
                msg_display(MSG_bootnotright);
                msg_display_add(MSG_reeditpart, 0);
-               process_menu(MENU_yesno, NULL);
-               if (!yesno)
+               if (!ask_yesno(NULL))
                        return 0;
                return 1;
        }
@@ -510,8 +508,7 @@
                bprepsize < (MIN_PREP_BOOT/512))) {
                msg_display(MSG_preptoosmall);



Home | Main Index | Thread Index | Old Index