git: 26178196de73 - main - stand/userboot: Initialize archsw at compile time

From: Warner Losh <imp_at_FreeBSD.org>
Date: Mon, 26 May 2025 15:33:38 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=26178196de7345cdef047ef5b953101d0b50d41f

commit 26178196de7345cdef047ef5b953101d0b50d41f
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-05-26 03:52:34 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-05-26 15:30:38 +0000

    stand/userboot: Initialize archsw at compile time
    
    Sponsored by:           Netflix
---
 stand/userboot/userboot/main.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/stand/userboot/userboot/main.c b/stand/userboot/userboot/main.c
index cf1d9b12d69f..53b76c685d92 100644
--- a/stand/userboot/userboot/main.c
+++ b/stand/userboot/userboot/main.c
@@ -55,7 +55,16 @@ void *callbacks_arg;
 
 static jmp_buf jb;
 
-struct arch_switch archsw;	/* MI/MD interface boundary */
+struct arch_switch archsw = {	/* MI/MD interface boundary */
+	.arch_autoload = userboot_autoload,
+	.arch_getdev = userboot_getdev,
+	.arch_copyin = userboot_copyin,
+	.arch_copyout = userboot_copyout,
+	.arch_readin = userboot_readin,
+#if defined(USERBOOT_ZFS_SUPPORT)
+	.arch_zfs_probe = userboot_zfs_probe,
+#endif
+};
 
 static void	extract_currdev(void);
 static void	check_interpreter(void);
@@ -189,15 +198,6 @@ loader_main(struct loader_callbacks *cb, void *arg, int version, int ndisks)
 		putenv(var);
 	}
 
-	archsw.arch_autoload = userboot_autoload;
-	archsw.arch_getdev = userboot_getdev;
-	archsw.arch_copyin = userboot_copyin;
-	archsw.arch_copyout = userboot_copyout;
-	archsw.arch_readin = userboot_readin;
-#if defined(USERBOOT_ZFS_SUPPORT)
-	archsw.arch_zfs_probe = userboot_zfs_probe;
-#endif
-
 	/*
 	 * Initialise the block cache. Set the upper limit.
 	 */