diff options
author | phk <phk@FreeBSD.org> | 2003-04-23 20:46:12 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-04-23 20:46:12 +0000 |
commit | 3bbfe9f43b9f428fa76cf6b43be961ff03071025 (patch) | |
tree | 2d203b1d0b7761a17e73c3483c4149f9172a544b | |
parent | f0e2ab20a0f8aec13b4380cbf6075819af64c9a7 (diff) | |
download | FreeBSD-src-3bbfe9f43b9f428fa76cf6b43be961ff03071025.zip FreeBSD-src-3bbfe9f43b9f428fa76cf6b43be961ff03071025.tar.gz |
Rename g_call_me() to g_post_event(), and give it a flag
argument to determine if we can M_WAITOK in malloc.
-rw-r--r-- | sys/geom/geom.h | 4 | ||||
-rw-r--r-- | sys/geom/geom_bsd.c | 4 | ||||
-rw-r--r-- | sys/geom/geom_disk.c | 9 | ||||
-rw-r--r-- | sys/geom/geom_event.c | 10 | ||||
-rw-r--r-- | sys/geom/geom_int.h | 2 | ||||
-rw-r--r-- | sys/geom/geom_kern.c | 6 | ||||
-rw-r--r-- | sys/geom/geom_mbr.c | 2 | ||||
-rw-r--r-- | sys/geom/geom_pc98.c | 2 | ||||
-rw-r--r-- | sys/geom/geom_slice.c | 3 | ||||
-rw-r--r-- | sys/geom/geom_slice.h | 2 | ||||
-rw-r--r-- | sys/geom/geom_subr.c | 9 | ||||
-rw-r--r-- | sys/geom/geom_sunlabel.c | 16 |
12 files changed, 35 insertions, 34 deletions
diff --git a/sys/geom/geom.h b/sys/geom/geom.h index fa90f91..b05fb1d 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -208,9 +208,9 @@ void g_trace(int level, const char *, ...); /* geom_event.c */ -typedef void g_call_me_t(void *, int flag); +typedef void g_event_t(void *, int flag); #define EV_CANCEL 1 -int g_call_me(g_call_me_t *func, void *arg, ...); +int g_post_event(g_event_t *func, void *arg, int flag, ...); void g_cancel_event(void *ref); void g_orphan_provider(struct g_provider *pp, int error); void g_waitidle(void); diff --git a/sys/geom/geom_bsd.c b/sys/geom/geom_bsd.c index b528361..1f289d8 100644 --- a/sys/geom/geom_bsd.c +++ b/sys/geom/geom_bsd.c @@ -345,7 +345,7 @@ g_bsd_try(struct g_geom *gp, struct g_slicer *gsp, struct g_consumer *cp, int se /* * Implement certain ioctls to modify disklabels with. This function * is called by the event handler thread with topology locked as result - * of the g_call_me() in g_bsd_start(). It is not necessary to keep + * of the g_post_event() in g_bsd_start(). It is not necessary to keep * topology locked all the time but make sure to return with topology * locked as well. */ @@ -592,7 +592,7 @@ g_bsd_start(struct bio *bp) * some I/O requests. Ask the event-handler to schedule * us in a less restricted environment. */ - error = g_call_me(g_bsd_ioctl, bp, gp, NULL); + error = g_post_event(g_bsd_ioctl, bp, M_NOWAIT, gp, NULL); if (error) g_io_deliver(bp, error); /* diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index a5d2109..91887b8 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -333,7 +333,7 @@ disk_create(int unit, struct disk *dp, int flags, void *unused __unused, void * dp->d_sectorsize, DEVSTAT_ALL_SUPPORTED, DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX); dp->d_geom = NULL; - g_call_me(g_disk_create, dp, dp, NULL); + g_post_event(g_disk_create, dp, M_WAITOK, dp, NULL); } /* @@ -386,12 +386,11 @@ sysctl_disks(SYSCTL_HANDLER_ARGS) sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); sbuf_clear(sb); - error = g_call_me(g_kern_disks, sb, NULL); - while (!error && !sbuf_done(sb)) { + g_post_event(g_kern_disks, sb, M_WAITOK, NULL); + while (!sbuf_done(sb)) { tsleep(sb, PZERO, "kern.disks", hz); } - if (!error) - error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); sbuf_delete(sb); return error; } diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c index e974216..ec34c87 100644 --- a/sys/geom/geom_event.c +++ b/sys/geom/geom_event.c @@ -210,18 +210,20 @@ g_cancel_event(void *ref) } int -g_call_me(g_call_me_t *func, void *arg, ...) +g_post_event(g_event_t *func, void *arg, int flag, ...) { struct g_event *ep; va_list ap; void *p; u_int n; - g_trace(G_T_TOPOLOGY, "g_call_me(%p, %p", func, arg); - ep = g_malloc(sizeof *ep, M_NOWAIT | M_ZERO); + g_trace(G_T_TOPOLOGY, "g_post_event(%p, %p, %d", func, arg, flag); + KASSERT(flag == M_NOWAIT || flag == M_WAITOK, + ("Wrong flag to g_post_event")); + ep = g_malloc(sizeof *ep, flag | M_ZERO); if (ep == NULL) return (ENOMEM); - va_start(ap, arg); + va_start(ap, flag); for (n = 0; n < G_N_EVENTREFS; n++) { p = va_arg(ap, void *); if (p == NULL) diff --git a/sys/geom/geom_int.h b/sys/geom/geom_int.h index 567cd7a..23e5597 100644 --- a/sys/geom/geom_int.h +++ b/sys/geom/geom_int.h @@ -58,7 +58,7 @@ extern int g_debugflags; struct g_event { TAILQ_ENTRY(g_event) events; void *arg; - g_call_me_t *func; + g_event_t *func; void *ref[G_N_EVENTREFS]; }; diff --git a/sys/geom/geom_kern.c b/sys/geom/geom_kern.c index d7eef7e..8f87260 100644 --- a/sys/geom/geom_kern.c +++ b/sys/geom/geom_kern.c @@ -172,7 +172,7 @@ sysctl_kern_geom_conftxt(SYSCTL_HANDLER_ARGS) sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); sbuf_clear(sb); - g_call_me(g_conftxt, sb, NULL); + g_post_event(g_conftxt, sb, M_WAITOK, NULL); do { tsleep(sb, PZERO, "g_conftxt", hz); } while(!sbuf_done(sb)); @@ -189,7 +189,7 @@ sysctl_kern_geom_confdot(SYSCTL_HANDLER_ARGS) sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); sbuf_clear(sb); - g_call_me(g_confdot, sb, NULL); + g_post_event(g_confdot, sb, M_WAITOK, NULL); do { tsleep(sb, PZERO, "g_confdot", hz); } while(!sbuf_done(sb)); @@ -206,7 +206,7 @@ sysctl_kern_geom_confxml(SYSCTL_HANDLER_ARGS) sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); sbuf_clear(sb); - g_call_me(g_confxml, sb, NULL); + g_post_event(g_confxml, sb, M_WAITOK, NULL); do { tsleep(sb, PZERO, "g_confxml", hz); } while(!sbuf_done(sb)); diff --git a/sys/geom/geom_mbr.c b/sys/geom/geom_mbr.c index d2af8ab..362e540 100644 --- a/sys/geom/geom_mbr.c +++ b/sys/geom/geom_mbr.c @@ -226,7 +226,7 @@ g_mbr_start(struct bio *bp) * some I/O requests. Ask the event-handler to schedule * us in a less restricted environment. */ - error = g_call_me(g_mbr_ioctl, bp, gp, NULL); + error = g_post_event(g_mbr_ioctl, bp, M_NOWAIT, gp, NULL); if (error) g_io_deliver(bp, error); /* diff --git a/sys/geom/geom_pc98.c b/sys/geom/geom_pc98.c index 1cb66d1..adcf1a3 100644 --- a/sys/geom/geom_pc98.c +++ b/sys/geom/geom_pc98.c @@ -233,7 +233,7 @@ g_pc98_start(struct bio *bp) * some I/O requests. Ask the event-handler to schedule * us in a less restricted environment. */ - error = g_call_me(g_pc98_ioctl, bp, gp, NULL); + error = g_post_event(g_pc98_ioctl, bp, M_NOWAIT, gp, NULL); if (error) g_io_deliver(bp, error); /* diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c index 2474143..2d31b7c 100644 --- a/sys/geom/geom_slice.c +++ b/sys/geom/geom_slice.c @@ -210,7 +210,8 @@ g_slice_start(struct bio *bp) g_io_deliver(bp, error); return; case G_SLICE_HOT_CALL: - error = g_call_me(gsp->hot, bp, gp, NULL); + error = g_post_event(gsp->hot, bp, M_NOWAIT, + gp, NULL); if (error) g_io_deliver(bp, error); return; diff --git a/sys/geom/geom_slice.h b/sys/geom/geom_slice.h index 4460c28..f6883e6 100644 --- a/sys/geom/geom_slice.h +++ b/sys/geom/geom_slice.h @@ -65,7 +65,7 @@ struct g_slicer { void *softc; g_slice_start_t *start; - g_call_me_t *hot; + g_event_t *hot; }; g_dumpconf_t g_slice_dumpconf; diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index 28a671d..017a17c 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -105,7 +105,7 @@ g_add_class(struct g_class *mp) LIST_INIT(&mp->geom); LIST_INSERT_HEAD(&g_classes, mp, class); if (g_nproviders > 0 && mp->taste != NULL) - g_call_me(g_new_class_event, mp, mp, NULL); + g_post_event(g_new_class_event, mp, M_WAITOK, mp, NULL); g_topology_unlock(); } @@ -242,7 +242,7 @@ g_new_providerf(struct g_geom *gp, const char *fmt, ...) DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX); LIST_INSERT_HEAD(&gp->provider, pp, provider); g_nproviders++; - g_call_me(g_new_provider_event, pp, pp, NULL); + g_post_event(g_new_provider_event, pp, M_WAITOK, pp, NULL); return (pp); } @@ -491,7 +491,8 @@ g_access_rel(struct g_consumer *cp, int dcr, int dcw, int dce) g_spoil(pp, cp); else if (pp->acw != 0 && pp->acw == -dcw && !(pp->geom->flags & G_GEOM_WITHER)) - g_call_me(g_new_provider_event, pp, pp, NULL); + g_post_event(g_new_provider_event, pp, M_WAITOK, + pp, NULL); pp->acr += dcr; pp->acw += dcw; @@ -633,7 +634,7 @@ g_spoil(struct g_provider *pp, struct g_consumer *cp) KASSERT(cp2->ace == 0, ("spoiling cp->ace = %d", cp2->ace)); cp2->spoiled++; } - g_call_me(g_spoil_event, pp, pp, NULL); + g_post_event(g_spoil_event, pp, M_WAITOK, pp, NULL); } int diff --git a/sys/geom/geom_sunlabel.c b/sys/geom/geom_sunlabel.c index c5d4409..edd3e6f 100644 --- a/sys/geom/geom_sunlabel.c +++ b/sys/geom/geom_sunlabel.c @@ -194,15 +194,13 @@ g_sunlabel_config(struct gctl_req *req, struct g_geom *gp, const char *verb) error = g_access_rel(cp, 1, 1, 1); if (error) return (error); - error = g_call_me(g_sunlabel_callconfig, &h0h0, gp, NULL); - if (!error) { - g_topology_unlock(); - do - tsleep(&h0h0, PRIBIO, "g_sunlabel_config", hz); - while (h0h0.error == -1); - g_topology_lock(); - error = h0h0.error; - } + g_post_event(g_sunlabel_callconfig, &h0h0, M_WAITOK, gp, NULL); + g_topology_unlock(); + do + tsleep(&h0h0, PRIBIO, "g_sunlabel_config", hz); + while (h0h0.error == -1); + g_topology_lock(); + error = h0h0.error; g_access_rel(cp, -1, -1, -1); g_free(label); } else if (!strcmp(verb, "write bootcode")) { |