From 411db1de5af2d592dad99b0be550c1d1396cb0bd Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 9 Jun 2002 10:57:34 +0000 Subject: Improve some on the naming. Submitted by: iedowse --- sys/geom/geom.h | 14 +++++++------- sys/geom/geom_aes.c | 10 +++++----- sys/geom/geom_bsd.c | 2 +- sys/geom/geom_dev.c | 12 ++++++------ sys/geom/geom_disk.c | 12 ++++++------ sys/geom/geom_event.c | 4 ++-- sys/geom/geom_gpt.c | 4 ++-- sys/geom/geom_mbr.c | 10 ++++++---- sys/geom/geom_pc98.c | 2 +- sys/geom/geom_slice.c | 6 +++--- sys/geom/geom_subr.c | 30 +++++++++++++++--------------- sys/geom/geom_sunlabel.c | 2 +- 12 files changed, 55 insertions(+), 53 deletions(-) (limited to 'sys') diff --git a/sys/geom/geom.h b/sys/geom/geom.h index 665a992..7fcdf3c 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -93,7 +93,7 @@ struct g_class { g_create_geom_t *create_geom; /* * The remaning elements are private and classes should use - * the G_CLASS_INITSTUFF macro to initialize them. + * the G_CLASS_INITIALIZER macro to initialize them. */ LIST_ENTRY(g_class) class; LIST_HEAD(,g_geom) geom; @@ -101,7 +101,7 @@ struct g_class { u_int protect; }; -#define G_CLASS_INITSTUFF { 0, 0 }, { 0 }, 0, 0 +#define G_CLASS_INITIALIZER { 0, 0 }, { 0 }, 0, 0 /* * The g_geom is an instance of a g_class. @@ -217,7 +217,7 @@ void g_enc_le4(u_char *p, uint32_t u); /* geom_event.c */ void g_orphan_provider(struct g_provider *pp, int error); -void g_rattle(void); +void g_waitidle(void); void g_silence(void); /* geom_subr.c */ @@ -230,13 +230,13 @@ struct g_geom *g_create_geomf(char *class, struct g_provider *, char *fmt, ...); void g_destroy_consumer(struct g_consumer *cp); void g_destroy_geom(struct g_geom *pp); void g_destroy_provider(struct g_provider *pp); -void g_dettach(struct g_consumer *cp); +void g_detach(struct g_consumer *cp); void g_error_provider(struct g_provider *pp, int error); 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)) -int g_haveattr(struct bio *bp, char *attribute, void *val, int len); -int g_haveattr_int(struct bio *bp, char *attribute, int val); -int g_haveattr_off_t(struct bio *bp, char *attribute, off_t val); +int g_handleattr(struct bio *bp, char *attribute, void *val, int len); +int g_handleattr_int(struct bio *bp, char *attribute, int val); +int g_handleattr_off_t(struct bio *bp, char *attribute, off_t val); struct g_geom * g_insert_geom(char *class, struct g_consumer *cp); struct g_consumer * g_new_consumer(struct g_geom *gp); struct g_geom * g_new_geomf(struct g_class *mp, char *fmt, ...); diff --git a/sys/geom/geom_aes.c b/sys/geom/geom_aes.c index 6ac7bb6..43bb34f 100644 --- a/sys/geom/geom_aes.c +++ b/sys/geom/geom_aes.c @@ -144,9 +144,9 @@ g_aes_start(struct bio *bp) break; case BIO_GETATTR: case BIO_SETATTR: - if (g_haveattr_off_t(bp, "GEOM::mediasize", sc->mediasize)) + if (g_handleattr_off_t(bp, "GEOM::mediasize", sc->mediasize)) return; - if (g_haveattr_int(bp, "GEOM::sectorsize", sc->sectorsize)) + if (g_handleattr_int(bp, "GEOM::sectorsize", sc->sectorsize)) return; bp2 = g_clone_bio(bp); bp2->bio_done = g_std_done; @@ -219,7 +219,7 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) g_attach(cp, pp); error = g_access_rel(cp, 1, 0, 0); if (error) { - g_dettach(cp); + g_detach(cp); g_destroy_consumer(cp); g_destroy_geom(gp); return (NULL); @@ -258,7 +258,7 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) g_access_rel(cp, -1, 0, 0); if (gp->softc != NULL) return (gp); - g_dettach(cp); + g_detach(cp); g_destroy_consumer(cp); g_destroy_geom(gp); return (NULL); @@ -268,7 +268,7 @@ static struct g_class g_aes_class = { AES_CLASS_NAME, g_aes_taste, NULL, - G_CLASS_INITSTUFF + G_CLASS_INITIALIZER }; DECLARE_GEOM_CLASS(g_aes_class, g_aes); diff --git a/sys/geom/geom_bsd.c b/sys/geom/geom_bsd.c index 77f4214..d56ac53 100644 --- a/sys/geom/geom_bsd.c +++ b/sys/geom/geom_bsd.c @@ -424,7 +424,7 @@ static struct g_class g_bsd_class = { BSD_CLASS_NAME, g_bsd_taste, NULL, - G_CLASS_INITSTUFF + G_CLASS_INITIALIZER }; DECLARE_GEOM_CLASS(g_bsd_class, g_bsd); diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index f3be90c..0051eb5 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -82,7 +82,7 @@ static struct g_class g_dev_class = { "DEV", g_dev_taste, NULL, - G_CLASS_INITSTUFF + G_CLASS_INITIALIZER }; static void @@ -94,7 +94,7 @@ g_dev_clone(void *arg, char *name, int namelen, dev_t *dev) return; g_trace(G_T_TOPOLOGY, "g_dev_clone(%s)", name); - g_rattle(); + g_waitidle(); /* XXX: can I drop Giant here ??? */ /* g_topology_lock(); */ @@ -182,7 +182,7 @@ g_dev_open(dev_t dev, int flags, int fmt, struct thread *td) error = g_access_rel(cp, r, w, e); g_topology_unlock(); PICKUP_GIANT(); - g_rattle(); + g_waitidle(); return(error); } @@ -208,7 +208,7 @@ g_dev_close(dev_t dev, int flags, int fmt, struct thread *td) error = g_access_rel(cp, r, w, e); g_topology_unlock(); PICKUP_GIANT(); - g_rattle(); + g_waitidle(); return (error); } @@ -295,7 +295,7 @@ g_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td) g_topology_unlock(); } PICKUP_GIANT(); - g_rattle(); + g_waitidle(); if (error == ENOIOCTL) { i = IOCGROUP(cmd); printf("IOCTL(0x%lx) \"%s\"", cmd, gp->name); @@ -403,7 +403,7 @@ g_dev_orphan(struct g_consumer *cp) destroy_dev(dev); if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) g_access_rel(cp, -cp->acr, -cp->acw, -cp->ace); - g_dettach(cp); + g_detach(cp); g_destroy_consumer(cp); g_destroy_geom(gp); } diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index 846694d..acbee24 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -60,7 +60,7 @@ struct g_class g_disk_class = { "DISK", NULL, NULL, - G_CLASS_INITSTUFF + G_CLASS_INITIALIZER }; static int @@ -152,19 +152,19 @@ g_disk_start(struct bio *bp) mtx_unlock(&Giant); break; case BIO_GETATTR: - if (g_haveattr_int(bp, "GEOM::sectorsize", + if (g_handleattr_int(bp, "GEOM::sectorsize", dp->d_label.d_secsize)) break; - else if (g_haveattr_int(bp, "GEOM::fwsectors", + else if (g_handleattr_int(bp, "GEOM::fwsectors", dp->d_label.d_nsectors)) break; - else if (g_haveattr_int(bp, "GEOM::fwheads", + else if (g_handleattr_int(bp, "GEOM::fwheads", dp->d_label.d_ntracks)) break; - else if (g_haveattr_off_t(bp, "GEOM::mediasize", + else if (g_handleattr_off_t(bp, "GEOM::mediasize", dp->d_label.d_secsize * (off_t)dp->d_label.d_secperunit)) break; - else if (g_haveattr_off_t(bp, "GEOM::frontstuff", 0)) + else if (g_handleattr_off_t(bp, "GEOM::frontstuff", 0)) break; else if (!strcmp(bp->bio_attribute, "GEOM::kerneldump")) g_disk_kerneldump(bp, dp); diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c index 4322e15..65f84d6 100644 --- a/sys/geom/geom_event.c +++ b/sys/geom/geom_event.c @@ -74,14 +74,14 @@ g_silence(void) } void -g_rattle(void) +g_waitidle(void) { g_silence_events = 0; mtx_lock(&Giant); wakeup(&g_silence_events); while (g_pending_events) - tsleep(&g_pending_events, PPAUSE, "g_rattle", hz/5); + tsleep(&g_pending_events, PPAUSE, "g_waitidle", hz/5); mtx_unlock(&Giant); } diff --git a/sys/geom/geom_gpt.c b/sys/geom/geom_gpt.c index 568420d..efcbb2e 100644 --- a/sys/geom/geom_gpt.c +++ b/sys/geom/geom_gpt.c @@ -111,7 +111,7 @@ g_gpt_start(struct bio *bp) */ type = (memcmp(&gs->part[pp->index]->ent_type, &freebsd, sizeof(freebsd))) ? 0 : 165; - return ((g_haveattr_int(bp, "MBR::type", type)) ? 1 : 0); + return ((g_handleattr_int(bp, "MBR::type", type)) ? 1 : 0); } static void @@ -246,7 +246,7 @@ static struct g_class g_gpt_class = { "GPT", g_gpt_taste, NULL, - G_CLASS_INITSTUFF + G_CLASS_INITIALIZER }; DECLARE_GEOM_CLASS(g_gpt_class, g_gpt); diff --git a/sys/geom/geom_mbr.c b/sys/geom/geom_mbr.c index 90ebaff..9e9fd7f 100644 --- a/sys/geom/geom_mbr.c +++ b/sys/geom/geom_mbr.c @@ -58,7 +58,9 @@ #include #include +#ifdef _KERNEL #include "opt_geom.h" +#endif #define MBR_CLASS_NAME "MBR" #define MBREXT_CLASS_NAME "MBREXT" @@ -117,7 +119,7 @@ g_mbr_start(struct bio *bp) gsp = gp->softc; mp = gsp->softc; if (bp->bio_cmd == BIO_GETATTR) { - if (g_haveattr_int(bp, "MBR::type", mp->type[index])) + if (g_handleattr_int(bp, "MBR::type", mp->type[index])) return (1); } return (0); @@ -267,7 +269,7 @@ static struct g_class g_mbr_class = { MBR_CLASS_NAME, g_mbr_taste, NULL, - G_CLASS_INITSTUFF + G_CLASS_INITIALIZER }; DECLARE_GEOM_CLASS(g_mbr_class, g_mbr); @@ -292,7 +294,7 @@ g_mbrext_start(struct bio *bp) gsp = gp->softc; mp = gsp->softc; if (bp->bio_cmd == BIO_GETATTR) { - if (g_haveattr_int(bp, "MBR::type", mp->type[index])) + if (g_handleattr_int(bp, "MBR::type", mp->type[index])) return (1); } return (0); @@ -416,7 +418,7 @@ static struct g_class g_mbrext_class = { MBREXT_CLASS_NAME, g_mbrext_taste, NULL, - G_CLASS_INITSTUFF + G_CLASS_INITIALIZER }; DECLARE_GEOM_CLASS(g_mbrext_class, g_mbrext); diff --git a/sys/geom/geom_pc98.c b/sys/geom/geom_pc98.c index 12837b7..1592404 100644 --- a/sys/geom/geom_pc98.c +++ b/sys/geom/geom_pc98.c @@ -180,7 +180,7 @@ static struct g_class g_pc98_class = { PC98_CLASS_NAME, g_pc98_taste, NULL, - G_CLASS_INITSTUFF + G_CLASS_INITIALIZER }; DECLARE_GEOM_CLASS(g_pc98_class, g_pc98); diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c index 45f8a10..ab781d5 100644 --- a/sys/geom/geom_slice.c +++ b/sys/geom/geom_slice.c @@ -159,7 +159,7 @@ g_slice_start(struct bio *bp) /* Give the real method a chance to override */ if (gsp->start(bp)) return; - if (g_haveattr_off_t(bp, "GEOM::mediasize", + if (g_handleattr_off_t(bp, "GEOM::mediasize", gsp->slices[index].length)) return; if (!strcmp("GEOM::frontstuff", bp->bio_attribute)) { @@ -171,7 +171,7 @@ g_slice_start(struct bio *bp) t = 0; if (t > gsl->length) t = gsl->length; - g_haveattr_off_t(bp, "GEOM::frontstuff", t); + g_handleattr_off_t(bp, "GEOM::frontstuff", t); return; } #ifdef _KERNEL @@ -271,7 +271,7 @@ g_slice_new(struct g_class *mp, int slices, struct g_provider *pp, struct g_cons g_attach(cp, pp); error = g_access_rel(cp, 1, 0, 0); if (error) { - g_dettach(cp); + g_detach(cp); g_destroy_consumer(cp); g_free(gsp->slices); g_free(gp->softc); diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index 570c113..c6de3cc 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -270,7 +270,7 @@ g_destroy_provider(struct g_provider *pp) cp = LIST_FIRST(&gp->consumer); if (cp == NULL) break; - g_dettach(cp); + g_detach(cp); g_destroy_consumer(cp); } g_destroy_geom(gp); @@ -287,7 +287,7 @@ g_destroy_provider(struct g_provider *pp) * of the sequence with invalid rank as well. * At some point we encounter our original geom and if we stil fail * to assign it a rank, there must be a loop and we fail back to - * g_attach() which dettach again and calls redo_rank again + * g_attach() which detach again and calls redo_rank again * to fix up the damage. * It would be much simpler code wise to do it recursively, but we * can't risk that on the kernel stack. @@ -363,18 +363,18 @@ g_attach(struct g_consumer *cp, struct g_provider *pp) } void -g_dettach(struct g_consumer *cp) +g_detach(struct g_consumer *cp) { struct g_provider *pp; - g_trace(G_T_TOPOLOGY, "g_dettach(%p)", cp); + g_trace(G_T_TOPOLOGY, "g_detach(%p)", cp); KASSERT(cp != (void*)0xd0d0d0d0, ("ARGH!")); g_topology_assert(); - KASSERT(cp->provider != NULL, ("dettach but not attached")); - KASSERT(cp->acr == 0, ("dettach but nonzero acr")); - KASSERT(cp->acw == 0, ("dettach but nonzero acw")); - KASSERT(cp->ace == 0, ("dettach but nonzero ace")); - KASSERT(cp->biocount == 0, ("dettach but nonzero biocount")); + KASSERT(cp->provider != NULL, ("detach but not attached")); + KASSERT(cp->acr == 0, ("detach but nonzero acr")); + KASSERT(cp->acw == 0, ("detach but nonzero acw")); + KASSERT(cp->ace == 0, ("detach but nonzero ace")); + KASSERT(cp->biocount == 0, ("detach but nonzero biocount")); pp = cp->provider; LIST_REMOVE(cp, consumers); cp->provider = NULL; @@ -493,22 +493,22 @@ g_access_rel(struct g_consumer *cp, int dcr, int dcw, int dce) } int -g_haveattr_int(struct bio *bp, char *attribute, int val) +g_handleattr_int(struct bio *bp, char *attribute, int val) { - return (g_haveattr(bp, attribute, &val, sizeof val)); + return (g_handleattr(bp, attribute, &val, sizeof val)); } int -g_haveattr_off_t(struct bio *bp, char *attribute, off_t val) +g_handleattr_off_t(struct bio *bp, char *attribute, off_t val) { - return (g_haveattr(bp, attribute, &val, sizeof val)); + return (g_handleattr(bp, attribute, &val, sizeof val)); } int -g_haveattr(struct bio *bp, char *attribute, void *val, int len) +g_handleattr(struct bio *bp, char *attribute, void *val, int len) { int error; @@ -558,7 +558,7 @@ g_std_spoiled(struct g_consumer *cp) g_trace(G_T_TOPOLOGY, "g_std_spoiled(%p)", cp); g_topology_assert(); - g_dettach(cp); + g_detach(cp); gp = cp->geom; LIST_FOREACH(pp, &gp->provider, provider) g_orphan_provider(pp, ENXIO); diff --git a/sys/geom/geom_sunlabel.c b/sys/geom/geom_sunlabel.c index 7d5f98a..126afae 100644 --- a/sys/geom/geom_sunlabel.c +++ b/sys/geom/geom_sunlabel.c @@ -191,7 +191,7 @@ static struct g_class g_sunlabel_class = { SUNLABEL_CLASS_NAME, g_sunlabel_taste, NULL, - G_CLASS_INITSTUFF + G_CLASS_INITIALIZER }; DECLARE_GEOM_CLASS(g_sunlabel_class, g_sunlabel); -- cgit v1.1