static void nhrp_cache_reset_new(struct nhrp_cache *c)
{
THREAD_OFF(c->t_auth);
- if (list_hashed(&c->newpeer_notifier.notifier_entry))
+ if (notifier_list_anywhere(&c->newpeer_notifier))
nhrp_peer_notify_del(c->new.peer, &c->newpeer_notifier);
nhrp_peer_unref(c->new.peer);
memset(&c->new, 0, sizeof(c->new));
void nhrp_cache_notify_del(struct nhrp_cache *c, struct notifier_block *n)
{
- notifier_del(n);
+ notifier_del(n, &c->notifier_list);
}
nbmanifp = nbmaifp->info;
if (nbmaifp != nifp->nbmaifp) {
- if (nifp->nbmaifp)
- notifier_del(&nifp->nbmanifp_notifier);
+ if (nifp->nbmaifp) {
+ struct nhrp_interface *prev_nifp = nifp->nbmaifp->info;
+
+ notifier_del(&nifp->nbmanifp_notifier,
+ &prev_nifp->notifier_list);
+ }
nifp->nbmaifp = nbmaifp;
if (nbmaifp) {
notifier_add(&nifp->nbmanifp_notifier,
notifier_fn_t fn)
{
struct nhrp_interface *nifp = ifp->info;
+
notifier_add(n, &nifp->notifier_list, fn);
}
void nhrp_interface_notify_del(struct interface *ifp, struct notifier_block *n)
{
- notifier_del(n);
+ struct nhrp_interface *nifp = ifp->info;
+
+ notifier_del(n, &nifp->notifier_list);
}
void nhrp_interface_set_protection(struct interface *ifp, const char *profile,
typedef void (*notifier_fn_t)(struct notifier_block *, unsigned long);
+PREDECL_DLIST(notifier_list);
+
struct notifier_block {
- struct list_head notifier_entry;
+ struct notifier_list_item notifier_entry;
notifier_fn_t action;
};
+DECLARE_DLIST(notifier_list, struct notifier_block, notifier_entry);
+
struct notifier_list {
- struct list_head notifier_head;
+ struct notifier_list_head head;
};
#define NOTIFIER_LIST_INITIALIZER(l) \
{ \
- .notifier_head = LIST_INITIALIZER((l)->notifier_head) \
+ .head = INIT_DLIST((l)->head) \
}
static inline void notifier_init(struct notifier_list *l)
{
- list_init(&l->notifier_head);
+ notifier_list_init(&l->head);
}
static inline void notifier_add(struct notifier_block *n,
struct notifier_list *l, notifier_fn_t action)
{
n->action = action;
- list_add_tail(&n->notifier_entry, &l->notifier_head);
+ notifier_list_add_tail(&l->head, n);
}
-static inline void notifier_del(struct notifier_block *n)
+static inline void notifier_del(struct notifier_block *n,
+ struct notifier_list *l)
{
- list_del(&n->notifier_entry);
+ notifier_list_del(&l->head, n);
}
static inline void notifier_call(struct notifier_list *l, int cmd)
{
- struct notifier_block *n, *nn;
- list_for_each_entry_safe(n, nn, &l->notifier_head, notifier_entry) {
+ struct notifier_block *n;
+
+ frr_each_safe (notifier_list, &l->head, n)
n->action(n, cmd);
- }
}
static inline int notifier_active(struct notifier_list *l)
{
- return !list_empty(&l->notifier_head);
+ return notifier_list_count(&l->head) > 0;
}
extern struct hash *nhrp_gre_list;