GEOM: remove the redundant if statement

g_provider_by_name already skips the leading '/dev/' so these if
statements are redundant. This changes some error messages, but those
aren't parsed. g_concat also calls g_concat_find_disk, but it also skips
/dev/ if present at the start of the string.

Reviewed by: imp, Elliot Mitchell
Pull Request: https://github.com/freebsd/freebsd-src/pull/1793
This commit is contained in:
Wuyang Chung authored and Warner Losh committed 2025-09-13 21:29:00 -06:00
1 parent 9dd78db9c3
commit bd7032e0b0
4 files changed
-9

No files matched your search

-2
View File
@@ -1107,8 +1107,6 @@ g_concat_ctl_append(struct gctl_req *req, struct g_class *mp)
gctl_error(req, "No 'arg%u' argument.", 1);
goto fail;
}
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
name += strlen("/dev/");
pp = g_provider_by_name(name);
if (pp == NULL) {
G_CONCAT_DEBUG(1, "Disk %s is invalid.", name);
-3
View File
@@ -949,7 +949,6 @@ g_multipath_ctl_add_name(struct gctl_req *req, struct g_class *mp,
struct g_consumer *cp;
struct g_provider *pp;
const char *mpname;
static const char devpf[6] = _PATH_DEV;
int error;
g_topology_assert();
@@ -966,8 +965,6 @@ g_multipath_ctl_add_name(struct gctl_req *req, struct g_class *mp,
}
sc = gp->softc;
if (strncmp(name, devpf, 5) == 0)
name += 5;
pp = g_provider_by_name(name);
if (pp == NULL) {
gctl_error(req, "Provider %s is invalid", name);
-2
View File
@@ -552,8 +552,6 @@ g_part_parm_provider(struct gctl_req *req, const char *name,
pname = gctl_get_asciiparam(req, name);
if (pname == NULL)
return (ENOATTR);
if (strncmp(pname, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
pname += sizeof(_PATH_DEV) - 1;
pp = g_provider_by_name(pname);
if (pp == NULL) {
gctl_error(req, "%d %s '%s'", EINVAL, name, pname);
-2
View File
@@ -775,8 +775,6 @@ g_raid_open_consumer(struct g_raid_softc *sc, const char *name)
g_topology_assert();
if (strncmp(name, _PATH_DEV, 5) == 0)
name += 5;
pp = g_provider_by_name(name);
if (pp == NULL)
return (NULL);