From nobody Thu Aug 11 16:27:40 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 4M3XK91BKJz4YrxX; Thu, 11 Aug 2022 16:27:41 +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 4M3XK90TRYz3q3p; Thu, 11 Aug 2022 16:27:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660235261; 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=x6GX6Kq9NTrCx3OSmN409t68R1SyVfBZffpggs7/xo4=; b=jWm9EXPjWld5DTVwDeBC9MOGEcShbXHwZ3oASw//tw+//KM/ZWdXPKaI+lMT0zuYflCjYZ rHw6nbE8kxTnvOM+CORISA+o3R4nc96WZW8RKCIMpB7gEVwTQLGqWmzHTXFFUZeVN2B6Rh 7wGnmkuD1wnMJRwOkkXnL7TUtUq4vf5Z7n97iz9B7+qmPq6thM8/hkYNzK3K044p0hJKC0 VToIa55FtBKLOGhAYKHGIClmYtToeWVISCFH84Jnk3ulH46jlnHpueoppJQGbBDfXk5wN2 xDLjMgBmqedXqrVXLlZi10QumM/f71vUZjUUktGK+BsgQkkUlq8bLe79Rmvxrw== 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 4M3XK86gSdzy1H; Thu, 11 Aug 2022 16:27:40 +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 27BGRexj055354; Thu, 11 Aug 2022 16:27:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27BGRebO055353; Thu, 11 Aug 2022 16:27:40 GMT (envelope-from git) Date: Thu, 11 Aug 2022 16:27:40 GMT Message-Id: <202208111627.27BGRebO055353@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: dc472f670213 - main - stand: Add devformat to return formatted string for a device 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: dc472f67021320309ced970d3d26d30a04da0ef2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660235261; 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=x6GX6Kq9NTrCx3OSmN409t68R1SyVfBZffpggs7/xo4=; b=bfPy9av2hIufXXQuGlDnlZEblQyhEJKsDYO93Fkt/MNYJ1FBj9VLxODQNa2lWocGWvqE1a Y6i7zSzgjLWKfHKh4BPYgUb3fImYiTbeOP86VP7IkgRVLCLKpvVNyxye6Io5SrUFa9K6JU i82ELqbte5zFWWvVijs64d2XbuV/HXeYXUt742OQ2wu+NnquifR8f2X/8A+6UUBfRumY29 A4fQCrkrdhecZhyRuKrkRaD1JnTSRMTb56HjJlvB7rwPI56hya2jH26wF6L1LW2d78zLHH amMQ29WmcMpKx/jD0f8N8WEdaNKYztUsL0SkNhS0rC8zGT3YdwZZZPtKrCDptA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660235261; a=rsa-sha256; cv=none; b=eTXIHsbJX4jqi+4kgHjjQ37ZmeWNAuoX+TNWH+Ndc+46BRCHwbIZs5pVm1/h+ulfQk8Aet 019AfNAKQYGP/9IvKvYJzYzCOTlv1vnT6f7Xxdyd/gD/Y0Wpn83dgtfdmGJLjcYlEYvMcN F86RjGLkqwhFFtDQQW9/JiHSyZyHlqYW+9Xlx9KrPeJNmK298K3GzkAw0m/BXBjVojFfQP xoB0lOvtV66eluG221h/DAFiMdoVUQfBins9g9jVFV+5pcAzXXptTOh+Di0MBWhCefAuUN AAHvKm5f6pu9PjX/ZKuQP2UDV3KMj8hpWe4SlNMehfxv1UkSsi9EFJLc39CIsw== 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=dc472f67021320309ced970d3d26d30a04da0ef2 commit dc472f67021320309ced970d3d26d30a04da0ef2 Author: Warner Losh AuthorDate: 2022-08-11 15:06:09 +0000 Commit: Warner Losh CommitDate: 2022-08-11 16:27:16 +0000 stand: Add devformat to return formatted string for a device Use dv_fmtdev to return a formatted string for a device. If this is a null pointer, return the device name and unit followed by a colon (eg disk3:). Sponsored by: Netflix Reviewed by: tsoome (prior version) Differential Revision: https://reviews.freebsd.org/D35916 --- stand/libsa/dev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/stand/libsa/dev.c b/stand/libsa/dev.c index 1d1dd075580e..2ccdce22d596 100644 --- a/stand/libsa/dev.c +++ b/stand/libsa/dev.c @@ -56,3 +56,14 @@ noioctl(struct open_file *f __unused, u_long cmd __unused, void *data __unused) { return (EINVAL); } + +char * +devformat(struct devdesc *d) +{ + static char name[DEV_DEVLEN]; + + if (d->d_dev->dv_fmtdev != NULL) + return (d->d_dev->dv_fmtdev(d)); + snprintf(name, sizeof(name), "%s%d:", d->d_dev->dv_name, d->d_unit); + return (name); +}