Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jul 2020 02:52:39 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363034 - in head/sys/geom: . cache concat eli journal label mirror mountver multipath nop part raid raid3 stripe vinum virstor
Message-ID:  <202007090252.0692qdFF075730@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Thu Jul  9 02:52:39 2020
New Revision: 363034
URL: https://svnweb.freebsd.org/changeset/base/363034

Log:
  sys/geom: consistently use _PATH_DEV instead of hardcoding "/dev/".
  
  Reviewed by:	cem
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D25565

Modified:
  head/sys/geom/cache/g_cache.c
  head/sys/geom/concat/g_concat.c
  head/sys/geom/eli/g_eli_ctl.c
  head/sys/geom/geom.h
  head/sys/geom/geom_dev.c
  head/sys/geom/geom_subr.c
  head/sys/geom/journal/g_journal.c
  head/sys/geom/label/g_label.c
  head/sys/geom/mirror/g_mirror_ctl.c
  head/sys/geom/mountver/g_mountver.c
  head/sys/geom/multipath/g_multipath.c
  head/sys/geom/nop/g_nop.c
  head/sys/geom/part/g_part.c
  head/sys/geom/raid/g_raid.c
  head/sys/geom/raid/md_ddf.c
  head/sys/geom/raid/md_intel.c
  head/sys/geom/raid/md_jmicron.c
  head/sys/geom/raid/md_nvidia.c
  head/sys/geom/raid/md_promise.c
  head/sys/geom/raid/md_sii.c
  head/sys/geom/raid3/g_raid3_ctl.c
  head/sys/geom/stripe/g_stripe.c
  head/sys/geom/vinum/geom_vinum_share.c
  head/sys/geom/virstor/g_virstor.h

Modified: head/sys/geom/cache/g_cache.c
==============================================================================
--- head/sys/geom/cache/g_cache.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/cache/g_cache.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -762,8 +762,8 @@ g_cache_ctl_create(struct gctl_req *req, struct g_clas
 		gctl_error(req, "No 'arg1' argument");
 		return;
 	}
-	if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-		name += strlen("/dev/");
+	if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+		name += strlen(_PATH_DEV);
 	pp = g_provider_by_name(name);
 	if (pp == NULL) {
 		G_CACHE_DEBUG(1, "Provider %s is invalid.", name);

Modified: head/sys/geom/concat/g_concat.c
==============================================================================
--- head/sys/geom/concat/g_concat.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/concat/g_concat.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -845,8 +845,8 @@ g_concat_ctl_create(struct gctl_req *req, struct g_cla
 			gctl_error(req, "No 'arg%u' argument.", no);
 			return;
 		}
-		if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-			name += strlen("/dev/");
+		if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+			name += strlen(_PATH_DEV);
 		pp = g_provider_by_name(name);
 		if (pp == NULL) {
 			G_CONCAT_DEBUG(1, "Disk %s is invalid.", name);
@@ -871,8 +871,8 @@ g_concat_ctl_create(struct gctl_req *req, struct g_cla
 			gctl_error(req, "No 'arg%d' argument.", no);
 			return;
 		}
-		if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-			name += strlen("/dev/");
+		if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+			name += strlen(_PATH_DEV);
 		pp = g_provider_by_name(name);
 		KASSERT(pp != NULL, ("Provider %s disappear?!", name));
 		if (g_concat_add_disk(sc, pp, no - 1) != 0) {

Modified: head/sys/geom/eli/g_eli_ctl.c
==============================================================================
--- head/sys/geom/eli/g_eli_ctl.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/eli/g_eli_ctl.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -120,8 +120,8 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class 
 		gctl_error(req, "No 'arg%u' argument.", 0);
 		return;
 	}
-	if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-		name += strlen("/dev/");
+	if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+		name += strlen(_PATH_DEV);
 	pp = g_provider_by_name(name);
 	if (pp == NULL) {
 		gctl_error(req, "Provider %s is invalid.", name);
@@ -186,8 +186,8 @@ g_eli_find_device(struct g_class *mp, const char *prov
 	struct g_provider *pp;
 	struct g_consumer *cp;
 
-	if (strncmp(prov, "/dev/", strlen("/dev/")) == 0)
-		prov += strlen("/dev/");
+	if (strncmp(prov, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+		prov += strlen(_PATH_DEV);
 	LIST_FOREACH(gp, &mp->geom, geom) {
 		sc = gp->softc;
 		if (sc == NULL)
@@ -373,8 +373,8 @@ g_eli_ctl_onetime(struct gctl_req *req, struct g_class
 		gctl_error(req, "No 'arg%u' argument.", 0);
 		return;
 	}
-	if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-		name += strlen("/dev/");
+	if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+		name += strlen(_PATH_DEV);
 	pp = g_provider_by_name(name);
 	if (pp == NULL) {
 		gctl_error(req, "Provider %s is invalid.", name);

Modified: head/sys/geom/geom.h
==============================================================================
--- head/sys/geom/geom.h	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/geom.h	Thu Jul  9 02:52:39 2020	(r363034)
@@ -419,6 +419,10 @@ g_free(void *ptr)
 
 int g_is_geom_thread(struct thread *td);
 
+#ifndef	_PATH_DEV
+#define	_PATH_DEV	"/dev/"
+#endif
+
 #endif /* _KERNEL */
 
 /* geom_ctl.c */

Modified: head/sys/geom/geom_dev.c
==============================================================================
--- head/sys/geom/geom_dev.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/geom_dev.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -166,7 +166,7 @@ init_dumpdev(struct cdev *dev)
 {
 	struct diocskerneldump_arg kda;
 	struct g_consumer *cp;
-	const char *devprefix = "/dev/", *devname;
+	const char *devprefix = _PATH_DEV, *devname;
 	int error;
 	size_t len;
 

Modified: head/sys/geom/geom_subr.c
==============================================================================
--- head/sys/geom/geom_subr.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/geom_subr.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -760,10 +760,6 @@ g_resize_provider(struct g_provider *pp, off_t size)
 	g_post_event(g_resize_provider_event, hh, M_WAITOK, NULL);
 }
 
-#ifndef	_PATH_DEV
-#define	_PATH_DEV	"/dev/"
-#endif
-
 struct g_provider *
 g_provider_by_name(char const *arg)
 {

Modified: head/sys/geom/journal/g_journal.c
==============================================================================
--- head/sys/geom/journal/g_journal.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/journal/g_journal.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -2511,7 +2511,7 @@ g_journal_find_device(struct g_class *mp, const char *
 	struct g_geom *gp;
 	struct g_provider *pp;
 
-	if (strncmp(name, "/dev/", 5) == 0)
+	if (strncmp(name, _PATH_DEV, 5) == 0)
 		name += 5;
 	LIST_FOREACH(gp, &mp->geom, geom) {
 		sc = gp->softc;

Modified: head/sys/geom/label/g_label.c
==============================================================================
--- head/sys/geom/label/g_label.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/label/g_label.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -442,8 +442,8 @@ g_label_ctl_create(struct gctl_req *req, struct g_clas
 		gctl_error(req, "No 'arg%d' argument", 1);
 		return;
 	}
-	if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-		name += strlen("/dev/");
+	if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+		name += strlen(_PATH_DEV);
 	pp = g_provider_by_name(name);
 	if (pp == NULL) {
 		G_LABEL_DEBUG(1, "Provider %s is invalid.", name);
@@ -467,8 +467,8 @@ g_label_skip_dir(const char *name)
 	char path[64];
 	u_int i;
 
-	if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-		name += strlen("/dev/");
+	if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+		name += strlen(_PATH_DEV);
 	if (strncmp(name, G_LABEL_DIR "/", strlen(G_LABEL_DIR "/")) == 0)
 		name += strlen(G_LABEL_DIR "/");
 	for (i = 0; g_labels[i] != NULL; i++) {

Modified: head/sys/geom/mirror/g_mirror_ctl.c
==============================================================================
--- head/sys/geom/mirror/g_mirror_ctl.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/mirror/g_mirror_ctl.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -131,7 +131,7 @@ g_mirror_find_disk(struct g_mirror_softc *sc, const ch
 	struct g_mirror_disk *disk;
 
 	sx_assert(&sc->sc_lock, SX_XLOCKED);
-	if (strncmp(name, "/dev/", 5) == 0)
+	if (strncmp(name, _PATH_DEV, 5) == 0)
 		name += 5;
 	LIST_FOREACH(disk, &sc->sc_disks, d_next) {
 		if (disk->d_consumer == NULL)
@@ -450,8 +450,8 @@ err:
 			g_topology_unlock();
 			return;
 		}
-		if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-			name += strlen("/dev/");
+		if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+			name += strlen(_PATH_DEV);
 		pp = g_provider_by_name(name);
 		if (pp == NULL) {
 			G_MIRROR_DEBUG(1, "Disk %s is invalid.", name);
@@ -501,8 +501,8 @@ err2:
 	for (attached = 0, no = 1; no < *nargs; no++) {
 		snprintf(param, sizeof(param), "arg%u", no);
 		name = gctl_get_asciiparam(req, param);
-		if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-			name += strlen("/dev/");
+		if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+			name += strlen(_PATH_DEV);
 		pp = g_provider_by_name(name);
 		if (pp == NULL) {
 			G_MIRROR_DEBUG(1, "Provider %s disappear?!", name);
@@ -686,7 +686,7 @@ g_mirror_ctl_insert(struct gctl_req *req, struct g_cla
 			gctl_error(req, "Provider %s already inserted.", name);
 			continue;
 		}
-		if (strncmp(name, "/dev/", 5) == 0)
+		if (strncmp(name, _PATH_DEV, 5) == 0)
 			name += 5;
 		pp = g_provider_by_name(name);
 		if (pp == NULL) {

Modified: head/sys/geom/mountver/g_mountver.c
==============================================================================
--- head/sys/geom/mountver/g_mountver.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/mountver/g_mountver.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -426,8 +426,8 @@ g_mountver_ctl_create(struct gctl_req *req, struct g_c
 			gctl_error(req, "No 'arg%d' argument", i);
 			return;
 		}
-		if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-			name += strlen("/dev/");
+		if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+			name += strlen(_PATH_DEV);
 		pp = g_provider_by_name(name);
 		if (pp == NULL) {
 			G_MOUNTVER_DEBUG(1, "Provider %s is invalid.", name);
@@ -483,8 +483,8 @@ g_mountver_ctl_destroy(struct gctl_req *req, struct g_
 			gctl_error(req, "No 'arg%d' argument", i);
 			return;
 		}
-		if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-			name += strlen("/dev/");
+		if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+			name += strlen(_PATH_DEV);
 		gp = g_mountver_find_geom(mp, name);
 		if (gp == NULL) {
 			G_MOUNTVER_DEBUG(1, "Device %s is invalid.", name);

Modified: head/sys/geom/multipath/g_multipath.c
==============================================================================
--- head/sys/geom/multipath/g_multipath.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/multipath/g_multipath.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -944,7 +944,7 @@ g_multipath_ctl_add_name(struct gctl_req *req, struct 
 	struct g_consumer *cp;
 	struct g_provider *pp;
 	const char *mpname;
-	static const char devpf[6] = "/dev/";
+	static const char devpf[6] = _PATH_DEV;
 	int error;
 
 	g_topology_assert();
@@ -1007,7 +1007,7 @@ g_multipath_ctl_prefer(struct gctl_req *req, struct g_
 	struct g_multipath_softc *sc;
 	struct g_consumer *cp;
 	const char *name, *mpname;
-	static const char devpf[6] = "/dev/";
+	static const char devpf[6] = _PATH_DEV;
 	int *nargs;
 
 	g_topology_assert();

Modified: head/sys/geom/nop/g_nop.c
==============================================================================
--- head/sys/geom/nop/g_nop.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/nop/g_nop.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -676,8 +676,8 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class 
 			gctl_error(req, "No 'arg%d' argument", i);
 			return;
 		}
-		if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-			name += strlen("/dev/");
+		if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+			name += strlen(_PATH_DEV);
 		pp = g_provider_by_name(name);
 		if (pp == NULL) {
 			G_NOP_DEBUG(1, "Provider %s is invalid.", name);
@@ -787,8 +787,8 @@ g_nop_ctl_configure(struct gctl_req *req, struct g_cla
 			gctl_error(req, "No 'arg%d' argument", i);
 			return;
 		}
-		if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-			name += strlen("/dev/");
+		if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+			name += strlen(_PATH_DEV);
 		pp = g_provider_by_name(name);
 		if (pp == NULL || pp->geom->class != mp) {
 			G_NOP_DEBUG(1, "Provider %s is invalid.", name);
@@ -857,8 +857,8 @@ g_nop_ctl_destroy(struct gctl_req *req, struct g_class
 			gctl_error(req, "No 'arg%d' argument", i);
 			return;
 		}
-		if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-			name += strlen("/dev/");
+		if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+			name += strlen(_PATH_DEV);
 		gp = g_nop_find_geom(mp, name);
 		if (gp == NULL) {
 			G_NOP_DEBUG(1, "Device %s is invalid.", name);
@@ -902,8 +902,8 @@ g_nop_ctl_reset(struct gctl_req *req, struct g_class *
 			gctl_error(req, "No 'arg%d' argument", i);
 			return;
 		}
-		if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-			name += strlen("/dev/");
+		if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+			name += strlen(_PATH_DEV);
 		pp = g_provider_by_name(name);
 		if (pp == NULL || pp->geom->class != mp) {
 			G_NOP_DEBUG(1, "Provider %s is invalid.", name);

Modified: head/sys/geom/part/g_part.c
==============================================================================
--- head/sys/geom/part/g_part.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/part/g_part.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -50,10 +50,6 @@ __FBSDID("$FreeBSD$");
 
 #include "g_part_if.h"
 
-#ifndef _PATH_DEV
-#define _PATH_DEV "/dev/"
-#endif
-
 static kobj_method_t g_part_null_methods[] = {
 	{ 0, 0 }
 };

Modified: head/sys/geom/raid/g_raid.c
==============================================================================
--- head/sys/geom/raid/g_raid.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/raid/g_raid.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -775,7 +775,7 @@ g_raid_open_consumer(struct g_raid_softc *sc, const ch
 
 	g_topology_assert();
 
-	if (strncmp(name, "/dev/", 5) == 0)
+	if (strncmp(name, _PATH_DEV, 5) == 0)
 		name += 5;
 	pp = g_provider_by_name(name);
 	if (pp == NULL)

Modified: head/sys/geom/raid/md_ddf.c
==============================================================================
--- head/sys/geom/raid/md_ddf.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/raid/md_ddf.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -2618,7 +2618,7 @@ g_raid_md_ctl_ddf(struct g_raid_md_object *md,
 				error = -2;
 				break;
 			}
-			if (strncmp(diskname, "/dev/", 5) == 0)
+			if (strncmp(diskname, _PATH_DEV, 5) == 0)
 				diskname += 5;
 
 			TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {

Modified: head/sys/geom/raid/md_intel.c
==============================================================================
--- head/sys/geom/raid/md_intel.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/raid/md_intel.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -2208,7 +2208,7 @@ g_raid_md_ctl_intel(struct g_raid_md_object *md,
 				error = -2;
 				break;
 			}
-			if (strncmp(diskname, "/dev/", 5) == 0)
+			if (strncmp(diskname, _PATH_DEV, 5) == 0)
 				diskname += 5;
 
 			TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {

Modified: head/sys/geom/raid/md_jmicron.c
==============================================================================
--- head/sys/geom/raid/md_jmicron.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/raid/md_jmicron.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -1268,7 +1268,7 @@ g_raid_md_ctl_jmicron(struct g_raid_md_object *md,
 				error = -2;
 				break;
 			}
-			if (strncmp(diskname, "/dev/", 5) == 0)
+			if (strncmp(diskname, _PATH_DEV, 5) == 0)
 				diskname += 5;
 
 			TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {

Modified: head/sys/geom/raid/md_nvidia.c
==============================================================================
--- head/sys/geom/raid/md_nvidia.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/raid/md_nvidia.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -1273,7 +1273,7 @@ g_raid_md_ctl_nvidia(struct g_raid_md_object *md,
 				error = -2;
 				break;
 			}
-			if (strncmp(diskname, "/dev/", 5) == 0)
+			if (strncmp(diskname, _PATH_DEV, 5) == 0)
 				diskname += 5;
 
 			TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {

Modified: head/sys/geom/raid/md_promise.c
==============================================================================
--- head/sys/geom/raid/md_promise.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/raid/md_promise.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -1609,7 +1609,7 @@ g_raid_md_ctl_promise(struct g_raid_md_object *md,
 				error = -2;
 				break;
 			}
-			if (strncmp(diskname, "/dev/", 5) == 0)
+			if (strncmp(diskname, _PATH_DEV, 5) == 0)
 				diskname += 5;
 
 			TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {

Modified: head/sys/geom/raid/md_sii.c
==============================================================================
--- head/sys/geom/raid/md_sii.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/raid/md_sii.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -1355,7 +1355,7 @@ g_raid_md_ctl_sii(struct g_raid_md_object *md,
 				error = -2;
 				break;
 			}
-			if (strncmp(diskname, "/dev/", 5) == 0)
+			if (strncmp(diskname, _PATH_DEV, 5) == 0)
 				diskname += 5;
 
 			TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {

Modified: head/sys/geom/raid3/g_raid3_ctl.c
==============================================================================
--- head/sys/geom/raid3/g_raid3_ctl.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/raid3/g_raid3_ctl.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -78,7 +78,7 @@ g_raid3_find_disk(struct g_raid3_softc *sc, const char
 	u_int n;
 
 	sx_assert(&sc->sc_lock, SX_XLOCKED);
-	if (strncmp(name, "/dev/", 5) == 0)
+	if (strncmp(name, _PATH_DEV, 5) == 0)
 		name += 5;
 	for (n = 0; n < sc->sc_ndisks; n++) {
 		disk = &sc->sc_disks[n];
@@ -431,7 +431,7 @@ g_raid3_ctl_insert(struct gctl_req *req, struct g_clas
 		no = gctl_get_paraml(req, "number", sizeof(*no));
 	else
 		no = NULL;
-	if (strncmp(name, "/dev/", 5) == 0)
+	if (strncmp(name, _PATH_DEV, 5) == 0)
 		name += 5;
 	g_topology_lock();
 	pp = g_provider_by_name(name);

Modified: head/sys/geom/stripe/g_stripe.c
==============================================================================
--- head/sys/geom/stripe/g_stripe.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/stripe/g_stripe.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -1096,8 +1096,8 @@ g_stripe_ctl_create(struct gctl_req *req, struct g_cla
 			gctl_error(req, "No 'arg%u' argument.", no);
 			return;
 		}
-		if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-			name += strlen("/dev/");
+		if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+			name += strlen(_PATH_DEV);
 		pp = g_provider_by_name(name);
 		if (pp == NULL) {
 			G_STRIPE_DEBUG(1, "Disk %s is invalid.", name);
@@ -1122,8 +1122,8 @@ g_stripe_ctl_create(struct gctl_req *req, struct g_cla
 			gctl_error(req, "No 'arg%u' argument.", no);
 			continue;
 		}
-		if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
-			name += strlen("/dev/");
+		if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+			name += strlen(_PATH_DEV);
 		pp = g_provider_by_name(name);
 		KASSERT(pp != NULL, ("Provider %s disappear?!", name));
 		if (g_stripe_add_disk(sc, pp, no - 1) != 0) {

Modified: head/sys/geom/vinum/geom_vinum_share.c
==============================================================================
--- head/sys/geom/vinum/geom_vinum_share.c	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/vinum/geom_vinum_share.c	Thu Jul  9 02:52:39 2020	(r363034)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #define	iswhite(c) (((c) == ' ') || ((c) == '\t'))
 #else
 #include <ctype.h>
+#include <paths.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -466,7 +467,7 @@ gv_new_drive(int max, char *token[])
 			}
 			ptr = token[j];
 
-			if (strncmp(ptr, "/dev/", 5) == 0)
+			if (strncmp(ptr, _PATH_DEV, 5) == 0)
 				ptr += 5;
 			strlcpy(d->device, ptr, sizeof(d->device));
 		} else {

Modified: head/sys/geom/virstor/g_virstor.h
==============================================================================
--- head/sys/geom/virstor/g_virstor.h	Thu Jul  9 00:34:07 2020	(r363033)
+++ head/sys/geom/virstor/g_virstor.h	Thu Jul  9 02:52:39 2020	(r363034)
@@ -112,8 +112,4 @@ struct g_virstor_bio_q {
 
 #endif	/* _KERNEL */
 
-#ifndef _PATH_DEV
-#define _PATH_DEV "/dev/"
-#endif
-
 #endif	/* !_G_VIRSTOR_H_ */



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