From nobody Sat Jun 01 11:14:43 2024 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 4Vry7S3yrSz5Mhng; Sat, 01 Jun 2024 11:14:44 +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 4Vry7S1zGcz3xB7; Sat, 1 Jun 2024 11:14:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717240484; 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=RI1qMWi5/XNoF+7WsTQ2aCUEdLvwaiRSCq1r+fz1B30=; b=DC+NNrTWjQ3w39AcOfz32SRO3l3BKkWqIr9sZKSRucG0E3oZ0cv6ahmN3WHyRFtVR34kct VpShNyC319Joh7Ey8YivEzWTfu+2GD/wlcAAmjndoKsV38uQVALCE6qOBNj/1cDtpljnNJ WGMA00ljnkXsEiM+Ukkef8c0R7uvIUkGDRRYRABd7HgCWjzcF8rFUMQJy20YvB0Yv70KiJ TBxsZuoUKPbvtT4KtWQ6jBmi8HUsePBrdLK7F/UnZLLQclBu/8kJ6E6NF4SFsEBL8+5V5p crdEpoQ2iajvzb0C/+tsJByw+h+Q/nCYe6eln0uxc6z2X79LbkOglwfUXbTn7Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717240484; a=rsa-sha256; cv=none; b=XB862L5iKHoxZkb2vXJ9Y6IHh4N4A6X0N4za87sgp8NXmHSoHmcR+RRE87FcHOlNvDWgNn DimVEkDTB+C6EODp3Yu0vHLzg6m1VOfJmJe4n1WW4hwDanTgWYEut6Mu02lIaEgx9kfmHd NqHUKiY1umQ4EDDJ6iID83FY1AGy+aZWNEnaXPs+tlkaT8Mim3fAiKlgpUVqw2d9XzlX4o +ZJSXrRz6/Vm1bEdbBktM12QctTT26ItZadDVy7LfnDTeDYHE+a5dz7yOq+ciPrF9MG9ZW elpQJ88qxBFbSlBwlhio9rmlHjyyV5gIVGwU7wpMf3II32O5HDCgTkoLk7cH1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717240484; 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=RI1qMWi5/XNoF+7WsTQ2aCUEdLvwaiRSCq1r+fz1B30=; b=fJ1VfxpcqKRG9A1D9YJ17NluyJyshr99/LtYEIAtmqnjVEi5vK3myYHrQSdewCxDC1+zfL tSTAIvtIRZsBZhCekTxazwRC4LhX6264VLIrEiUKbAYQmyN5v34czqXcz3cToca57lQJNX JBZhO4oVfGSoL+a3gbsRYxvWnuQkYWYVrjwGGte0/kF0b742QMGgJ8vnkJtmIwoEpAhFFj 1f/yj1Pn3qAAn1ardkLQZn3Z6lHVxjOHLl+LwSaIAEzEWfB2ar0/xjyCzfVF+CNYOBSxF9 p1dOMcT45vT9BW9VTXRL4JjIThCiCVncZ3LkvHlF2igD6diS+DLvqqgxSH73Fw== 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 4Vry7S0szvz15Tj; Sat, 1 Jun 2024 11:14:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 451BEhdJ057447; Sat, 1 Jun 2024 11:14:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 451BEhm6057444; Sat, 1 Jun 2024 11:14:43 GMT (envelope-from git) Date: Sat, 1 Jun 2024 11:14:43 GMT Message-Id: <202406011114.451BEhm6057444@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Chuck Tuffli Subject: git: ce75bfcac9cf - main - nvme: Change namespace device name 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chuck X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ce75bfcac9cfe0bdd2285faea86019455c6fa7ea Auto-Submitted: auto-generated The branch main has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=ce75bfcac9cfe0bdd2285faea86019455c6fa7ea commit ce75bfcac9cfe0bdd2285faea86019455c6fa7ea Author: Chuck Tuffli AuthorDate: 2024-06-01 11:08:24 +0000 Commit: Chuck Tuffli CommitDate: 2024-06-01 11:14:14 +0000 nvme: Change namespace device name Changes the device name for NVMe and NVMe-oF namespaces from using "ns" to "n" to be more compatible with other operating systems. For example, a device which was previously /dev/nvme0ns1 is now /dev/nvme0n1. Preserves the existing functionality by creating alias from nvmeXnY to nvmeXnsY. Reviewed by: imp MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D45414 --- sys/dev/nvme/nvme_ctrlr.c | 4 ++-- sys/dev/nvme/nvme_ns.c | 8 ++++++-- sys/dev/nvmf/host/nvmf_ns.c | 8 ++++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index d9bd1fce2864..155aedf2f31a 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1478,8 +1478,8 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) md_args.mda_mode = 0600; md_args.mda_unit = device_get_unit(dev); md_args.mda_si_drv1 = (void *)ctrlr; - status = make_dev_s(&md_args, &ctrlr->cdev, "nvme%d", - device_get_unit(dev)); + status = make_dev_s(&md_args, &ctrlr->cdev, "%s", + device_get_nameunit(dev)); if (status != 0) return (ENXIO); diff --git a/sys/dev/nvme/nvme_ns.c b/sys/dev/nvme/nvme_ns.c index 201cf9188c1e..b19fc8664407 100644 --- a/sys/dev/nvme/nvme_ns.c +++ b/sys/dev/nvme/nvme_ns.c @@ -604,10 +604,12 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t id, md_args.mda_unit = unit; md_args.mda_mode = 0600; md_args.mda_si_drv1 = ns; - res = make_dev_s(&md_args, &ns->cdev, "nvme%dns%d", - device_get_unit(ctrlr->dev), ns->id); + res = make_dev_s(&md_args, &ns->cdev, "%sn%d", + device_get_nameunit(ctrlr->dev), ns->id); if (res != 0) return (ENXIO); + ns->cdev->si_drv2 = make_dev_alias(ns->cdev, "%sns%d", + device_get_nameunit(ctrlr->dev), ns->id); ns->cdev->si_flags |= SI_UNMAPPED; @@ -618,6 +620,8 @@ void nvme_ns_destruct(struct nvme_namespace *ns) { + if (ns->cdev->si_drv2 != NULL) + destroy_dev(ns->cdev->si_drv2); if (ns->cdev != NULL) destroy_dev(ns->cdev); } diff --git a/sys/dev/nvmf/host/nvmf_ns.c b/sys/dev/nvmf/host/nvmf_ns.c index 3428cbadc974..30acbe815dbe 100644 --- a/sys/dev/nvmf/host/nvmf_ns.c +++ b/sys/dev/nvmf/host/nvmf_ns.c @@ -49,7 +49,7 @@ ns_printf(struct nvmf_namespace *ns, const char *fmt, ...) sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN); sbuf_set_drain(&sb, sbuf_printf_drain, NULL); - sbuf_printf(&sb, "%sns%u: ", device_get_nameunit(ns->sc->dev), + sbuf_printf(&sb, "%sn%u: ", device_get_nameunit(ns->sc->dev), ns->id); va_start(ap, fmt); @@ -371,10 +371,12 @@ nvmf_init_ns(struct nvmf_softc *sc, uint32_t id, mda.mda_gid = GID_WHEEL; mda.mda_mode = 0600; mda.mda_si_drv1 = ns; - error = make_dev_s(&mda, &ns->cdev, "%sns%u", + error = make_dev_s(&mda, &ns->cdev, "%sn%u", device_get_nameunit(sc->dev), id); if (error != 0) goto fail; + ns->cdev->si_drv2 = make_dev_alias(ns->cdev, "%sns%u", + device_get_nameunit(sc->dev), id); ns->cdev->si_flags |= SI_UNMAPPED; @@ -418,6 +420,8 @@ nvmf_destroy_ns(struct nvmf_namespace *ns) TAILQ_HEAD(, bio) bios; struct bio *bio; + if (ns->cdev->si_drv2 != NULL) + destroy_dev(ns->cdev->si_drv2); destroy_dev(ns->cdev); /*