summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/geom/geom_event.c22
-rw-r--r--sys/geom/geom_int.h1
-rw-r--r--sys/geom/geom_subr.c33
3 files changed, 31 insertions, 25 deletions
diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c
index 46ef58d..eeaaadb 100644
--- a/sys/geom/geom_event.c
+++ b/sys/geom/geom_event.c
@@ -142,10 +142,6 @@ g_destroy_event(struct g_event *ep)
static void
g_do_event(struct g_event *ep)
{
- struct g_class *mp;
- struct g_consumer *cp;
- struct g_provider *pp;
- int i;
g_trace(G_T_TOPOLOGY, "g_do_event(%p) %d - ", ep, ep->event);
g_topology_assert();
@@ -154,24 +150,6 @@ g_do_event(struct g_event *ep)
ep->func(ep->arg, 0);
g_topology_assert();
break;
- case EV_NEW_PROVIDER:
- if (g_shutdown)
- break;
- pp = ep->ref[0];
- g_trace(G_T_TOPOLOGY, "EV_NEW_PROVIDER(%s)", pp->name);
- LIST_FOREACH(mp, &g_classes, class) {
- if (mp->taste == NULL)
- continue;
- i = 1;
- LIST_FOREACH(cp, &pp->consumers, consumers)
- if(cp->geom->class == mp)
- i = 0;
- if (i) {
- mp->taste(mp, pp, 0);
- g_topology_assert();
- }
- }
- break;
case EV_LAST:
default:
KASSERT(1 == 0, ("Unknown event %d", ep->event));
diff --git a/sys/geom/geom_int.h b/sys/geom/geom_int.h
index aaa0494..85acfd3 100644
--- a/sys/geom/geom_int.h
+++ b/sys/geom/geom_int.h
@@ -59,7 +59,6 @@ extern int g_debugflags;
* an internal eventqueue.
*/
enum g_events {
- EV_NEW_PROVIDER, /* provider */
EV_CALL_ME, /* func, arg */
EV_LAST
};
diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c
index 66eff7c..28a671d 100644
--- a/sys/geom/geom_subr.c
+++ b/sys/geom/geom_subr.c
@@ -189,6 +189,35 @@ g_destroy_consumer(struct g_consumer *cp)
g_free(cp);
}
+static void
+g_new_provider_event(void *arg, int flag)
+{
+ struct g_class *mp;
+ struct g_provider *pp;
+ struct g_consumer *cp;
+ int i;
+
+ g_topology_assert();
+ if (flag == EV_CANCEL)
+ return;
+ if (g_shutdown)
+ return;
+ pp = arg;
+ LIST_FOREACH(mp, &g_classes, class) {
+ if (mp->taste == NULL)
+ continue;
+ i = 1;
+ LIST_FOREACH(cp, &pp->consumers, consumers)
+ if (cp->geom->class == mp)
+ i = 0;
+ if (!i)
+ continue;
+ mp->taste(mp, pp, 0);
+ g_topology_assert();
+ }
+}
+
+
struct g_provider *
g_new_providerf(struct g_geom *gp, const char *fmt, ...)
{
@@ -213,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_post_event(EV_NEW_PROVIDER, pp, NULL);
+ g_call_me(g_new_provider_event, pp, pp, NULL);
return (pp);
}
@@ -462,7 +491,7 @@ 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_post_event(EV_NEW_PROVIDER, pp, NULL);
+ g_call_me(g_new_provider_event, pp, pp, NULL);
pp->acr += dcr;
pp->acw += dcw;
OpenPOWER on IntegriCloud