The branch main has been updated by imp:

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

commit bd7032e0b0580bc64455dc7c102e87dff6b06c8d
Author:     Wuyang Chung <[email protected]>
AuthorDate: 2025-07-27 14:13:48 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2025-09-14 03:29:00 +0000

    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
---
 sys/geom/concat/g_concat.c       | 2 --
 sys/geom/multipath/g_multipath.c | 3 ---
 sys/geom/part/g_part.c           | 2 --
 sys/geom/raid/g_raid.c           | 2 --
 4 files changed, 9 deletions(-)

diff --git a/sys/geom/concat/g_concat.c b/sys/geom/concat/g_concat.c
index fe83b54953cc..5461c6dd73d3 100644
--- a/sys/geom/concat/g_concat.c
+++ b/sys/geom/concat/g_concat.c
@@ -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);
diff --git a/sys/geom/multipath/g_multipath.c b/sys/geom/multipath/g_multipath.c
index 250a2c60ffee..4459bd9f03f5 100644
--- a/sys/geom/multipath/g_multipath.c
+++ b/sys/geom/multipath/g_multipath.c
@@ -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);
diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c
index 8a7f67d8a313..4c0d0c3aa902 100644
--- a/sys/geom/part/g_part.c
+++ b/sys/geom/part/g_part.c
@@ -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);
diff --git a/sys/geom/raid/g_raid.c b/sys/geom/raid/g_raid.c
index 590f28aaa46c..d35695482eea 100644
--- a/sys/geom/raid/g_raid.c
+++ b/sys/geom/raid/g_raid.c
@@ -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);

Reply via email to