- Don't pass geom and provider names as format strings.

- Add __printflike() attributes.
- Remove an extra argument for the g_new_geomf() call in swapongeom_ev().

Reviewed by:	pjd
This commit is contained in:
Jaakko Heinonen 2012-11-20 12:32:18 +00:00
parent 7a43850530
commit 02c62349c9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=243333
15 changed files with 23 additions and 21 deletions

View File

@ -865,7 +865,7 @@ fdc_worker(struct fdc_data *fdc)
g_orphan_provider(fd->fd_provider, ENXIO);
fd->fd_provider->flags |= G_PF_WITHER;
fd->fd_provider =
g_new_providerf(fd->fd_geom, fd->fd_geom->name);
g_new_providerf(fd->fd_geom, "%s", fd->fd_geom->name);
g_error_provider(fd->fd_provider, 0);
g_topology_unlock();
return (fdc_biodone(fdc, ENXIO));
@ -2011,7 +2011,7 @@ fd_attach2(void *arg, int flag)
fd->fd_geom = g_new_geomf(&g_fd_class,
"fd%d", device_get_unit(fd->dev));
fd->fd_provider = g_new_providerf(fd->fd_geom, fd->fd_geom->name);
fd->fd_provider = g_new_providerf(fd->fd_geom, "%s", fd->fd_geom->name);
fd->fd_geom->softc = fd;
g_error_provider(fd->fd_provider, 0);
}

View File

@ -184,7 +184,7 @@ g_bde_create_geom(struct gctl_req *req, struct g_class *mp, struct g_provider *p
/* XXX: error check */
kproc_create(g_bde_worker, gp, &sc->thread, 0, 0,
"g_bde %s", gp->name);
pp = g_new_providerf(gp, gp->name);
pp = g_new_providerf(gp, "%s", gp->name);
pp->stripesize = kp->zone_cont;
pp->stripeoffset = 0;
pp->mediasize = sc->mediasize;

View File

@ -502,7 +502,7 @@ g_cache_create(struct g_class *mp, struct g_provider *pp,
return (NULL);
}
gp = g_new_geomf(mp, md->md_name);
gp = g_new_geomf(mp, "%s", md->md_name);
sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
sc->sc_type = type;
sc->sc_bshift = bshift;

View File

@ -271,8 +271,10 @@ int g_handleattr_int(struct bio *bp, const char *attribute, int val);
int g_handleattr_off_t(struct bio *bp, const char *attribute, off_t val);
int g_handleattr_str(struct bio *bp, const char *attribute, const char *str);
struct g_consumer * g_new_consumer(struct g_geom *gp);
struct g_geom * g_new_geomf(struct g_class *mp, const char *fmt, ...);
struct g_provider * g_new_providerf(struct g_geom *gp, const char *fmt, ...);
struct g_geom * g_new_geomf(struct g_class *mp, const char *fmt, ...)
__printflike(2, 3);
struct g_provider * g_new_providerf(struct g_geom *gp, const char *fmt, ...)
__printflike(2, 3);
void g_resize_provider(struct g_provider *pp, off_t size);
int g_retaste(struct g_class *mp);
void g_spoil(struct g_provider *pp, struct g_consumer *cp);

View File

@ -342,7 +342,7 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
}
}
g_topology_lock();
pp = g_new_providerf(gp, gp->name);
pp = g_new_providerf(gp, "%s", gp->name);
pp->mediasize = mediasize - sectorsize;
pp->sectorsize = sectorsize;
g_error_provider(pp, 0);

View File

@ -176,7 +176,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, pp->name);
gp = g_new_geomf(mp, "%s", pp->name);
cp = g_new_consumer(gp);
error = g_attach(cp, pp);
KASSERT(error == 0,

View File

@ -483,8 +483,8 @@ g_mbrext_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
((off_t)dp[0].dp_size) << 9ULL,
sectorsize,
"%*.*s%d",
strlen(gp->name) - 1,
strlen(gp->name) - 1,
(int)strlen(gp->name) - 1,
(int)strlen(gp->name) - 1,
gp->name,
slice + 5);
g_topology_unlock();

View File

@ -390,7 +390,7 @@ g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length
sbuf_vprintf(sb, fmt, ap);
va_end(ap);
sbuf_finish(sb);
pp = g_new_providerf(gp, sbuf_data(sb));
pp = g_new_providerf(gp, "%s", sbuf_data(sb));
pp2 = LIST_FIRST(&gp->consumer)->provider;
pp->stripesize = pp2->stripesize;
pp->stripeoffset = pp2->stripeoffset + offset;

View File

@ -69,7 +69,7 @@ struct g_slicer {
};
g_dumpconf_t g_slice_dumpconf;
int g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length, u_int sectorsize, const char *fmt, ...);
int g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length, u_int sectorsize, const char *fmt, ...) __printflike(7, 8);
void g_slice_spoiled(struct g_consumer *cp);
void g_slice_orphan(struct g_consumer *cp);
#define G_SLICE_CONFIG_CHECK 0

View File

@ -187,7 +187,7 @@ g_label_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
gp->spoiled = g_label_spoiled;
g_access(cp, -1, 0, 0);
g_slice_config(gp, 0, G_SLICE_CONFIG_SET, (off_t)0, mediasize,
pp->sectorsize, name);
pp->sectorsize, "%s", name);
G_LABEL_DEBUG(1, "Label for provider %s is %s.", pp->name, name);
return (gp);
}

View File

@ -250,7 +250,7 @@ g_mountver_create(struct gctl_req *req, struct g_class *mp, struct g_provider *p
return (EEXIST);
}
}
gp = g_new_geomf(mp, name);
gp = g_new_geomf(mp, "%s", name);
sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
mtx_init(&sc->sc_mtx, "gmountver", NULL, MTX_DEF);
TAILQ_INIT(&sc->sc_queue);
@ -262,7 +262,7 @@ g_mountver_create(struct gctl_req *req, struct g_class *mp, struct g_provider *p
gp->access = g_mountver_access;
gp->dumpconf = g_mountver_dumpconf;
newpp = g_new_providerf(gp, gp->name);
newpp = g_new_providerf(gp, "%s", gp->name);
newpp->mediasize = pp->mediasize;
newpp->sectorsize = pp->sectorsize;

View File

@ -429,7 +429,7 @@ g_multipath_create(struct g_class *mp, struct g_multipath_metadata *md)
}
}
gp = g_new_geomf(mp, md->md_name);
gp = g_new_geomf(mp, "%s", 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));

View File

@ -215,7 +215,7 @@ g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
return (EEXIST);
}
}
gp = g_new_geomf(mp, name);
gp = g_new_geomf(mp, "%s", name);
sc = g_malloc(sizeof(*sc), M_WAITOK);
sc->sc_offset = offset;
sc->sc_explicitsize = explicitsize;
@ -233,7 +233,7 @@ g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
gp->access = g_nop_access;
gp->dumpconf = g_nop_dumpconf;
newpp = g_new_providerf(gp, gp->name);
newpp = g_new_providerf(gp, "%s", gp->name);
newpp->mediasize = size;
newpp->sectorsize = secsize;

View File

@ -1003,7 +1003,7 @@ g_sched_create(struct gctl_req *req, struct g_class *mp,
}
}
gp = g_new_geomf(mp, name);
gp = g_new_geomf(mp, "%s", name);
dstgp = proxy ? pp->geom : gp; /* where do we link the provider */
sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
@ -1029,7 +1029,7 @@ g_sched_create(struct gctl_req *req, struct g_class *mp,
gp->access = g_sched_access;
gp->dumpconf = g_sched_dumpconf;
newpp = g_new_providerf(dstgp, gp->name);
newpp = g_new_providerf(dstgp, "%s", gp->name);
newpp->mediasize = pp->mediasize;
newpp->sectorsize = pp->sectorsize;

View File

@ -2612,7 +2612,7 @@ swapongeom_ev(void *arg, int flags)
}
mtx_unlock(&sw_dev_mtx);
if (gp == NULL)
gp = g_new_geomf(&g_swap_class, "swap", NULL);
gp = g_new_geomf(&g_swap_class, "swap");
cp = g_new_consumer(gp);
g_attach(cp, pp);
/*