Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Add support for FFSv2ea in the partition ty...



details:   https://anonhg.NetBSD.org/src/rev/257dae38311d
branches:  trunk
changeset: 372461:257dae38311d
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Nov 30 15:53:35 2022 +0000

description:
Add support for FFSv2ea in the partition type menus (internally setting
fs version to 3 for this, where 2 is FFSv2 and 1 is FFSv1)

diffstat:

 usr.sbin/sysinst/bsddisklabel.c |   4 +-
 usr.sbin/sysinst/disks.c        |  27 ++++++++++----
 usr.sbin/sysinst/label.c        |  72 +++++++++++++++++++++++-----------------
 usr.sbin/sysinst/msg.mi.de      |   3 +-
 usr.sbin/sysinst/msg.mi.en      |   3 +-
 usr.sbin/sysinst/msg.mi.es      |   3 +-
 usr.sbin/sysinst/msg.mi.fr      |   3 +-
 usr.sbin/sysinst/msg.mi.pl      |   3 +-
 8 files changed, 72 insertions(+), 46 deletions(-)

diffs (truncated from 346 to 300 lines):

diff -r 70a099a7c92f -r 257dae38311d usr.sbin/sysinst/bsddisklabel.c
--- a/usr.sbin/sysinst/bsddisklabel.c   Wed Nov 30 11:36:50 2022 +0000
+++ b/usr.sbin/sysinst/bsddisklabel.c   Wed Nov 30 15:53:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bsddisklabel.c,v 1.64 2022/06/16 16:27:30 tsutsui Exp $        */
+/*     $NetBSD: bsddisklabel.c,v 1.65 2022/11/30 15:53:35 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1993,7 +1993,7 @@
                                continue;
                        if (install->infos[i].fs_type != FS_BSDFFS)
                                continue;
-                       if (install->infos[i].fs_version != 2)
+                       if (install->infos[i].fs_version < 2)
                                continue;
                        hit_enter_to_continue(NULL, MSG_cannot_ufs2_root);
                        return false;
diff -r 70a099a7c92f -r 257dae38311d usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c  Wed Nov 30 11:36:50 2022 +0000
+++ b/usr.sbin/sysinst/disks.c  Wed Nov 30 15:53:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disks.c,v 1.90 2022/08/30 15:27:37 martin Exp $ */
+/*     $NetBSD: disks.c,v 1.91 2022/11/30 15:53:35 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -114,10 +114,14 @@
                return "mfs";
        else if (f == FS_EFI_SP)
                return msg_string(MSG_fs_type_efi_sp);
-       else if (f == FS_BSDFFS && f_version > 0)
-               return f_version == 2 ?
-                   msg_string(MSG_fs_type_ffsv2) : msg_string(MSG_fs_type_ffs);
-       else if (f == FS_EX2FS && f_version == 1)
+       else if (f == FS_BSDFFS && f_version > 0) {
+               switch (f_version) {
+               default:
+               case 1: return msg_string(MSG_fs_type_ffs);
+               case 2: return msg_string(MSG_fs_type_ffsv2);
+               case 3: return msg_string(MSG_fs_type_ffsv2ea);
+               }
+       } else if (f == FS_EX2FS && f_version == 1)
                return msg_string(MSG_fs_type_ext2old);
        else if (f >= __arraycount(fstypenames) || fstypenames[f] == NULL)
                return "invalid";
@@ -1278,7 +1282,7 @@
                        if (!ask_noyes(MSG_No_filesystem_newfs))
                                return EINVAL;
                        error = run_program(RUN_DISPLAY | RUN_PROGRESS,
-                           "/sbin/newfs -V2 -O2 %s", rdev);
+                           "/sbin/newfs -V2 -O2ea %s", rdev);
                }
 
                md_pre_mount(install, 0);
@@ -1349,9 +1353,16 @@
                                    ptn->fs_opt2);
                                strcat(opts, opt);
                        }
+                       const char *ffs_fmt;
+                       switch (ptn->fs_version) {
+                       case 3: ffs_fmt = "2ea"; break;
+                       case 2: ffs_fmt = "2"; break;
+                       case 1:
+                       default: ffs_fmt = "1"; break;
+                       }
                        asprintf(&newfs,
-                           "/sbin/newfs -V2 -O %d %s",
-                           ptn->fs_version == 2 ? 2 : 1, opts);
+                           "/sbin/newfs -V2 -O %s %s",
+                           ffs_fmt, opts);
                        if (ptn->mountflags & PUIMNT_LOG)
                                mnt_opts = "-tffs -o log";
                        else
diff -r 70a099a7c92f -r 257dae38311d usr.sbin/sysinst/label.c
--- a/usr.sbin/sysinst/label.c  Wed Nov 30 11:36:50 2022 +0000
+++ b/usr.sbin/sysinst/label.c  Wed Nov 30 15:53:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: label.c,v 1.42 2022/11/17 06:40:41 chs Exp $   */
+/*     $NetBSD: label.c,v 1.43 2022/11/30 15:53:35 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.42 2022/11/17 06:40:41 chs Exp $");
+__RCSID("$NetBSD: label.c,v 1.43 2022/11/30 15:53:35 martin Exp $");
 #endif
 
 #include <sys/types.h>
@@ -549,17 +549,19 @@
        size_t i, ndx, max = menu->numopts;
 
        if (t == FS_BSDFFS) {
-               if (edit->info.fs_sub_type == 2)
+               if (edit->info.fs_sub_type == 3)
                        menu->cursel = 0;
+               else if (edit->info.fs_sub_type == 2)
+                       menu->cursel = 1;
                else
-                       menu->cursel = 1;
+                       menu->cursel = 2;
                return;
        } else if (t == FS_EX2FS && edit->info.fs_sub_type == 1) {
-               menu->cursel = FSMAXTYPES;
+               menu->cursel = FSMAXTYPES+2;
                return;
        }
        /* skip the two FFS entries, and do not add FFS later again */
-       for (ndx = 2, i = 0; i < FSMAXTYPES && ndx < max; i++) {
+       for (ndx = 3, i = 0; i < FSMAXTYPES && ndx < max; i++) {
                if (i == FS_UNUSED)
                        continue;
                if (i == FS_BSDFFS)
@@ -589,17 +591,17 @@
        size_t i, ndx, max = menu->numopts;
        enum part_type pt;
 
-       if (menu->cursel == 0 || menu->cursel == 1) {
+       if (menu->cursel >= 0 && menu->cursel <= 2) {
                edit->info.fs_type = FS_BSDFFS;
-               edit->info.fs_sub_type = menu->cursel == 0 ? 2 : 1;
+               edit->info.fs_sub_type = 3-menu->cursel;
                goto found_type;
-       } else if (menu->cursel == FSMAXTYPES) {
+       } else if (menu->cursel == FSMAXTYPES+2) {
                edit->info.fs_type = FS_EX2FS;
                edit->info.fs_sub_type = 1;
                goto found_type;
        }
 
-       for (ndx = 2, i = 0; i < FSMAXTYPES && ndx < max; i++) {
+       for (ndx = 3, i = 0; i < FSMAXTYPES && ndx < max; i++) {
                if (i == FS_UNUSED)
                        continue;
                if (i == FS_BSDFFS)
@@ -614,12 +616,12 @@
                }
                ndx++;
                if (i == FS_MSDOS) {
-                       ndx++;
                        if (ndx == (size_t)menu->cursel) {
                                edit->info.fs_type = FS_EFI_SP;
                                edit->info.fs_sub_type = 0;
                                goto found_type;
                        }
+                       ndx++;
                }
        }
        return 1;
@@ -648,12 +650,15 @@
        int m;
        size_t i, ndx, cnt;
 
-       cnt = __arraycount(fstypenames)+1;
+       cnt = __arraycount(fstypenames)+2;
        opts = calloc(cnt, sizeof(*opts));
        if (opts == NULL)
                return 1;
 
        ndx = 0;
+       opts[ndx].opt_name = msg_string(MSG_fs_type_ffsv2ea);
+       opts[ndx].opt_action = set_fstype_ext;
+       ndx++;
        opts[ndx].opt_name = msg_string(MSG_fs_type_ffsv2);
        opts[ndx].opt_action = set_fstype_ext;
        ndx++;
@@ -701,14 +706,16 @@
 
        /* init menu->cursel from fs type in arg */
        if (edit->info.fs_type == FS_BSDFFS) {
-               if (edit->info.fs_sub_type == 2)
+               if (edit->info.fs_sub_type == 3)
                        menu->cursel = 0;
+               else if (edit->info.fs_sub_type == 2)
+                       menu->cursel = 1;
                else
-                       menu->cursel = 1;
+                       menu->cursel = 2;
        }
        for (i = 1; i < __arraycount(edit_fs_common_types); i++) {
                if (edit->info.fs_type == edit_fs_common_types[i]) {
-                       menu->cursel = i+1;
+                       menu->cursel = i+2;
                        break;
                }
        }
@@ -722,11 +729,11 @@
        int ndx;
 
        pt = edit->info.nat_type ? edit->info.nat_type->generic_ptype : PT_root;
-       if (menu->cursel < 2) {
+       if (menu->cursel < 3) {
                edit->info.fs_type = FS_BSDFFS;
-               edit->info.fs_sub_type = menu->cursel == 0 ? 2 : 1;
+               edit->info.fs_sub_type = 3-menu->cursel;
                edit->info.nat_type = edit->pset->parts->pscheme->
-                   get_fs_part_type(pt, FS_BSDFFS, 2);
+                   get_fs_part_type(pt, FS_BSDFFS, edit->info.fs_sub_type);
                if (edit->info.nat_type == NULL)
                        edit->info.nat_type = edit->pset->parts->
                            pscheme->get_generic_part_type(PT_root);
@@ -735,7 +742,7 @@
                edit->wanted->fs_version = edit->info.fs_sub_type;
                return 1;
        }
-       ndx = menu->cursel-1;
+       ndx = menu->cursel-2;
 
        if (ndx < 0 ||
            (size_t)ndx >= __arraycount(edit_fs_common_types))
@@ -783,24 +790,25 @@
        /*
         * Starting with a common type, show short menu first
         */
-       cnt = __arraycount(edit_fs_common_types) + 2;
+       cnt = __arraycount(edit_fs_common_types) + 3;
        opts = calloc(cnt, sizeof(*opts));
        if (opts == NULL)
                return 0;
 
-       /* special case entry 0: two FFS entries */
+       /* special case entry 0 and 1: three FFS entries */
        for (i = 0; i < __arraycount(edit_fs_common_types); i++) {
-               opts[i+1].opt_name = getfslabelname(edit_fs_common_types[i], 0);
-               opts[i+1].opt_action = set_fstype;
+               opts[i+2].opt_name = getfslabelname(edit_fs_common_types[i], 0);
+               opts[i+2].opt_action = set_fstype;
        }
-       /* duplicate FFS (at offset 1) into first entry */
-       opts[0] = opts[1];
-       opts[0].opt_name = msg_string(MSG_fs_type_ffsv2);
-       opts[1].opt_name = msg_string(MSG_fs_type_ffs);
+       /* duplicate FFS (at offset 2) into first two entries */
+       opts[0] = opts[1] = opts[2];
+       opts[0].opt_name = msg_string(MSG_fs_type_ffsv2ea);
+       opts[1].opt_name = msg_string(MSG_fs_type_ffsv2);
+       opts[2].opt_name = msg_string(MSG_fs_type_ffs);
        /* add secondary sub-menu */
-       assert(i+1 < (size_t)cnt);
-       opts[i+1].opt_name = msg_string(MSG_other_fs_type);
-       opts[i+1].opt_action = edit_fs_type_ext;
+       assert(i+2 < (size_t)cnt);
+       opts[i+2].opt_name = msg_string(MSG_other_fs_type);
+       opts[i+2].opt_action = edit_fs_type_ext;
 
        m = new_menu(MSG_Select_the_type, opts, cnt,
                30, 6, 0, 0, MC_SUBMENU | MC_SCROLL,
@@ -1183,7 +1191,9 @@
                switch (opt) {
                case 0:
                        if (edit->info.fs_type == FS_BSDFFS)
-                               if (edit->info.fs_sub_type == 2)
+                               if (edit->info.fs_sub_type == 3)
+                                       c = msg_string(MSG_fs_type_ffsv2ea);
+                               else if (edit->info.fs_sub_type == 2)
                                        c = msg_string(MSG_fs_type_ffsv2);
                                else
                                        c = msg_string(MSG_fs_type_ffs);
diff -r 70a099a7c92f -r 257dae38311d usr.sbin/sysinst/msg.mi.de
--- a/usr.sbin/sysinst/msg.mi.de        Wed Nov 30 11:36:50 2022 +0000
+++ b/usr.sbin/sysinst/msg.mi.de        Wed Nov 30 15:53:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.de,v 1.41 2022/07/22 16:51:14 christos Exp $    */
+/*     $NetBSD: msg.mi.de,v 1.42 2022/11/30 15:53:35 martin Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1403,6 +1403,7 @@
 message free_space_line {Speicherplatz bei $0..$1 $3 (Größe $2 $3)\n}
 
 message        fs_type_ffsv2   {FFSv2}
+message        fs_type_ffsv2ea {FFSv2ea}
 message        fs_type_ffs     {FFS}
 message        fs_type_efi_sp  {EFI Systempartition}
 message fs_type_ext2old        {Linux Ext2 (alt)}
diff -r 70a099a7c92f -r 257dae38311d usr.sbin/sysinst/msg.mi.en
--- a/usr.sbin/sysinst/msg.mi.en        Wed Nov 30 11:36:50 2022 +0000
+++ b/usr.sbin/sysinst/msg.mi.en        Wed Nov 30 15:53:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.en,v 1.44 2022/07/22 16:51:14 christos Exp $    */
+/*     $NetBSD: msg.mi.en,v 1.45 2022/11/30 15:53:35 martin Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1330,6 +1330,7 @@
 message free_space_line {Space at $0..$1 $3 (size $2 $3)\n}
 
 message        fs_type_ffsv2   {FFSv2}
+message        fs_type_ffsv2ea {FFSv2ea}
 message        fs_type_ffs     {FFS}
 message        fs_type_efi_sp  {EFI system partition}
 message fs_type_ext2old        {Linux Ext2 (old)}
diff -r 70a099a7c92f -r 257dae38311d usr.sbin/sysinst/msg.mi.es
--- a/usr.sbin/sysinst/msg.mi.es        Wed Nov 30 11:36:50 2022 +0000
+++ b/usr.sbin/sysinst/msg.mi.es        Wed Nov 30 15:53:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.es,v 1.37 2022/07/22 16:51:14 christos Exp $    */



Home | Main Index | Thread Index | Old Index