stand: userboot_fmtdev can be reduced to devformat

devformat produces the same output as userboot_fmtdev, so just use it to
reduce on the dependencies. In addition, we don't need to use the
incomplete struct userboot_devdesc type, we can use struct devdesc
instead (in fact, there's no userboot_devdesc defined anywhere).

Sponsored by:		Netflix
Reviewed by:		jhb (prior version)
Differential Revision:	https://reviews.freebsd.org/D35925
This commit is contained in:
Warner Losh 2022-08-11 09:08:26 -06:00
parent 1e7a2eb93a
commit 1e9b23448a
5 changed files with 6 additions and 41 deletions

View File

@ -139,7 +139,7 @@ int
bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t *modulep, vm_offset_t *kernendp)
{
struct preloaded_file *xp, *kfp;
struct i386_devdesc *rootdev;
struct devdesc *rootdev;
struct file_metadata *md;
vm_offset_t addr;
vm_offset_t kernend;
@ -167,12 +167,12 @@ 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(userboot_fmtdev((void *)rootdev));
getrootmount(devformat(rootdev));
bootdevnr = 0;
#if 0
if (bootdevnr == -1) {
printf("root device %s invalid\n", i386_fmtdev(rootdev));
printf("root device %s invalid\n", devformat(rootdev));
return (EINVAL);
}
#endif

View File

@ -182,7 +182,7 @@ int
bi_load64(char *args, vm_offset_t *modulep, vm_offset_t *kernendp)
{
struct preloaded_file *xp, *kfp;
struct userboot_devdesc *rootdev;
struct devdesc *rootdev;
struct file_metadata *md;
vm_offset_t addr;
uint64_t kernend;
@ -211,7 +211,7 @@ bi_load64(char *args, vm_offset_t *modulep, vm_offset_t *kernendp)
}
/* Try reading the /etc/fstab file to select the root device */
getrootmount(userboot_fmtdev((void *)rootdev));
getrootmount(devformat(rootdev));
/* find the last module in the chain */
addr = 0;

View File

@ -176,40 +176,6 @@ userboot_parsedev(struct disk_devdesc **dev, const char *devspec,
}
char *
userboot_fmtdev(void *vdev)
{
struct devdesc *dev = (struct devdesc *)vdev;
static char buf[128]; /* XXX device length constant? */
switch(dev->d_dev->dv_type) {
case DEVT_NONE:
strcpy(buf, "(no device)");
break;
case DEVT_CD:
sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
break;
case DEVT_DISK:
return (disk_fmtdev(vdev));
case DEVT_NET:
sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
break;
case DEVT_ZFS:
#if defined(USERBOOT_ZFS_SUPPORT)
return (zfs_fmtdev(vdev));
#else
sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
#endif
break;
}
return (buf);
}
/*
* Set currdev to suit the value being supplied in (value)
*/

View File

@ -57,7 +57,6 @@ extern ssize_t userboot_copyin(const void *, vm_offset_t, size_t);
extern ssize_t userboot_copyout(vm_offset_t, void *, size_t);
extern ssize_t userboot_readin(readin_handle_t, vm_offset_t, size_t);
extern int userboot_getdev(void **, const char *, const char **);
char *userboot_fmtdev(void *vdev);
int userboot_setcurrdev(struct env_var *ev, int flags, const void *value);
int bi_getboothowto(char *kargs);

View File

@ -285,7 +285,7 @@ extract_currdev(void)
dd = &dev.dd;
}
set_currdev(userboot_fmtdev(dd));
set_currdev(devformat(dd));
#if defined(USERBOOT_ZFS_SUPPORT)
if (userboot_zfs_found) {