call g_new_geom instead for callers that pass regular string to g_new_geomf

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1786
This commit is contained in:
Wuyang Chung 2025-07-29 11:42:24 +08:00 committed by Warner Losh
parent 1167a7d065
commit 656f7f43f2
23 changed files with 34 additions and 34 deletions

View file

@ -504,7 +504,7 @@ g_cache_create(struct g_class *mp, struct g_provider *pp,
return (NULL);
}
gp = g_new_geomf(mp, "%s", md->md_name);
gp = g_new_geom(mp, md->md_name);
sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
sc->sc_type = type;
sc->sc_bshift = bshift;
@ -665,7 +665,7 @@ g_cache_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
G_CACHE_DEBUG(3, "Tasting %s.", pp->name);
gp = g_new_geomf(mp, "cache:taste");
gp = g_new_geom(mp, "cache:taste");
gp->start = g_cache_start;
gp->orphan = g_cache_orphan;
gp->access = g_cache_access;

View file

@ -646,7 +646,7 @@ g_concat_create(struct g_class *mp, const struct g_concat_metadata *md,
return (NULL);
}
}
gp = g_new_geomf(mp, "%s", md->md_name);
gp = g_new_geom(mp, md->md_name);
sc = malloc(sizeof(*sc), M_CONCAT, M_WAITOK | M_ZERO);
gp->start = g_concat_start;
gp->spoiled = g_concat_orphan;
@ -753,7 +753,7 @@ g_concat_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
G_CONCAT_DEBUG(3, "Tasting %s.", pp->name);
gp = g_new_geomf(mp, "concat:taste");
gp = g_new_geom(mp, "concat:taste");
gp->start = g_concat_start;
gp->access = g_concat_access;
gp->orphan = g_concat_orphan;

View file

@ -769,7 +769,7 @@ g_eli_read_metadata_offset(struct g_class *mp, struct g_provider *pp,
g_topology_assert();
gp = g_new_geomf(mp, "eli:taste");
gp = g_new_geom(mp, "eli:taste");
gp->start = g_eli_start;
gp->access = g_std_access;
/*

View file

@ -571,7 +571,7 @@ g_gate_create(struct g_gate_ctl_create *ggio)
}
}
gp = g_new_geomf(&g_gate_class, "%s", name);
gp = g_new_geom(&g_gate_class, name);
gp->start = g_gate_start;
gp->access = g_gate_access;
gp->orphan = g_gate_orphan;

View file

@ -355,7 +355,7 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name);
g_topology_assert();
gp = g_new_geomf(mp, "%s", pp->name);
gp = g_new_geom(mp, pp->name);
sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
mtx_init(&sc->sc_mtx, "g_dev", NULL, MTX_DEF);
cp = g_new_consumer(gp);

View file

@ -529,7 +529,7 @@ g_slice_new(struct g_class *mp, u_int slices, struct g_provider *pp, struct g_co
g_topology_assert();
vp = (void **)extrap;
gp = g_new_geomf(mp, "%s", pp->name);
gp = g_new_geom(mp, pp->name);
gsp = g_slice_alloc(slices, extra);
gsp->start = start;
gp->softc = gsp;

View file

@ -2477,7 +2477,7 @@ g_journal_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
if (pp->geom->class == mp)
return (NULL);
gp = g_new_geomf(mp, "journal:taste");
gp = g_new_geom(mp, "journal:taste");
/* This orphan function should be never called. */
gp->orphan = g_journal_taste_orphan;
cp = g_new_consumer(gp);

View file

@ -399,7 +399,7 @@ g_label_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
if (strcmp(pp->geom->class->name, mp->name) == 0)
return (NULL);
gp = g_new_geomf(mp, "label:taste");
gp = g_new_geom(mp, "label:taste");
gp->start = g_label_start_taste;
gp->access = g_label_access_taste;
gp->orphan = g_label_orphan_taste;

View file

@ -537,7 +537,7 @@ g_llvm_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
g_topology_assert();
g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name);
gp = g_new_geomf(mp, "linux_lvm:taste");
gp = g_new_geom(mp, "linux_lvm:taste");
/* This orphan function should be never called. */
gp->orphan = g_llvm_taste_orphan;
cp = g_new_consumer(gp);
@ -557,7 +557,7 @@ g_llvm_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
vg = md.md_vg;
if (vg->vg_geom == NULL) {
/* new volume group */
gp = g_new_geomf(mp, "%s", vg->vg_name);
gp = g_new_geom(mp, vg->vg_name);
gp->start = g_llvm_start;
gp->spoiled = g_llvm_orphan;
gp->orphan = g_llvm_orphan;

View file

@ -3149,7 +3149,7 @@ g_mirror_create(struct g_class *mp, const struct g_mirror_metadata *md,
/*
* Action geom.
*/
gp = g_new_geomf(mp, "%s", md->md_name);
gp = g_new_geom(mp, md->md_name);
sc = malloc(sizeof(*sc), M_MIRROR, M_WAITOK | M_ZERO);
gp->start = g_mirror_start;
gp->orphan = g_mirror_orphan;
@ -3290,7 +3290,7 @@ g_mirror_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name);
G_MIRROR_DEBUG(2, "Tasting %s.", pp->name);
gp = g_new_geomf(mp, "mirror:taste");
gp = g_new_geom(mp, "mirror:taste");
/*
* This orphan function should be never called.
*/

View file

@ -433,7 +433,7 @@ g_mirror_ctl_create(struct gctl_req *req, struct g_class *mp)
g_topology_lock();
mediasize = OFF_MAX;
sectorsize = 0;
gp = g_new_geomf(mp, "%s", md.md_name);
gp = g_new_geom(mp, md.md_name);
gp->orphan = g_mirror_create_orphan;
cp = g_new_consumer(gp);
for (no = 1; no < *nargs; no++) {

View file

@ -291,7 +291,7 @@ g_mountver_create(struct gctl_req *req, struct g_class *mp, struct g_provider *p
return (EEXIST);
}
}
gp = g_new_geomf(mp, "%s", name);
gp = g_new_geom(mp, name);
sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
mtx_init(&sc->sc_mtx, "gmountver", NULL, MTX_DEF | MTX_RECURSE);
TAILQ_INIT(&sc->sc_queue);

View file

@ -549,7 +549,7 @@ g_multipath_create(struct g_class *mp, struct g_multipath_metadata *md)
}
}
gp = g_new_geomf(mp, "%s", md->md_name);
gp = g_new_geom(mp, md->md_name);
sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
mtx_init(&sc->sc_mtx, "multipath", NULL, MTX_DEF);
memcpy(sc->sc_uuid, md->md_uuid, sizeof(sc->sc_uuid));
@ -821,7 +821,7 @@ g_multipath_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
g_topology_assert();
gp = g_new_geomf(mp, "multipath:taste");
gp = g_new_geom(mp, "multipath:taste");
gp->start = g_multipath_start;
gp->access = g_multipath_access;
gp->orphan = g_multipath_orphan;

View file

@ -416,7 +416,7 @@ g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
return (EEXIST);
}
}
gp = g_new_geomf(mp, "%s", name);
gp = g_new_geom(mp, name);
sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
sc->sc_offset = offset;
sc->sc_explicitsize = explicitsize;

View file

@ -998,7 +998,7 @@ g_part_ctl_create(struct gctl_req *req, struct g_part_parms *gpp)
}
if (null == NULL)
gp = g_new_geomf(&g_part_class, "%s", pp->name);
gp = g_new_geom(&g_part_class, pp->name);
gp->softc = kobj_create((kobj_class_t)gpp->gpp_scheme, M_GEOM,
M_WAITOK);
table = gp->softc;
@ -1979,7 +1979,7 @@ g_part_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
* With that we become part of the topology. Obtain read access
* to the provider.
*/
gp = g_new_geomf(mp, "%s", pp->name);
gp = g_new_geom(mp, pp->name);
cp = g_new_consumer(gp);
cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
error = g_attach(cp, pp);

View file

@ -1876,7 +1876,7 @@ g_raid_create_node(struct g_class *mp,
g_topology_assert();
G_RAID_DEBUG(1, "Creating array %s.", name);
gp = g_new_geomf(mp, "%s", name);
gp = g_new_geom(mp, name);
sc = malloc(sizeof(*sc), M_RAID, M_WAITOK | M_ZERO);
gp->start = g_raid_start;
gp->orphan = g_raid_orphan;
@ -2217,7 +2217,7 @@ g_raid_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
geom = NULL;
status = G_RAID_MD_TASTE_FAIL;
gp = g_new_geomf(mp, "raid:taste");
gp = g_new_geom(mp, "raid:taste");
/*
* This orphan function should be never called.
*/

View file

@ -3164,7 +3164,7 @@ g_raid3_create(struct g_class *mp, const struct g_raid3_metadata *md)
/*
* Action geom.
*/
gp = g_new_geomf(mp, "%s", md->md_name);
gp = g_new_geom(mp, md->md_name);
sc = malloc(sizeof(*sc), M_RAID3, M_WAITOK | M_ZERO);
sc->sc_disks = malloc(sizeof(struct g_raid3_disk) * md->md_all, M_RAID3,
M_WAITOK | M_ZERO);
@ -3338,7 +3338,7 @@ g_raid3_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name);
G_RAID3_DEBUG(2, "Tasting %s.", pp->name);
gp = g_new_geomf(mp, "raid3:taste");
gp = g_new_geom(mp, "raid3:taste");
/* This orphan function should be never called. */
gp->orphan = g_raid3_taste_orphan;
cp = g_new_consumer(gp);

View file

@ -425,7 +425,7 @@ g_raid3_ctl_insert(struct gctl_req *req, struct g_class *mp)
no = gctl_get_paraml(req, "number", sizeof(*no));
else
no = NULL;
gp = g_new_geomf(mp, "raid3:insert");
gp = g_new_geom(mp, "raid3:insert");
gp->orphan = g_raid3_ctl_insert_orphan;
cp = g_new_consumer(gp);
error = g_attach(cp, pp);

View file

@ -545,7 +545,7 @@ g_shsec_create(struct g_class *mp, const struct g_shsec_metadata *md)
return (NULL);
}
}
gp = g_new_geomf(mp, "%s", md->md_name);
gp = g_new_geom(mp, md->md_name);
sc = malloc(sizeof(*sc), M_SHSEC, M_WAITOK | M_ZERO);
gp->start = g_shsec_start;
gp->spoiled = g_shsec_orphan;
@ -643,7 +643,7 @@ g_shsec_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
G_SHSEC_DEBUG(3, "Tasting %s.", pp->name);
gp = g_new_geomf(mp, "shsec:taste");
gp = g_new_geom(mp, "shsec:taste");
gp->start = g_shsec_start;
gp->access = g_shsec_access;
gp->orphan = g_shsec_orphan;

View file

@ -862,7 +862,7 @@ g_stripe_create(struct g_class *mp, const struct g_stripe_metadata *md,
return (NULL);
}
}
gp = g_new_geomf(mp, "%s", md->md_name);
gp = g_new_geom(mp, md->md_name);
sc = malloc(sizeof(*sc), M_STRIPE, M_WAITOK | M_ZERO);
gp->start = g_stripe_start;
gp->spoiled = g_stripe_orphan;
@ -963,7 +963,7 @@ g_stripe_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
G_STRIPE_DEBUG(3, "Tasting %s.", pp->name);
gp = g_new_geomf(mp, "stripe:taste");
gp = g_new_geom(mp, "stripe:taste");
gp->start = g_stripe_start;
gp->access = g_stripe_access;
gp->orphan = g_stripe_orphan;

View file

@ -246,7 +246,7 @@ g_union_ctl_create(struct gctl_req *req, struct g_class *mp, bool verbose)
return;
}
}
gp = g_new_geomf(mp, "%s", name);
gp = g_new_geom(mp, name);
sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
rw_init(&sc->sc_rwlock, "gunion");
TAILQ_INIT(&sc->sc_wiplist);

View file

@ -771,7 +771,7 @@ g_virstor_taste(struct g_class *mp, struct g_provider *pp, int flags)
LOG_MSG(LVL_DEBUG, "Tasting %s", pp->name);
/* We need a dummy geom to attach a consumer to the given provider */
gp = g_new_geomf(mp, "virstor:taste.helper");
gp = g_new_geom(mp, "virstor:taste.helper");
gp->start = (void *)invalid_call; /* XXX: hacked up so the */
gp->access = (void *)invalid_call; /* compiler doesn't complain. */
gp->orphan = (void *)invalid_call; /* I really want these to fail. */
@ -1085,7 +1085,7 @@ create_virstor_geom(struct g_class *mp, struct g_virstor_metadata *md)
return (NULL);
}
}
gp = g_new_geomf(mp, "%s", md->md_name);
gp = g_new_geom(mp, md->md_name);
gp->softc = NULL; /* to circumevent races that test softc */
gp->start = g_virstor_start;

View file

@ -102,7 +102,7 @@ g_zero_init(struct g_class *mp)
struct g_provider *pp;
g_topology_assert();
gp = g_new_geomf(mp, "gzero");
gp = g_new_geom(mp, "gzero");
gp->start = g_zero_start;
gp->access = g_std_access;
gpp = pp = g_new_providerf(gp, "%s", gp->name);