Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Convert all static menu struct initializiat...



details:   https://anonhg.NetBSD.org/src/rev/a2fc59c0b391
branches:  trunk
changeset: 837137:a2fc59c0b391
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Nov 20 19:02:07 2018 +0000

description:
Convert all static menu struct initializiations to C99 name initializer
format - prerequisite for an upcoming evil hack (tm).
No functional change intended.

diffstat:

 usr.sbin/sysinst/bsddisklabel.c |   7 ++++---
 usr.sbin/sysinst/label.c        |  32 +++++++++++++++++---------------
 usr.sbin/sysinst/mbr.c          |  21 +++++++++++----------
 usr.sbin/sysinst/partman.c      |  22 +++++++++++++++-------
 usr.sbin/sysinst/run.c          |   7 ++++---
 5 files changed, 51 insertions(+), 38 deletions(-)

diffs (199 lines):

diff -r 21f99ce716d5 -r a2fc59c0b391 usr.sbin/sysinst/bsddisklabel.c
--- a/usr.sbin/sysinst/bsddisklabel.c   Tue Nov 20 17:48:19 2018 +0000
+++ b/usr.sbin/sysinst/bsddisklabel.c   Tue Nov 20 19:02:07 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bsddisklabel.c,v 1.5 2018/11/15 10:34:21 martin Exp $  */
+/*     $NetBSD: bsddisklabel.c,v 1.6 2018/11/20 19:02:07 martin Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -366,8 +366,9 @@
                { PART_ANY,     { '/', 'h', 'o', 'm', 'e', '\0' },      0,
                  0, 0, 0 },
        }, {
-               { NULL, OPT_NOMENU, 0, set_ptn_size },
-               { MSG_askunits, MENU_sizechoice, OPT_SUB, NULL },
+               { .opt_menu=OPT_NOMENU, .opt_action=set_ptn_size },
+               { .opt_name=MSG_askunits, .opt_menu=MENU_sizechoice,
+                 .opt_flags=OPT_SUB },
        }, 0, 0, NULL, { 0 } };
 
        if (maxpart > MAXPARTITIONS)
diff -r 21f99ce716d5 -r a2fc59c0b391 usr.sbin/sysinst/label.c
--- a/usr.sbin/sysinst/label.c  Tue Nov 20 17:48:19 2018 +0000
+++ b/usr.sbin/sysinst/label.c  Tue Nov 20 19:02:07 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: label.c,v 1.3 2015/05/10 10:14:02 martin Exp $ */
+/*     $NetBSD: label.c,v 1.4 2018/11/20 19:02:07 martin 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.3 2015/05/10 10:14:02 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.4 2018/11/20 19:02:07 martin Exp $");
 #endif
 
 #include <sys/types.h>
@@ -374,29 +374,31 @@
 {
        static menu_ent fs_fields[] = {
 #define PTN_MENU_FSKIND                0
-           {NULL, MENU_selfskind, OPT_SUB, NULL},
+           { .opt_menu=MENU_selfskind, .opt_flags=OPT_SUB },
 #define PTN_MENU_START         1
-           {NULL, OPT_NOMENU, 0, edit_fs_start},
+           { .opt_menu=OPT_NOMENU, .opt_action=edit_fs_start },
 #define PTN_MENU_SIZE          2
-           {NULL, OPT_NOMENU, 0, edit_fs_size},
+           { .opt_menu=OPT_NOMENU, .opt_action=edit_fs_size },
 #define PTN_MENU_END           3
-           {NULL, OPT_NOMENU, OPT_IGNORE, NULL},       /* displays 'end' */
+           { .opt_menu=OPT_NOMENU, .opt_flags=OPT_IGNORE },    /* displays 'end' */
 #define PTN_MENU_NEWFS         4
-           {NULL, OPT_NOMENU, 0, edit_fs_preserve},
+           { .opt_menu=OPT_NOMENU, .opt_action=edit_fs_preserve },
 #define PTN_MENU_ISIZE         5
-           {NULL, OPT_NOMENU, 0, edit_fs_isize},
+           { .opt_menu=OPT_NOMENU, .opt_action=edit_fs_isize },
 #define PTN_MENU_BSIZE         6
-           {NULL, MENU_selbsize, OPT_SUB, NULL},
+           { .opt_menu=MENU_selbsize, .opt_flags=OPT_SUB },
 #define PTN_MENU_FSIZE         7
-           {NULL, MENU_selfsize, OPT_SUB, NULL},
+           { .opt_menu=MENU_selfsize, .opt_flags=OPT_SUB },
 #define PTN_MENU_MOUNT         8
-           {NULL, OPT_NOMENU, 0, edit_fs_mount},
+           { .opt_menu=OPT_NOMENU, .opt_action=edit_fs_mount },
 #define PTN_MENU_MOUNTOPT      9
-           {NULL, MENU_mountoptions, OPT_SUB, NULL},
+           { .opt_menu=MENU_mountoptions, .opt_flags=OPT_SUB },
 #define PTN_MENU_MOUNTPT       10
-           {NULL, OPT_NOMENU, 0, edit_fs_mountpt},
-           {MSG_askunits, MENU_sizechoice, OPT_SUB, NULL},
-           {MSG_restore, OPT_NOMENU, 0, edit_restore},
+           { .opt_menu=OPT_NOMENU, .opt_action=edit_fs_mountpt },
+           { .opt_name=MSG_askunits, .opt_menu=MENU_sizechoice,
+             .opt_flags=OPT_SUB },
+           { .opt_name=MSG_restore, .opt_menu=OPT_NOMENU,
+             .opt_action=edit_restore},
        };
        static int fspart_menu = -1;
        static menu_ent all_fstypes[FSMAXTYPES];
diff -r 21f99ce716d5 -r a2fc59c0b391 usr.sbin/sysinst/mbr.c
--- a/usr.sbin/sysinst/mbr.c    Tue Nov 20 17:48:19 2018 +0000
+++ b/usr.sbin/sysinst/mbr.c    Tue Nov 20 19:02:07 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mbr.c,v 1.8 2018/11/16 19:55:18 martin Exp $ */
+/*     $NetBSD: mbr.c,v 1.9 2018/11/20 19:02:07 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -959,24 +959,25 @@
 
        static menu_ent ptn_opts[] = {
 #define PTN_OPT_TYPE           0
-               {NULL, OPT_NOMENU, 0, edit_mbr_type},
+               { .opt_menu=OPT_NOMENU, .opt_action=edit_mbr_type },
 #define PTN_OPT_START          1
-               {NULL, OPT_NOMENU, 0, edit_mbr_start},
+               { .opt_menu=OPT_NOMENU, .opt_action=edit_mbr_start },
 #define PTN_OPT_SIZE           2
-               {NULL, OPT_NOMENU, 0, edit_mbr_size},
+               { .opt_menu=OPT_NOMENU, .opt_action=edit_mbr_size },
 #define PTN_OPT_END            3
-               {NULL, OPT_NOMENU, OPT_IGNORE, NULL},   /* display end */
+               { .opt_menu=OPT_NOMENU, .opt_flags=OPT_IGNORE }, /* display end */
 #define PTN_OPT_ACTIVE         4
-               {NULL, OPT_NOMENU, 0, edit_mbr_active},
+               { .opt_menu=OPT_NOMENU, .opt_action=edit_mbr_active },
 #define PTN_OPT_INSTALL                5
-               {NULL, OPT_NOMENU, 0, edit_mbr_install},
+               { .opt_menu=OPT_NOMENU, .opt_action=edit_mbr_install },
 #ifdef BOOTSEL
 #define PTN_OPT_BOOTMENU       6
-               {NULL, OPT_NOMENU, 0, edit_mbr_bootmenu},
+               { .opt_menu=OPT_NOMENU, .opt_action=edit_mbr_bootmenu },
 #define PTN_OPT_BOOTDEFAULT    7
-               {NULL, OPT_NOMENU, 0, edit_mbr_bootdefault},
+               { .opt_menu=OPT_NOMENU, .opt_action=edit_mbr_bootdefault },
 #endif
-               {MSG_askunits, MENU_sizechoice, OPT_SUB, NULL},
+               { .opt_name=MSG_askunits, .opt_menu=MENU_sizechoice,
+                 .opt_flags=OPT_SUB },
        };
 
        if (ptn_menu == -1)
diff -r 21f99ce716d5 -r a2fc59c0b391 usr.sbin/sysinst/partman.c
--- a/usr.sbin/sysinst/partman.c        Tue Nov 20 17:48:19 2018 +0000
+++ b/usr.sbin/sysinst/partman.c        Tue Nov 20 19:02:07 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: partman.c,v 1.22 2018/05/18 12:23:22 joerg Exp $ */
+/*     $NetBSD: partman.c,v 1.23 2018/11/20 19:02:07 martin Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -234,8 +234,12 @@
 
        menu_ent menu_entries[menu_entries_count];
        for (i = 0; i < menu_entries_count - 1; i++)
-               menu_entries[i] = (menu_ent) {NULL, OPT_NOMENU, 0, action};
-       menu_entries[i] = (menu_ent) {MSG_fremove, OPT_NOMENU, OPT_EXIT, action};
+               menu_entries[i] = (menu_ent) {  .opt_menu=OPT_NOMENU,
+                                               .opt_action=action };
+       menu_entries[i] = (menu_ent) {  .opt_name=MSG_fremove,
+                                       .opt_menu=OPT_NOMENU,
+                                       .opt_flags=OPT_EXIT,
+                                       .opt_action=action };
 
        int menu_no = -1;
        menu_no = new_menu(NULL, menu_entries, menu_entries_count,
@@ -443,8 +447,10 @@
        raids_t *dev_ptr = arg;
 
        static menu_ent menuent_disk_adddel[] = {
-           {MSG_add, OPT_NOMENU, OPT_EXIT, pm_raid_disk_add}, 
-           {MSG_remove, OPT_NOMENU, OPT_EXIT, pm_raid_disk_del}
+           { .opt_name=MSG_add, .opt_menu=OPT_NOMENU, .opt_flags=OPT_EXIT,
+             .opt_action=pm_raid_disk_add },
+           { .opt_name=MSG_remove, .opt_menu=OPT_NOMENU, .opt_flags=OPT_EXIT,
+             .opt_action=pm_raid_disk_del }
        };
        static int menu_disk_adddel = -1;
        if (menu_disk_adddel == -1) {
@@ -1347,8 +1353,10 @@
        lvms_t *dev_ptr = arg;
 
        static menu_ent menuent_disk_adddel[] = {
-           {MSG_add, OPT_NOMENU, OPT_EXIT, pm_lvm_disk_add}, 
-           {MSG_remove, OPT_NOMENU, OPT_EXIT, pm_lvm_disk_del}
+           { .opt_name=MSG_add, .opt_menu=OPT_NOMENU, .opt_flags=OPT_EXIT,
+             .opt_action=pm_lvm_disk_add },
+           { .opt_name=MSG_remove, .opt_menu=OPT_NOMENU, .opt_flags=OPT_EXIT,
+             .opt_action=pm_lvm_disk_del }
        };
        static int menu_disk_adddel = -1;
        if (menu_disk_adddel == -1) {
diff -r 21f99ce716d5 -r a2fc59c0b391 usr.sbin/sysinst/run.c
--- a/usr.sbin/sysinst/run.c    Tue Nov 20 17:48:19 2018 +0000
+++ b/usr.sbin/sysinst/run.c    Tue Nov 20 19:02:07 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: run.c,v 1.6 2018/11/02 18:07:33 martin Exp $   */
+/*     $NetBSD: run.c,v 1.7 2018/11/20 19:02:07 martin Exp $   */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -79,8 +79,9 @@
 #define BUFSIZE 4096
 
 menu_ent logmenu [2] = {
-       { NULL, OPT_NOMENU, 0, log_flip},
-       { NULL, OPT_NOMENU, 0, script_flip} };
+       { .opt_menu=OPT_NOMENU, .opt_action=log_flip},
+       { .opt_menu=OPT_NOMENU, .opt_action=script_flip}
+};
 
 static void
 log_menu_label(menudesc *m, int opt, void *arg)



Home | Main Index | Thread Index | Old Index