git: f9ab67f200a4 - stable/13 - kboot: Use standard set_currdev

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 24 Jan 2023 22:14:35 UTC
The branch stable/13 has been updated by imp:

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

commit f9ab67f200a4c0e5fabdcd00332eac474848ab3a
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-01-13 21:21:16 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-01-24 21:49:47 +0000

    kboot: Use standard set_currdev
    
    Use the standard set_currdev instead of the (now very old) copy of
    setting currdev and loaddev directly. We do this only when we don't go
    find the ZFS pool to boot from.
    
    Sponsored by:           Netflix
    Reviewed by:            kevans
    Differential Revision:  https://reviews.freebsd.org/D38012
    
    (cherry picked from commit eb1795782cfc43523345f78737cc22277cea5056)
---
 stand/kboot/main.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/stand/kboot/main.c b/stand/kboot/main.c
index 91bc4c06e452..52c135f78582 100644
--- a/stand/kboot/main.c
+++ b/stand/kboot/main.c
@@ -198,15 +198,22 @@ main(int argc, const char **argv)
 		 * on active BEs, etc
 		 */
 		hostdisk_zfs_find_default();
-	}
+	} else
 #endif
+	{
+		/*
+		 * Otherwise, honor what's on the command line. If we've been
+		 * given a specific ZFS partition, then we'll honor it w/o BE
+		 * processing that would otherwise pick a different snapshot to
+		 * boot than the default one in the pool.
+		 */
+		set_currdev(bootdev);
+	}
 
 	printf("Boot device: %s with hostfs_root %s\n", bootdev, hostfs_root);
 
 	printf("\n%s", bootprog_info);
 
-	setenv("currdev", bootdev, 1);
-	setenv("loaddev", bootdev, 1);
 	setenv("LINES", "24", 1);
 	setenv("usefdt", "1", 1);