Changeset View
Changeset View
Standalone View
Standalone View
head/sys/net/route/nhop_ctl.c
Show First 20 Lines • Show All 592 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct nhop_priv *nh_priv; | struct nhop_priv *nh_priv; | ||||
nh_priv = __containerof(ctx, struct nhop_priv, nh_epoch_ctx); | nh_priv = __containerof(ctx, struct nhop_priv, nh_epoch_ctx); | ||||
destroy_nhop(nh_priv); | destroy_nhop(nh_priv); | ||||
} | } | ||||
int | void | ||||
nhop_ref_object(struct nhop_object *nh) | nhop_ref_object(struct nhop_object *nh) | ||||
{ | { | ||||
u_int old; | |||||
old = refcount_acquire(&nh->nh_priv->nh_refcnt); | |||||
KASSERT(old > 0, ("%s: nhop object %p has 0 refs", __func__, nh)); | |||||
} | |||||
int | |||||
nhop_try_ref_object(struct nhop_object *nh) | |||||
{ | |||||
return (refcount_acquire_if_not_zero(&nh->nh_priv->nh_refcnt)); | return (refcount_acquire_if_not_zero(&nh->nh_priv->nh_refcnt)); | ||||
} | } | ||||
void | void | ||||
nhop_free(struct nhop_object *nh) | nhop_free(struct nhop_object *nh) | ||||
{ | { | ||||
struct nh_control *ctl; | struct nh_control *ctl; | ||||
struct nhop_priv *nh_priv = nh->nh_priv; | struct nhop_priv *nh_priv = nh->nh_priv; | ||||
Show All 36 Lines | nhop_free(struct nhop_object *nh) | ||||
epoch_call(net_epoch_preempt, destroy_nhop_epoch, | epoch_call(net_epoch_preempt, destroy_nhop_epoch, | ||||
&nh_priv->nh_epoch_ctx); | &nh_priv->nh_epoch_ctx); | ||||
} | } | ||||
int | int | ||||
nhop_ref_any(struct nhop_object *nh) | nhop_ref_any(struct nhop_object *nh) | ||||
{ | { | ||||
return (nhop_ref_object(nh)); | return (nhop_try_ref_object(nh)); | ||||
} | } | ||||
void | void | ||||
nhop_free_any(struct nhop_object *nh) | nhop_free_any(struct nhop_object *nh) | ||||
{ | { | ||||
nhop_free(nh); | nhop_free(nh); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 173 Lines • Show Last 20 Lines |