From nobody Thu Aug 11 16:27:48 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M3XKK0mwJz4Ys1b; Thu, 11 Aug 2022 16:27:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M3XKK06qgz3qKX; Thu, 11 Aug 2022 16:27:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660235269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1hyzvbDCUpCnNzwl+yFlFKq0Gg/hqdnayJpgc16idYw=; b=nQgBoq1YhQn+fusgu3oHvTBasbjhlQKHXwK0hO8R9BBm9H21yQR7q3gGrrJ4Agd62cGsCa t66cbW7bBpG8Di9TR+0bbneYM8YPzfrSS1AVjaS2mLyoxqCxkD3SZlDneTKKZZJeFq/nJT bm56HOzWjOzstyy9rkLjniStPi/n1DmH42k27D1ubtmDwubTYX+EHTB6faukZSgpZYgFMv oVqx0ijmNK2F0dUrQAPJghEL006k/xCkqkuAAUCHrv7kszfKqPxu3jSa2beI21kdkeojRu BGcfQUhxyyuIFiRVljH9pVuQbkOrduXxdWGZwC8A8QjA/aedd4QqR8BAsiiX0w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M3XKJ6LZqzyCC; Thu, 11 Aug 2022 16:27:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27BGRmft055528; Thu, 11 Aug 2022 16:27:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27BGRmjN055527; Thu, 11 Aug 2022 16:27:48 GMT (envelope-from git) Date: Thu, 11 Aug 2022 16:27:48 GMT Message-Id: <202208111627.27BGRmjN055527@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 1e9b23448a30 - main - stand: userboot_fmtdev can be reduced to devformat List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1e9b23448a3010e8403eae08ad890fe1eb75da8b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660235269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1hyzvbDCUpCnNzwl+yFlFKq0Gg/hqdnayJpgc16idYw=; b=Jo+Uc13T0XumxtZmC+lQ/II7ZCfqxmyJfLfn/jHN+llo3+iYoOsdJXWv5n6lAjJpF8UCpt NjQI2xyBBciQ++KDZSCDZrRsaE3y7oEneXtJv+4ImEKlOmY60iPtKqoLdJUHNPTWnAvRfa xjTqQw9X1sqtqM8fGQygEDZq4gTIzCOykzLHZMcOIO6nGjspFE3lEEEfSiUOBlMkj9An+j pfOyO2KPOCTY/B2oQxOfcmfyXvG6N2kS8nMRwrneksYijsUqFLa1dsaTV8ufr0OcZmo0DA cP/mSCJvJSrN3rb/ly9LToAuaJdwK3gdvtg67A+F3rX+3yUQ6p3cTIaFt6yAMg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660235269; a=rsa-sha256; cv=none; b=kjDMtDx+h8bD2JTTiDUZyaOX+R49Bvwuyg/9Y1ZwmW33k5E5jDMm5xakXAmQi8BXgJYv+e Ak455kHxecDWPGjADQvgyvSClKN9Or92NJ3cB1wR/YNEt3fSmwG1QHlSP1oiVOTTHtqTaH bQEE8IyeYarJUXBCVl0GbA6HYkScR5ZiiLBNjNtPOSoMWEscqSGgTx8hSQkOjWqh9R9e06 EPZZOvVM4V5M9ydUmwWpZZxjRIH4A72sVzxgSidAQqWHMqmpBSwFZTGAZ59v9ULFgoGHzP dH+sMrUUjX66GcEuKZloieQM85zzvqmhVtSmMPHu8W9WTHZfxk9uR6kjqhmy8g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1e9b23448a3010e8403eae08ad890fe1eb75da8b commit 1e9b23448a3010e8403eae08ad890fe1eb75da8b Author: Warner Losh AuthorDate: 2022-08-11 15:08:26 +0000 Commit: Warner Losh CommitDate: 2022-08-11 16:27:17 +0000 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 --- stand/userboot/userboot/bootinfo32.c | 6 +++--- stand/userboot/userboot/bootinfo64.c | 4 ++-- stand/userboot/userboot/devicename.c | 34 ---------------------------------- stand/userboot/userboot/libuserboot.h | 1 - stand/userboot/userboot/main.c | 2 +- 5 files changed, 6 insertions(+), 41 deletions(-) diff --git a/stand/userboot/userboot/bootinfo32.c b/stand/userboot/userboot/bootinfo32.c index ecd4ccf2edd8..b830b767906d 100644 --- a/stand/userboot/userboot/bootinfo32.c +++ b/stand/userboot/userboot/bootinfo32.c @@ -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 diff --git a/stand/userboot/userboot/bootinfo64.c b/stand/userboot/userboot/bootinfo64.c index 60887413e0ec..0086ef21b60a 100644 --- a/stand/userboot/userboot/bootinfo64.c +++ b/stand/userboot/userboot/bootinfo64.c @@ -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; diff --git a/stand/userboot/userboot/devicename.c b/stand/userboot/userboot/devicename.c index e770e6bf4bb1..45bf9bc6ebd8 100644 --- a/stand/userboot/userboot/devicename.c +++ b/stand/userboot/userboot/devicename.c @@ -176,40 +176,6 @@ fail: } -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) */ diff --git a/stand/userboot/userboot/libuserboot.h b/stand/userboot/userboot/libuserboot.h index 75732c6c0e38..eb3bada097e4 100644 --- a/stand/userboot/userboot/libuserboot.h +++ b/stand/userboot/userboot/libuserboot.h @@ -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); diff --git a/stand/userboot/userboot/main.c b/stand/userboot/userboot/main.c index d323d1f9789b..9ede0cd360e9 100644 --- a/stand/userboot/userboot/main.c +++ b/stand/userboot/userboot/main.c @@ -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) {