Changeset View
Changeset View
Standalone View
Standalone View
head/sys/geom/geom_subr.c
Show First 20 Lines • Show All 822 Lines • ▼ Show 20 Lines | g_attach(struct g_consumer *cp, struct g_provider *pp) | ||||
int error; | int error; | ||||
g_topology_assert(); | g_topology_assert(); | ||||
G_VALID_CONSUMER(cp); | G_VALID_CONSUMER(cp); | ||||
G_VALID_PROVIDER(pp); | G_VALID_PROVIDER(pp); | ||||
g_trace(G_T_TOPOLOGY, "g_attach(%p, %p)", cp, pp); | g_trace(G_T_TOPOLOGY, "g_attach(%p, %p)", cp, pp); | ||||
KASSERT(cp->provider == NULL, ("attach but attached")); | KASSERT(cp->provider == NULL, ("attach but attached")); | ||||
cp->provider = pp; | cp->provider = pp; | ||||
cp->flags &= ~G_CF_ORPHAN; | |||||
LIST_INSERT_HEAD(&pp->consumers, cp, consumers); | LIST_INSERT_HEAD(&pp->consumers, cp, consumers); | ||||
error = redo_rank(cp->geom); | error = redo_rank(cp->geom); | ||||
if (error) { | if (error) { | ||||
LIST_REMOVE(cp, consumers); | LIST_REMOVE(cp, consumers); | ||||
cp->provider = NULL; | cp->provider = NULL; | ||||
redo_rank(cp->geom); | redo_rank(cp->geom); | ||||
} | } | ||||
return (error); | return (error); | ||||
▲ Show 20 Lines • Show All 731 Lines • Show Last 20 Lines |