git: 75b7d39e116f - stable/13 - stand: efi_fmtdev can be reduced to devformat

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

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

commit 75b7d39e116f79563ea3d8d18f9bf3141f89a712
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-08-11 15:08:08 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-01-24 21:49:31 +0000

    stand: efi_fmtdev can be reduced to devformat
    
    devformat produces the same output as efi_fmtdev, so just use it to
    reduce on the dependencies.
    
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D35924
    
    (cherry picked from commit 1e7a2eb93a527a2f4b22be66788caf50e4ba1f89)
---
 stand/efi/include/efilib.h    |  1 -
 stand/efi/libefi/devicename.c | 26 --------------------------
 stand/efi/loader/bootinfo.c   |  2 +-
 stand/efi/loader/main.c       |  4 ++--
 4 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/stand/efi/include/efilib.h b/stand/efi/include/efilib.h
index 903e1f0d00e5..bbef44fca4b3 100644
--- a/stand/efi/include/efilib.h
+++ b/stand/efi/include/efilib.h
@@ -85,7 +85,6 @@ efi_exit_boot_services(UINTN key)
 }
 
 int efi_getdev(void **vdev, const char *devspec, const char **path);
-char *efi_fmtdev(void *vdev);
 int efi_setcurrdev(struct env_var *ev, int flags, const void *value);
 
 
diff --git a/stand/efi/libefi/devicename.c b/stand/efi/libefi/devicename.c
index cdf4830697fd..67a2e24d9da1 100644
--- a/stand/efi/libefi/devicename.c
+++ b/stand/efi/libefi/devicename.c
@@ -171,32 +171,6 @@ fail:
 	return (err);
 }
 
-char *
-efi_fmtdev(void *vdev)
-{
-	struct devdesc *dev = (struct devdesc *)vdev;
-	static char buf[SPECNAMELEN + 1];
-
-	switch(dev->d_dev->dv_type) {
-	case DEVT_NONE:
-		strcpy(buf, "(no device)");
-		break;
-
-	case DEVT_DISK:
-		return (disk_fmtdev(vdev));
-
-#ifdef EFI_ZFS_BOOT
-	case DEVT_ZFS:
-		return (zfs_fmtdev(dev));
-#endif
-	default:
-		sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
-		break;
-	}
-
-	return (buf);
-}
-
 /*
  * Set currdev to suit the value being supplied in (value)
  */
diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c
index da9577803b12..7f1a2f840f78 100644
--- a/stand/efi/loader/bootinfo.c
+++ b/stand/efi/loader/bootinfo.c
@@ -480,7 +480,7 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs)
 	}
 
 	/* Try reading the /etc/fstab file to select the root device */
-	getrootmount(efi_fmtdev((void *)rootdev));
+	getrootmount(devformat(rootdev));
 
 	addr = 0;
 	for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) {
diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index 0a5a03765ddc..7e6c1397781a 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -203,7 +203,7 @@ set_currdev_devdesc(struct devdesc *currdev)
 {
 	const char *devname;
 
-	devname = efi_fmtdev(currdev);
+	devname = devformat(currdev);
 	printf("Setting currdev to %s\n", devname);
 	set_currdev(devname);
 }
@@ -273,7 +273,7 @@ probe_zfs_currdev(uint64_t guid)
 	currdev.pool_guid = guid;
 	currdev.root_guid = 0;
 	set_currdev_devdesc((struct devdesc *)&currdev);
-	devname = efi_fmtdev(&currdev);
+	devname = devformat(&currdev.dd);
 	init_zfs_boot_options(devname);
 
 	rv = sanity_check_currdev();