git: 5b90ffad8759 - main - stand/i386/zfsboot: Initialzie archsw at compile time.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 May 2025 15:33:37 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5b90ffad8759633aa79bc9736b1bb65e3a5248b7 commit 5b90ffad8759633aa79bc9736b1bb65e3a5248b7 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2025-05-26 03:46:32 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2025-05-26 15:30:37 +0000 stand/i386/zfsboot: Initialzie archsw at compile time. Also, add a comment about the weird reason we even have an archsw here at all. tl;dr: zfs code uses archsw when it aught not, but this hack here is easier than fixing that code properly. Sponsored by: Netflix --- stand/i386/zfsboot/zfsboot.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/stand/i386/zfsboot/zfsboot.c b/stand/i386/zfsboot/zfsboot.c index 07bf31eac7a1..4c8eae9b65e5 100644 --- a/stand/i386/zfsboot/zfsboot.c +++ b/stand/i386/zfsboot/zfsboot.c @@ -131,7 +131,16 @@ static int parse_cmd(void); static char gelipw[GELI_PW_MAXLEN]; #endif -struct arch_switch archsw; /* MI/MD interface boundary */ +/* + * Only because the zfs code requires access through archsw, otherwise the + * 'boot' programs don't need archsw. This is less than ideal, but this + * workaround is easier than many of the alternatives. + */ +struct arch_switch archsw = { /* MI/MD interface boundary */ + .arch_getdev = i386_getdev, + .arch_zfs_probe = i386_zfs_probe, +}; + static char boot_devname[2 * ZFS_MAXNAMELEN + 8]; /* disk or pool:dataset */ struct devsw *devsw[] = { @@ -184,15 +193,6 @@ main(void) */ bcache_init(32768, 512); - archsw.arch_autoload = NULL; - archsw.arch_getdev = i386_getdev; - archsw.arch_copyin = NULL; - archsw.arch_copyout = NULL; - archsw.arch_readin = NULL; - archsw.arch_isainb = NULL; - archsw.arch_isaoutb = NULL; - archsw.arch_zfs_probe = i386_zfs_probe; - bootinfo.bi_version = BOOTINFO_VERSION; bootinfo.bi_size = sizeof(bootinfo); bootinfo.bi_basemem = bios_basemem / 1024;