From 362322294045943703e03dee263bbc237002525c Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 11 Aug 2022 09:09:03 -0600 Subject: [PATCH] stand: i386_fmtdev can be reduced to devformat devformat produces the same output as i386_fmtdev, so just use it to reduce on the dependencies. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D35927 --- stand/i386/libi386/bootinfo32.c | 4 ++-- stand/i386/libi386/bootinfo64.c | 2 +- stand/i386/libi386/devicename.c | 27 --------------------------- stand/i386/loader/main.c | 4 ++-- 4 files changed, 5 insertions(+), 32 deletions(-) diff --git a/stand/i386/libi386/bootinfo32.c b/stand/i386/libi386/bootinfo32.c index 23b02693cf48..7afb11c6a3b7 100644 --- a/stand/i386/libi386/bootinfo32.c +++ b/stand/i386/libi386/bootinfo32.c @@ -167,7 +167,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t } /* Try reading the /etc/fstab file to select the root device */ - getrootmount(i386_fmtdev((void *)rootdev)); + getrootmount(devformat(&rootdev->dd)); /* Do legacy rootdev guessing */ @@ -191,7 +191,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t rootdev->dd.d_dev->dv_type); } if (bootdevnr == -1) { - printf("root device %s invalid\n", i386_fmtdev(rootdev)); + printf("root device %s invalid\n", devformat(&rootdev->dd)); return (EINVAL); } free(rootdev); diff --git a/stand/i386/libi386/bootinfo64.c b/stand/i386/libi386/bootinfo64.c index 1ffa4188d926..e1dc704e0e1c 100644 --- a/stand/i386/libi386/bootinfo64.c +++ b/stand/i386/libi386/bootinfo64.c @@ -216,7 +216,7 @@ bi_load64(char *args, vm_offset_t *modulep, } /* Try reading the /etc/fstab file to select the root device */ - getrootmount(i386_fmtdev((void *)rootdev)); + getrootmount(devformat(&rootdev->dd)); addr = 0; /* find the last module in the chain */ diff --git a/stand/i386/libi386/devicename.c b/stand/i386/libi386/devicename.c index 061f2ba9ce9f..73445aeba172 100644 --- a/stand/i386/libi386/devicename.c +++ b/stand/i386/libi386/devicename.c @@ -171,33 +171,6 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path) return(err); } - -char * -i386_fmtdev(void *vdev) -{ - struct i386_devdesc *dev = (struct i386_devdesc *)vdev; - static char buf[128]; /* XXX device length constant? */ - - switch(dev->dd.d_dev->dv_type) { - case DEVT_NONE: - strcpy(buf, "(no device)"); - break; - - case DEVT_CD: - case DEVT_NET: - sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit); - break; - - case DEVT_DISK: - return (disk_fmtdev(vdev)); - - case DEVT_ZFS: - return(zfs_fmtdev(vdev)); - } - return(buf); -} - - /* * Set currdev to suit the value being supplied in (value) */ diff --git a/stand/i386/loader/main.c b/stand/i386/loader/main.c index c15c97c961b7..15d1c312b278 100644 --- a/stand/i386/loader/main.c +++ b/stand/i386/loader/main.c @@ -390,9 +390,9 @@ extract_currdev(void) init_zfs_boot_options(devformat(&new_currdev.dd)); #endif - env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev), + env_setenv("currdev", EV_VOLATILE, devformat(&new_currdev.dd), i386_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, i386_fmtdev(&new_currdev), + env_setenv("loaddev", EV_VOLATILE, devformat(&new_currdev.dd), env_noset, env_nounset); }