Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Nov 2025 00:56:31 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d18ed8e19c3c - main - stand: Try to parse vdisk correctly
Message-ID:  <202511110056.5AB0uV1e071663@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=d18ed8e19c3cb264340987bdc191615108d8413a

commit d18ed8e19c3cb264340987bdc191615108d8413a
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-11-11 00:41:52 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-11-11 00:56:11 +0000

    stand: Try to parse vdisk correctly
    
    PR:                     289306
    Sponsored by:           Netflix
    Reviewed by:            dab
    MFC After:              5 days
    Differential Revision:  https://reviews.freebsd.org/D52500
---
 stand/common/disk.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/stand/common/disk.c b/stand/common/disk.c
index c1650f0fa1ec..47f882d5a532 100644
--- a/stand/common/disk.c
+++ b/stand/common/disk.c
@@ -417,7 +417,18 @@ disk_parsedev(struct devdesc **idev, const char *devspec, const char **path)
 	char *cp;
 	struct disk_devdesc *dev;
 
-	np = devspec + 4;	/* Skip the leading 'disk' */
+	/*
+	 * disk names look approximately like:
+	 *	v?disk([0-9]+(p[0-9]+|s[a-z])?)?:
+	 * so skip over the initial bit. We don't have access to the devsw
+	 * to check the name.
+	 */
+	if (strncmp(devspec, "disk", 4) == 0)
+		np = devspec + 4;
+	else if (strncmp(devspec, "vdisk", 5) == 0)
+		np = devspec + 5;
+	else
+		return (EINVAL);
 	unit = -1;
 	/*
 	 * If there is path/file info after the device info, then any missing


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202511110056.5AB0uV1e071663>