Module Name:    src
Committed By:   martin
Date:           Thu Jun  9 18:26:06 UTC 2022

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

Log Message:
Add support for explicitly selecting "EFI system partition" as a partition
type.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/usr.sbin/sysinst/disks.c
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/sysinst/label.c
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/sysinst/msg.mi.de
cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/sysinst/msg.mi.en
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/sysinst/msg.mi.es
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/sysinst/msg.mi.fr
cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/sysinst/msg.mi.pl
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/sysinst/partitions.h

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/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.81 src/usr.sbin/sysinst/disks.c:1.82
--- src/usr.sbin/sysinst/disks.c:1.81	Thu Jun  2 15:36:08 2022
+++ src/usr.sbin/sysinst/disks.c	Thu Jun  9 18:26:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.81 2022/06/02 15:36:08 martin Exp $ */
+/*	$NetBSD: disks.c,v 1.82 2022/06/09 18:26:06 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -112,6 +112,8 @@ getfslabelname(uint f, uint f_version)
 		return "tmpfs";
 	else if (f == FS_MFS)
 		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);

Index: src/usr.sbin/sysinst/label.c
diff -u src/usr.sbin/sysinst/label.c:1.33 src/usr.sbin/sysinst/label.c:1.34
--- src/usr.sbin/sysinst/label.c:1.33	Sun May  9 11:06:20 2021
+++ src/usr.sbin/sysinst/label.c	Thu Jun  9 18:26:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: label.c,v 1.33 2021/05/09 11:06:20 martin Exp $	*/
+/*	$NetBSD: label.c,v 1.34 2022/06/09 18:26:06 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.33 2021/05/09 11:06:20 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.34 2022/06/09 18:26:06 martin Exp $");
 #endif
 
 #include <sys/types.h>
@@ -525,11 +525,12 @@ renumber_partitions(struct partition_usa
  * Most often used file system types, we offer them in a first level menu.
  */
 static const uint edit_fs_common_types[] =
-    { FS_BSDFFS, FS_SWAP, FS_MSDOS, FS_BSDLFS, FS_EX2FS };
+    { FS_BSDFFS, FS_SWAP, FS_MSDOS, FS_EFI_SP, FS_BSDLFS, FS_EX2FS };
 
 /*
  * Functions for uncommon file system types - we offer the full list,
- * but put FFSv2 and FFSv1 at the front.
+ * but put FFSv2 and FFSv1 at the front and duplicat FS_MSDOS as
+ * EFI system partition.
  */
 static void
 init_fs_type_ext(menudesc *menu, void *arg)
@@ -561,6 +562,13 @@ init_fs_type_ext(menudesc *menu, void *a
 			menu->cursel = ndx;
 			break;
 		}
+		if (i == FS_MSDOS) {
+			ndx++;
+			if (t == FS_EFI_SP) {
+				menu->cursel = ndx;
+				break;
+			}
+		}
 		ndx++;
 	}
 }
@@ -596,6 +604,14 @@ set_fstype_ext(menudesc *menu, void *arg
 			goto found_type;
 		}
 		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;
+			}
+		}
 	}
 	return 1;
 
@@ -623,7 +639,7 @@ edit_fs_type_ext(menudesc *menu, void *a
 	int m;
 	size_t i, ndx, cnt;
 
-	cnt = __arraycount(fstypenames);
+	cnt = __arraycount(fstypenames)+1;
 	opts = calloc(cnt, sizeof(*opts));
 	if (opts == NULL)
 		return 1;
@@ -645,6 +661,11 @@ edit_fs_type_ext(menudesc *menu, void *a
 		opts[ndx].opt_name = fstypenames[i];
 		opts[ndx].opt_action = set_fstype_ext;
 		ndx++;
+		if (i == FS_MSDOS) {
+			opts[ndx] = opts[ndx-1];
+			opts[ndx].opt_name = getfslabelname(FS_EFI_SP, 0);
+			ndx++;
+		}
 	}
 	opts[ndx].opt_name = msg_string(MSG_fs_type_ext2old);
 	opts[ndx].opt_action = set_fstype_ext;

Index: src/usr.sbin/sysinst/msg.mi.de
diff -u src/usr.sbin/sysinst/msg.mi.de:1.38 src/usr.sbin/sysinst/msg.mi.de:1.39
--- src/usr.sbin/sysinst/msg.mi.de:1.38	Wed May 18 16:39:03 2022
+++ src/usr.sbin/sysinst/msg.mi.de	Thu Jun  9 18:26:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.de,v 1.38 2022/05/18 16:39:03 martin Exp $	*/
+/*	$NetBSD: msg.mi.de,v 1.39 2022/06/09 18:26:06 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1401,6 +1401,7 @@ message free_space_line {Speicherplatz b
 
 message	fs_type_ffsv2	{FFSv2}
 message	fs_type_ffs	{FFS}
+message	fs_type_efi_sp	{EFI Systempartition}
 message fs_type_ext2old	{Linux Ext2 (alt)}
 message	other_fs_type	{Anderer Typ}
 

Index: src/usr.sbin/sysinst/msg.mi.en
diff -u src/usr.sbin/sysinst/msg.mi.en:1.41 src/usr.sbin/sysinst/msg.mi.en:1.42
--- src/usr.sbin/sysinst/msg.mi.en:1.41	Wed May 18 16:39:03 2022
+++ src/usr.sbin/sysinst/msg.mi.en	Thu Jun  9 18:26:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.en,v 1.41 2022/05/18 16:39:03 martin Exp $	*/
+/*	$NetBSD: msg.mi.en,v 1.42 2022/06/09 18:26:06 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1328,6 +1328,7 @@ message free_space_line {Space at $0..$1
 
 message	fs_type_ffsv2	{FFSv2}
 message	fs_type_ffs	{FFS}
+message	fs_type_efi_sp	{EFI system partition}
 message fs_type_ext2old	{Linux Ext2 (old)}
 message	other_fs_type	{Other type}
 

Index: src/usr.sbin/sysinst/msg.mi.es
diff -u src/usr.sbin/sysinst/msg.mi.es:1.34 src/usr.sbin/sysinst/msg.mi.es:1.35
--- src/usr.sbin/sysinst/msg.mi.es:1.34	Wed May 18 16:39:03 2022
+++ src/usr.sbin/sysinst/msg.mi.es	Thu Jun  9 18:26:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.es,v 1.34 2022/05/18 16:39:03 martin Exp $	*/
+/*	$NetBSD: msg.mi.es,v 1.35 2022/06/09 18:26:06 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1378,6 +1378,7 @@ message free_space_line {Espacio en $0..
 
 message	fs_type_ffsv2	{FFSv2}
 message	fs_type_ffs	{FFS}
+message	fs_type_efi_sp	{EFI system partition}
 message fs_type_ext2old	{Linux Ext2 (old)}
 message	other_fs_type	{Other type}
 

Index: src/usr.sbin/sysinst/msg.mi.fr
diff -u src/usr.sbin/sysinst/msg.mi.fr:1.39 src/usr.sbin/sysinst/msg.mi.fr:1.40
--- src/usr.sbin/sysinst/msg.mi.fr:1.39	Wed May 18 16:39:03 2022
+++ src/usr.sbin/sysinst/msg.mi.fr	Thu Jun  9 18:26:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.fr,v 1.39 2022/05/18 16:39:03 martin Exp $	*/
+/*	$NetBSD: msg.mi.fr,v 1.40 2022/06/09 18:26:06 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1417,6 +1417,7 @@ message free_space_line {Espace à $0..$1
 
 message	fs_type_ffsv2	{FFSv2}
 message	fs_type_ffs	{FFS}
+message	fs_type_efi_sp	{EFI system partition}
 message fs_type_ext2old	{Linux Ext2 (old)}
 message	other_fs_type	{Other type}
 

Index: src/usr.sbin/sysinst/msg.mi.pl
diff -u src/usr.sbin/sysinst/msg.mi.pl:1.40 src/usr.sbin/sysinst/msg.mi.pl:1.41
--- src/usr.sbin/sysinst/msg.mi.pl:1.40	Wed May 18 16:39:03 2022
+++ src/usr.sbin/sysinst/msg.mi.pl	Thu Jun  9 18:26:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.pl,v 1.40 2022/05/18 16:39:03 martin Exp $	*/
+/*	$NetBSD: msg.mi.pl,v 1.41 2022/06/09 18:26:06 martin Exp $	*/
 /*	Based on english version: */
 /*	NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp       */
 
@@ -1325,6 +1325,7 @@ message free_space_line {Miejsce od $0..
 
 message	fs_type_ffsv2	{FFSv2}
 message	fs_type_ffs	{FFS}
+message	fs_type_efi_sp	{EFI system partition}
 message fs_type_ext2old	{Linux Ext2 (old)}
 message	other_fs_type	{Inny typ}
 

Index: src/usr.sbin/sysinst/partitions.h
diff -u src/usr.sbin/sysinst/partitions.h:1.27 src/usr.sbin/sysinst/partitions.h:1.28
--- src/usr.sbin/sysinst/partitions.h:1.27	Tue May 24 06:18:34 2022
+++ src/usr.sbin/sysinst/partitions.h	Thu Jun  9 18:26:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: partitions.h,v 1.27 2022/05/24 06:18:34 andvar Exp $	*/
+/*	$NetBSD: partitions.h,v 1.28 2022/06/09 18:26:06 martin Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -55,11 +55,21 @@
 #include <sys/disklabel.h>
 #undef FSTYPE_ENUMNAME
 
+/*
+ * Use random values (outside uint8_t range) to mark special file system
+ * types that are not in the FSTYPE enumeration.
+ */
 #ifndef	FS_TMPFS
-#define	FS_TMPFS	256	/* random value (outside uint8_t range) */
+#define	FS_TMPFS	256	/* tmpfs (prefered for /tmp if available) */
 #endif
 #ifndef	FS_MFS
-#define	FS_MFS		257	/* another random (out of range) value */
+#define	FS_MFS		257	/* mfs, alternative to tmpfs if that is
+				   not available */
+#endif
+#ifndef	FS_EFI_SP
+#define	FS_EFI_SP	258	/* EFI system partition, uses FS_MSDOS,
+				   but may have a different partition
+				   type */
 #endif
 
 #define	MAX_LABEL_LEN		128	/* max. length of a partition label */

Reply via email to