Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/geom_subr.c
Show First 20 Lines • Show All 890 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
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")); | ||||
if ((pp->flags & (G_PF_ORPHAN | G_PF_WITHER)) != 0) | |||||
return (ENXIO); | |||||
cp->provider = pp; | cp->provider = pp; | ||||
cp->flags &= ~G_CF_ORPHAN; | 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); | ||||
▲ Show 20 Lines • Show All 768 Lines • Show Last 20 Lines |