aboutsummaryrefslogtreecommitdiff
path: root/sys/geom
diff options
context:
space:
mode:
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/concat/g_concat.c1
-rw-r--r--sys/geom/geom.h2
-rw-r--r--sys/geom/geom_ccd.c10
-rw-r--r--sys/geom/geom_event.c2
-rw-r--r--sys/geom/geom_io.c2
-rw-r--r--sys/geom/geom_slice.c6
-rw-r--r--sys/geom/geom_subr.c21
-rw-r--r--sys/geom/multipath/g_multipath.c10
-rw-r--r--sys/geom/virstor/g_virstor.c30
9 files changed, 42 insertions, 42 deletions
diff --git a/sys/geom/concat/g_concat.c b/sys/geom/concat/g_concat.c
index 2b1cb575cac8..2173a84c7acf 100644
--- a/sys/geom/concat/g_concat.c
+++ b/sys/geom/concat/g_concat.c
@@ -590,6 +590,7 @@ g_concat_add_disk(struct g_concat_softc *sc, struct g_provider *pp, u_int no)
strcmp(md.md_name, sc->sc_name) != 0 ||
md.md_id != sc->sc_id) {
G_CONCAT_DEBUG(0, "Metadata on %s changed.", pp->name);
+ error = EINVAL;
goto fail;
}
diff --git a/sys/geom/geom.h b/sys/geom/geom.h
index dcd6f793f9f7..908ce86f03a6 100644
--- a/sys/geom/geom.h
+++ b/sys/geom/geom.h
@@ -282,7 +282,7 @@ void g_detach(struct g_consumer *cp);
void g_error_provider(struct g_provider *pp, int error);
struct g_provider *g_provider_by_name(char const *arg);
int g_getattr__(const char *attr, struct g_consumer *cp, void *var, int len);
-#define g_getattr(a, c, v) g_getattr__((a), (c), (v), sizeof *(v))
+#define g_getattr(a, c, v) g_getattr__((a), (c), (v), sizeof(*(v)))
int g_handleattr(struct bio *bp, const char *attribute, const void *val,
int len);
int g_handleattr_int(struct bio *bp, const char *attribute, int val);
diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c
index 5700399ee5d1..2140d005160e 100644
--- a/sys/geom/geom_ccd.c
+++ b/sys/geom/geom_ccd.c
@@ -730,17 +730,17 @@ g_ccd_create(struct gctl_req *req, struct g_class *mp)
int i, error;
g_topology_assert();
- unit = gctl_get_paraml(req, "unit", sizeof (*unit));
+ unit = gctl_get_paraml(req, "unit", sizeof(*unit));
if (unit == NULL) {
gctl_error(req, "unit parameter not given");
return;
}
- ileave = gctl_get_paraml(req, "ileave", sizeof (*ileave));
+ ileave = gctl_get_paraml(req, "ileave", sizeof(*ileave));
if (ileave == NULL) {
gctl_error(req, "ileave parameter not given");
return;
}
- nprovider = gctl_get_paraml(req, "nprovider", sizeof (*nprovider));
+ nprovider = gctl_get_paraml(req, "nprovider", sizeof(*nprovider));
if (nprovider == NULL) {
gctl_error(req, "nprovider parameter not given");
return;
@@ -769,7 +769,7 @@ g_ccd_create(struct gctl_req *req, struct g_class *mp)
}
gp = g_new_geomf(mp, "ccd%d", *unit);
- sc = g_malloc(sizeof *sc, M_WAITOK | M_ZERO);
+ sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
gp->softc = sc;
sc->sc_ndisks = *nprovider;
@@ -872,7 +872,7 @@ g_ccd_list(struct gctl_req *req, struct g_class *mp)
struct g_geom *gp;
int i, unit, *up;
- up = gctl_get_paraml(req, "unit", sizeof (*up));
+ up = gctl_get_paraml(req, "unit", sizeof(*up));
if (up == NULL) {
gctl_error(req, "unit parameter not given");
return;
diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c
index 0a76fd6c6f57..341233a6ef47 100644
--- a/sys/geom/geom_event.c
+++ b/sys/geom/geom_event.c
@@ -145,7 +145,7 @@ g_attr_changed(struct g_provider *pp, const char *attr, int flag)
struct g_attrchanged_args *args;
int error;
- args = g_malloc(sizeof *args, flag);
+ args = g_malloc(sizeof(*args), flag);
if (args == NULL)
return (ENOMEM);
args->pp = pp;
diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c
index 8d6b9a926e1d..247a623bf1bf 100644
--- a/sys/geom/geom_io.c
+++ b/sys/geom/geom_io.c
@@ -278,7 +278,7 @@ g_io_init(void)
g_bioq_init(&g_bio_run_down);
g_bioq_init(&g_bio_run_up);
- biozone = uma_zcreate("g_bio", sizeof (struct bio),
+ biozone = uma_zcreate("g_bio", sizeof(struct bio),
NULL, NULL,
NULL, NULL,
0, 0);
diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c
index 8cfffc478849..0491b0069be4 100644
--- a/sys/geom/geom_slice.c
+++ b/sys/geom/geom_slice.c
@@ -57,7 +57,7 @@ g_slice_alloc(unsigned nslice, unsigned scsize)
{
struct g_slicer *gsp;
- gsp = g_malloc(sizeof *gsp, M_WAITOK | M_ZERO);
+ gsp = g_malloc(sizeof(*gsp), M_WAITOK | M_ZERO);
if (scsize > 0)
gsp->softc = g_malloc(scsize, M_WAITOK | M_ZERO);
else
@@ -463,9 +463,9 @@ g_slice_conf_hot(struct g_geom *gp, u_int idx, off_t offset, off_t length, int r
}
gsl = gsp->hotspot;
if(idx >= gsp->nhotspot) {
- gsl2 = g_malloc((idx + 1) * sizeof *gsl2, M_WAITOK | M_ZERO);
+ gsl2 = g_malloc((idx + 1) * sizeof(*gsl2), M_WAITOK | M_ZERO);
if (gsp->hotspot != NULL)
- bcopy(gsp->hotspot, gsl2, gsp->nhotspot * sizeof *gsl2);
+ bcopy(gsp->hotspot, gsl2, gsp->nhotspot * sizeof(*gsl2));
gsp->hotspot = gsl2;
if (gsp->hotspot != NULL)
g_free(gsl);
diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c
index 41cc115225f9..1429c84942ed 100644
--- a/sys/geom/geom_subr.c
+++ b/sys/geom/geom_subr.c
@@ -267,7 +267,7 @@ g_modevent(module_t mod, int type, void *data)
switch (type) {
case MOD_LOAD:
g_trace(G_T_TOPOLOGY, "g_modevent(%s, LOAD)", mp->name);
- hh = g_malloc(sizeof *hh, M_WAITOK | M_ZERO);
+ hh = g_malloc(sizeof(*hh), M_WAITOK | M_ZERO);
hh->mp = mp;
/*
* Once the system is not cold, MOD_LOAD calls will be
@@ -351,7 +351,7 @@ g_retaste(struct g_class *mp)
if (mp->taste == NULL)
return (EINVAL);
- hh = g_malloc(sizeof *hh, M_WAITOK | M_ZERO);
+ hh = g_malloc(sizeof(*hh), M_WAITOK | M_ZERO);
hh->mp = mp;
if (cold) {
@@ -381,8 +381,8 @@ g_new_geomf(struct g_class *mp, const char *fmt, ...)
sbuf_vprintf(sb, fmt, ap);
va_end(ap);
sbuf_finish(sb);
- gp = g_malloc(sizeof *gp, M_WAITOK | M_ZERO);
- gp->name = g_malloc(sbuf_len(sb) + 1, M_WAITOK | M_ZERO);
+ gp = g_malloc(sizeof(*gp) + sbuf_len(sb) + 1, M_WAITOK | M_ZERO);
+ gp->name = (char *)(gp + 1);
gp->class = mp;
gp->rank = 1;
LIST_INIT(&gp->consumer);
@@ -420,7 +420,6 @@ g_destroy_geom(struct g_geom *gp)
g_cancel_event(gp);
LIST_REMOVE(gp, geom);
TAILQ_REMOVE(&geoms, gp, geoms);
- g_free(gp->name);
g_free(gp);
}
@@ -528,7 +527,7 @@ g_new_consumer(struct g_geom *gp)
("g_new_consumer on geom(%s) (class %s) without orphan",
gp->name, gp->class->name));
- cp = g_malloc(sizeof *cp, M_WAITOK | M_ZERO);
+ cp = g_malloc(sizeof(*cp), M_WAITOK | M_ZERO);
cp->geom = gp;
cp->stat = devstat_new_entry(cp, -1, 0, DEVSTAT_ALL_SUPPORTED,
DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX);
@@ -617,7 +616,7 @@ g_new_providerf(struct g_geom *gp, const char *fmt, ...)
sbuf_vprintf(sb, fmt, ap);
va_end(ap);
sbuf_finish(sb);
- pp = g_malloc(sizeof *pp + sbuf_len(sb) + 1, M_WAITOK | M_ZERO);
+ pp = g_malloc(sizeof(*pp) + sbuf_len(sb) + 1, M_WAITOK | M_ZERO);
pp->name = (char *)(pp + 1);
strcpy(pp->name, sbuf_data(sb));
sbuf_delete(sb);
@@ -749,7 +748,7 @@ g_resize_provider(struct g_provider *pp, off_t size)
if (size == pp->mediasize)
return;
- hh = g_malloc(sizeof *hh, M_WAITOK | M_ZERO);
+ hh = g_malloc(sizeof(*hh), M_WAITOK | M_ZERO);
hh->pp = pp;
hh->size = size;
g_post_event(g_resize_provider_event, hh, M_WAITOK, NULL);
@@ -1083,21 +1082,21 @@ int
g_handleattr_int(struct bio *bp, const char *attribute, int val)
{
- return (g_handleattr(bp, attribute, &val, sizeof val));
+ return (g_handleattr(bp, attribute, &val, sizeof(val)));
}
int
g_handleattr_uint16_t(struct bio *bp, const char *attribute, uint16_t val)
{
- return (g_handleattr(bp, attribute, &val, sizeof val));
+ return (g_handleattr(bp, attribute, &val, sizeof(val)));
}
int
g_handleattr_off_t(struct bio *bp, const char *attribute, off_t val)
{
- return (g_handleattr(bp, attribute, &val, sizeof val));
+ return (g_handleattr(bp, attribute, &val, sizeof(val)));
}
int
diff --git a/sys/geom/multipath/g_multipath.c b/sys/geom/multipath/g_multipath.c
index 23088c895541..a4935df7eaa1 100644
--- a/sys/geom/multipath/g_multipath.c
+++ b/sys/geom/multipath/g_multipath.c
@@ -321,7 +321,7 @@ g_multipath_resize(struct g_consumer *cp)
if (sc->sc_uuid[0] != 0) {
pp = cp->provider;
strlcpy(md.md_magic, G_MULTIPATH_MAGIC, sizeof(md.md_magic));
- memcpy(md.md_uuid, sc->sc_uuid, sizeof (sc->sc_uuid));
+ memcpy(md.md_uuid, sc->sc_uuid, sizeof(sc->sc_uuid));
strlcpy(md.md_name, sc->sc_name, sizeof(md.md_name));
md.md_version = G_MULTIPATH_VERSION;
md.md_size = size;
@@ -552,8 +552,8 @@ g_multipath_create(struct g_class *mp, struct g_multipath_metadata *md)
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));
- memcpy(sc->sc_name, md->md_name, sizeof (sc->sc_name));
+ memcpy(sc->sc_uuid, md->md_uuid, sizeof(sc->sc_uuid));
+ memcpy(sc->sc_name, md->md_name, sizeof(sc->sc_name));
sc->sc_active_active = md->md_active_active;
sc->sc_size = md->md_size;
gp->softc = sc;
@@ -906,7 +906,7 @@ g_multipath_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
char buf[16];
u_long rand = random();
- snprintf(buf, sizeof (buf), "%s-%lu", md.md_name, rand);
+ snprintf(buf, sizeof(buf), "%s-%lu", md.md_name, rand);
printf("GEOM_MULTIPATH: geom %s/%s exists already\n",
sc->sc_name, sc->sc_uuid);
printf("GEOM_MULTIPATH: %s will be (temporarily) %s\n",
@@ -1200,7 +1200,7 @@ g_multipath_ctl_configure(struct gctl_req *req, struct g_class *mp)
cp = sc->sc_active;
pp = cp->provider;
strlcpy(md.md_magic, G_MULTIPATH_MAGIC, sizeof(md.md_magic));
- memcpy(md.md_uuid, sc->sc_uuid, sizeof (sc->sc_uuid));
+ memcpy(md.md_uuid, sc->sc_uuid, sizeof(sc->sc_uuid));
strlcpy(md.md_name, name, sizeof(md.md_name));
md.md_version = G_MULTIPATH_VERSION;
md.md_size = pp->mediasize;
diff --git a/sys/geom/virstor/g_virstor.c b/sys/geom/virstor/g_virstor.c
index b8cf32875660..c7d737493f11 100644
--- a/sys/geom/virstor/g_virstor.c
+++ b/sys/geom/virstor/g_virstor.c
@@ -202,7 +202,7 @@ virstor_ctl_stop(struct gctl_req *req, struct g_class *cp)
int *force, *nargs;
int i;
- nargs = gctl_get_paraml(req, "nargs", sizeof *nargs);
+ nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs));
if (nargs == NULL) {
gctl_error(req, "Error fetching argument '%s'", "nargs");
return;
@@ -211,7 +211,7 @@ virstor_ctl_stop(struct gctl_req *req, struct g_class *cp)
gctl_error(req, "Invalid number of arguments");
return;
}
- force = gctl_get_paraml(req, "force", sizeof *force);
+ force = gctl_get_paraml(req, "force", sizeof(*force));
if (force == NULL) {
gctl_error(req, "Error fetching argument '%s'", "force");
return;
@@ -315,7 +315,7 @@ virstor_ctl_add(struct gctl_req *req, struct g_class *cp)
u_int nc;
u_int j;
- snprintf(aname, sizeof aname, "arg%d", i);
+ snprintf(aname, sizeof(aname), "arg%d", i);
pp = gctl_get_provider(req, aname);
if (pp == NULL) {
/* This is the most common error so be verbose about it */
@@ -487,12 +487,12 @@ fill_metadata(struct g_virstor_softc *sc, struct g_virstor_metadata *md,
{
struct g_virstor_component *c;
- bzero(md, sizeof *md);
+ bzero(md, sizeof(*md));
c = &sc->components[nc];
- strncpy(md->md_magic, G_VIRSTOR_MAGIC, sizeof md->md_magic);
+ strncpy(md->md_magic, G_VIRSTOR_MAGIC, sizeof(md->md_magic));
md->md_version = G_VIRSTOR_VERSION;
- strncpy(md->md_name, sc->geom->name, sizeof md->md_name);
+ strncpy(md->md_name, sc->geom->name, sizeof(md->md_name));
md->md_id = sc->id;
md->md_virsize = sc->virsize;
md->md_chunk_size = sc->chunk_size;
@@ -500,7 +500,7 @@ fill_metadata(struct g_virstor_softc *sc, struct g_virstor_metadata *md,
if (hardcode) {
strncpy(md->provider, c->gcons->provider->name,
- sizeof md->provider);
+ sizeof(md->provider));
}
md->no = nc;
md->provsize = c->gcons->provider->mediasize;
@@ -589,7 +589,7 @@ virstor_ctl_remove(struct gctl_req *req, struct g_class *cp)
M_GVIRSTOR, M_WAITOK | M_ZERO);
bcopy(sc->components, newcomp, found * sizeof(*sc->components));
bcopy(&sc->components[found + 1], newcomp + found,
- found * sizeof(*sc->components));
+ (sc->n_components - (found + 1)) * sizeof(*sc->components));
if ((sc->components[j].flags & VIRSTOR_PROVIDER_ALLOCATED) != 0) {
LOG_MSG(LVL_ERROR, "Allocated provider %s cannot be "
"removed from %s",
@@ -959,7 +959,7 @@ virstor_geom_destroy(struct g_virstor_softc *sc, boolean_t force,
free(sc->map, M_GVIRSTOR);
free(sc->components, M_GVIRSTOR);
- bzero(sc, sizeof *sc);
+ bzero(sc, sizeof(*sc));
free(sc, M_GVIRSTOR);
pp = LIST_FIRST(&gp->provider); /* We only offer one provider */
@@ -1213,7 +1213,7 @@ virstor_check_and_run(struct g_virstor_softc *sc)
sc->provider->name,
sc->chunk_count * (off_t)sc->chunk_size);
}
- sc->map_size = sc->chunk_count * sizeof *(sc->map);
+ sc->map_size = sc->chunk_count * sizeof(*(sc->map));
/* The following allocation is in order of 4MB - 8MB */
sc->map = malloc(sc->map_size, M_GVIRSTOR, M_WAITOK);
KASSERT(sc->map != NULL, ("%s: Memory allocation error (%zu bytes) for %s",
@@ -1267,7 +1267,7 @@ virstor_check_and_run(struct g_virstor_softc *sc)
bcopy(mapbuf, &sc->map[n], bs);
off += bs;
count += bs;
- n += bs / sizeof *(sc->map);
+ n += bs / sizeof(*(sc->map));
g_free(mapbuf);
}
g_access(sc->components[0].gcons, -1, 0, 0);
@@ -1306,8 +1306,8 @@ virstor_check_and_run(struct g_virstor_softc *sc)
sc->components[index].chunk_next);
}
- sc->me_per_sector = sc->sectorsize / sizeof *(sc->map);
- if (sc->sectorsize % sizeof *(sc->map) != 0) {
+ sc->me_per_sector = sc->sectorsize / sizeof(*(sc->map));
+ if (sc->sectorsize % sizeof(*(sc->map)) != 0) {
LOG_MSG(LVL_ERROR,
"%s: Map entries don't fit exactly in a sector (%s)",
__func__, sc->geom->name);
@@ -1653,7 +1653,7 @@ g_virstor_start(struct bio *b)
* XXX: this will prevent the fs from
* being umounted! */
struct g_virstor_bio_q *biq;
- biq = malloc(sizeof *biq, M_GVIRSTOR,
+ biq = malloc(sizeof(*biq), M_GVIRSTOR,
M_NOWAIT);
if (biq == NULL) {
bioq_dismantle(&bq);
@@ -1703,7 +1703,7 @@ g_virstor_start(struct bio *b)
* map array.
* sc_offset will end up pointing to the drive
* sector. */
- s_offset = chunk_index * sizeof *me;
+ s_offset = chunk_index * sizeof(*me);
s_offset = rounddown(s_offset, sc->sectorsize);
/* data_me points to map entry sector