summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjh <jh@FreeBSD.org>2012-11-20 12:32:18 +0000
committerjh <jh@FreeBSD.org>2012-11-20 12:32:18 +0000
commit25dd09b99661e08017f7e5059f2aaa0a95cb0e65 (patch)
treed75016205cbfeb373d0f3a16c6943a09f85df034
parent7df2814837ae2585cc6b0a8006fd6b2ff6c4bdcc (diff)
downloadFreeBSD-src-25dd09b99661e08017f7e5059f2aaa0a95cb0e65.zip
FreeBSD-src-25dd09b99661e08017f7e5059f2aaa0a95cb0e65.tar.gz
- 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
-rw-r--r--sys/dev/fdc/fdc.c4
-rw-r--r--sys/geom/bde/g_bde.c2
-rw-r--r--sys/geom/cache/g_cache.c2
-rw-r--r--sys/geom/geom.h6
-rw-r--r--sys/geom/geom_aes.c2
-rw-r--r--sys/geom/geom_dev.c2
-rw-r--r--sys/geom/geom_mbr.c4
-rw-r--r--sys/geom/geom_slice.c2
-rw-r--r--sys/geom/geom_slice.h2
-rw-r--r--sys/geom/label/g_label.c2
-rw-r--r--sys/geom/mountver/g_mountver.c4
-rw-r--r--sys/geom/multipath/g_multipath.c2
-rw-r--r--sys/geom/nop/g_nop.c4
-rw-r--r--sys/geom/sched/g_sched.c4
-rw-r--r--sys/vm/swap_pager.c2
15 files changed, 23 insertions, 21 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 52260c1..985e229 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -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);
}
diff --git a/sys/geom/bde/g_bde.c b/sys/geom/bde/g_bde.c
index a6fcf2a..e882bb8 100644
--- a/sys/geom/bde/g_bde.c
+++ b/sys/geom/bde/g_bde.c
@@ -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;
diff --git a/sys/geom/cache/g_cache.c b/sys/geom/cache/g_cache.c
index 378c2f2..ba701ac 100644
--- a/sys/geom/cache/g_cache.c
+++ b/sys/geom/cache/g_cache.c
@@ -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;
diff --git a/sys/geom/geom.h b/sys/geom/geom.h
index 75bfcc2..351b05d 100644
--- a/sys/geom/geom.h
+++ b/sys/geom/geom.h
@@ -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);
diff --git a/sys/geom/geom_aes.c b/sys/geom/geom_aes.c
index 77e55f7..c9f0790 100644
--- a/sys/geom/geom_aes.c
+++ b/sys/geom/geom_aes.c
@@ -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);
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c
index a32aaa1..224b5d6 100644
--- a/sys/geom/geom_dev.c
+++ b/sys/geom/geom_dev.c
@@ -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,
diff --git a/sys/geom/geom_mbr.c b/sys/geom/geom_mbr.c
index 42a9c8e..86ee860 100644
--- a/sys/geom/geom_mbr.c
+++ b/sys/geom/geom_mbr.c
@@ -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();
diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c
index 74b8983..ddab089 100644
--- a/sys/geom/geom_slice.c
+++ b/sys/geom/geom_slice.c
@@ -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;
diff --git a/sys/geom/geom_slice.h b/sys/geom/geom_slice.h
index cb7fbab..de0c9b0 100644
--- a/sys/geom/geom_slice.h
+++ b/sys/geom/geom_slice.h
@@ -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
diff --git a/sys/geom/label/g_label.c b/sys/geom/label/g_label.c
index 0d8a3b4..0ea8850 100644
--- a/sys/geom/label/g_label.c
+++ b/sys/geom/label/g_label.c
@@ -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);
}
diff --git a/sys/geom/mountver/g_mountver.c b/sys/geom/mountver/g_mountver.c
index 6858b31..eafccc8 100644
--- a/sys/geom/mountver/g_mountver.c
+++ b/sys/geom/mountver/g_mountver.c
@@ -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;
diff --git a/sys/geom/multipath/g_multipath.c b/sys/geom/multipath/g_multipath.c
index 7ca0082..8b63376 100644
--- a/sys/geom/multipath/g_multipath.c
+++ b/sys/geom/multipath/g_multipath.c
@@ -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));
diff --git a/sys/geom/nop/g_nop.c b/sys/geom/nop/g_nop.c
index c43fb2d..099df49 100644
--- a/sys/geom/nop/g_nop.c
+++ b/sys/geom/nop/g_nop.c
@@ -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;
diff --git a/sys/geom/sched/g_sched.c b/sys/geom/sched/g_sched.c
index 1010229..12a0461 100644
--- a/sys/geom/sched/g_sched.c
+++ b/sys/geom/sched/g_sched.c
@@ -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;
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index 9aa7802..44bff25 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -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);
/*
OpenPOWER on IntegriCloud