Module Name:    src
Committed By:   martin
Date:           Wed Nov 30 15:53:35 UTC 2022

Modified Files:
        src/usr.sbin/sysinst: bsddisklabel.c disks.c label.c msg.mi.de
            msg.mi.en msg.mi.es msg.mi.fr msg.mi.pl

Log Message:
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)


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/usr.sbin/sysinst/bsddisklabel.c
cvs rdiff -u -r1.90 -r1.91 src/usr.sbin/sysinst/disks.c
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/sysinst/label.c \
    src/usr.sbin/sysinst/msg.mi.fr
cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/sysinst/msg.mi.de
cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/sysinst/msg.mi.en
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/sysinst/msg.mi.es
cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/sysinst/msg.mi.pl

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.64 src/usr.sbin/sysinst/bsddisklabel.c:1.65
--- src/usr.sbin/sysinst/bsddisklabel.c:1.64	Thu Jun 16 16:27:30 2022
+++ src/usr.sbin/sysinst/bsddisklabel.c	Wed Nov 30 15:53:35 2022
@@ -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 @@ check_partitions(struct install_partitio
 				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;

Index: src/usr.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.90 src/usr.sbin/sysinst/disks.c:1.91
--- src/usr.sbin/sysinst/disks.c:1.90	Tue Aug 30 15:27:37 2022
+++ src/usr.sbin/sysinst/disks.c	Wed Nov 30 15:53:35 2022
@@ -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 @@ getfslabelname(uint f, uint f_version)
 		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 @@ make_filesystems(struct install_partitio
 			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 @@ make_filesystems(struct install_partitio
 				    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

Index: src/usr.sbin/sysinst/label.c
diff -u src/usr.sbin/sysinst/label.c:1.42 src/usr.sbin/sysinst/label.c:1.43
--- src/usr.sbin/sysinst/label.c:1.42	Thu Nov 17 06:40:41 2022
+++ src/usr.sbin/sysinst/label.c	Wed Nov 30 15:53:35 2022
@@ -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 @@ init_fs_type_ext(menudesc *menu, void *a
 	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
+		else if (edit->info.fs_sub_type == 2)
 			menu->cursel = 1;
+		else
+			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 @@ set_fstype_ext(menudesc *menu, void *arg
 	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 @@ set_fstype_ext(menudesc *menu, void *arg
 		}
 		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 @@ edit_fs_type_ext(menudesc *menu, void *a
 	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_fs_type(menudesc *menu, void *arg)
 
 	/* 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
+		else if (edit->info.fs_sub_type == 2)
 			menu->cursel = 1;
+		else
+			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 @@ set_fstype(menudesc *menu, void *arg)
 	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 @@ set_fstype(menudesc *menu, void *arg)
 		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 @@ edit_fs_type(menudesc *menu, void *arg)
 	/*
 	 * 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 @@ draw_edit_ptn_line(menudesc *m, int opt,
 		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);
Index: src/usr.sbin/sysinst/msg.mi.fr
diff -u src/usr.sbin/sysinst/msg.mi.fr:1.42 src/usr.sbin/sysinst/msg.mi.fr:1.43
--- src/usr.sbin/sysinst/msg.mi.fr:1.42	Fri Jul 22 16:51:14 2022
+++ src/usr.sbin/sysinst/msg.mi.fr	Wed Nov 30 15:53:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.fr,v 1.42 2022/07/22 16:51:14 christos Exp $	*/
+/*	$NetBSD: msg.mi.fr,v 1.43 2022/11/30 15:53:35 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1419,6 +1419,7 @@ message Too_large {Trop grand!}
 message free_space_line {Espace à $0..$1 $3 (taille $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)}

Index: src/usr.sbin/sysinst/msg.mi.de
diff -u src/usr.sbin/sysinst/msg.mi.de:1.41 src/usr.sbin/sysinst/msg.mi.de:1.42
--- src/usr.sbin/sysinst/msg.mi.de:1.41	Fri Jul 22 16:51:14 2022
+++ src/usr.sbin/sysinst/msg.mi.de	Wed Nov 30 15:53:35 2022
@@ -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 No_free_space {Kein freier Speic
 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)}

Index: src/usr.sbin/sysinst/msg.mi.en
diff -u src/usr.sbin/sysinst/msg.mi.en:1.44 src/usr.sbin/sysinst/msg.mi.en:1.45
--- src/usr.sbin/sysinst/msg.mi.en:1.44	Fri Jul 22 16:51:14 2022
+++ src/usr.sbin/sysinst/msg.mi.en	Wed Nov 30 15:53:35 2022
@@ -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 Too_large {Too large!}
 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)}

Index: src/usr.sbin/sysinst/msg.mi.es
diff -u src/usr.sbin/sysinst/msg.mi.es:1.37 src/usr.sbin/sysinst/msg.mi.es:1.38
--- src/usr.sbin/sysinst/msg.mi.es:1.37	Fri Jul 22 16:51:14 2022
+++ src/usr.sbin/sysinst/msg.mi.es	Wed Nov 30 15:53:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.es,v 1.37 2022/07/22 16:51:14 christos Exp $	*/
+/*	$NetBSD: msg.mi.es,v 1.38 2022/11/30 15:53:35 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1380,6 +1380,7 @@ message Too_large {Demasiado grande!}
 message free_space_line {Espacio en $0..$1 $3 (tamaño $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)}

Index: src/usr.sbin/sysinst/msg.mi.pl
diff -u src/usr.sbin/sysinst/msg.mi.pl:1.43 src/usr.sbin/sysinst/msg.mi.pl:1.44
--- src/usr.sbin/sysinst/msg.mi.pl:1.43	Fri Jul 22 16:51:14 2022
+++ src/usr.sbin/sysinst/msg.mi.pl	Wed Nov 30 15:53:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.pl,v 1.43 2022/07/22 16:51:14 christos Exp $	*/
+/*	$NetBSD: msg.mi.pl,v 1.44 2022/11/30 15:53:35 martin Exp $	*/
 /*	Based on english version: */
 /*	NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp       */
 
@@ -1327,6 +1327,7 @@ message Too_large {Zbyt duza wartosc!}
 message free_space_line {Miejsce od $0..$1 $3 (rozmiar $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)}

Reply via email to