diff options
author | Donald Sharp <sharpd@nvidia.com> | 2022-12-25 16:26:52 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2023-03-24 13:32:17 +0100 |
commit | e16d030c65ca97b1ba68b93ada93b1d4edde59d3 (patch) | |
tree | e3a57a2e2887a899cad71c0640047b2b2409b5fa | |
parent | lib, zebra: Convert THREAD_TIMER_STRLEN to EVENT_TIMER_STRLEN (diff) | |
download | frr-e16d030c65ca97b1ba68b93ada93b1d4edde59d3.tar.xz frr-e16d030c65ca97b1ba68b93ada93b1d4edde59d3.zip |
*: Convert THREAD_XXX macros to EVENT_XXX macros
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
191 files changed, 1243 insertions, 1248 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c index 184dfbc8f..3096f47d5 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -620,14 +620,14 @@ struct bfd_session *ptm_bfd_sess_find(struct bfd_pkt *cp, void bfd_xmt_cb(struct event *t) { - struct bfd_session *bs = THREAD_ARG(t); + struct bfd_session *bs = EVENT_ARG(t); ptm_bfd_xmt_TO(bs, 0); } void bfd_echo_xmt_cb(struct event *t) { - struct bfd_session *bs = THREAD_ARG(t); + struct bfd_session *bs = EVENT_ARG(t); if (bs->echo_xmt_TO > 0) ptm_bfd_echo_xmt_TO(bs); @@ -636,7 +636,7 @@ void bfd_echo_xmt_cb(struct event *t) /* Was ptm_bfd_detect_TO() */ void bfd_recvtimer_cb(struct event *t) { - struct bfd_session *bs = THREAD_ARG(t); + struct bfd_session *bs = EVENT_ARG(t); switch (bs->ses_state) { case PTM_BFD_INIT: @@ -649,7 +649,7 @@ void bfd_recvtimer_cb(struct event *t) /* Was ptm_bfd_echo_detect_TO() */ void bfd_echo_recvtimer_cb(struct event *t) { - struct bfd_session *bs = THREAD_ARG(t); + struct bfd_session *bs = EVENT_ARG(t); switch (bs->ses_state) { case PTM_BFD_INIT: @@ -1999,12 +1999,12 @@ static int bfd_vrf_disable(struct vrf *vrf) zlog_debug("VRF disable %s id %d", vrf->name, vrf->vrf_id); /* Disable read/write poll triggering. */ - THREAD_OFF(bvrf->bg_ev[0]); - THREAD_OFF(bvrf->bg_ev[1]); - THREAD_OFF(bvrf->bg_ev[2]); - THREAD_OFF(bvrf->bg_ev[3]); - THREAD_OFF(bvrf->bg_ev[4]); - THREAD_OFF(bvrf->bg_ev[5]); + EVENT_OFF(bvrf->bg_ev[0]); + EVENT_OFF(bvrf->bg_ev[1]); + EVENT_OFF(bvrf->bg_ev[2]); + EVENT_OFF(bvrf->bg_ev[3]); + EVENT_OFF(bvrf->bg_ev[4]); + EVENT_OFF(bvrf->bg_ev[5]); /* Close all descriptors. */ socket_close(&bvrf->bg_echo); diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c index 2e7bd835f..311ce4d37 100644 --- a/bfdd/bfd_packet.c +++ b/bfdd/bfd_packet.c @@ -701,27 +701,27 @@ ssize_t bfd_recv_ipv6(int sd, uint8_t *msgbuf, size_t msgbuflen, uint8_t *ttl, static void bfd_sd_reschedule(struct bfd_vrf_global *bvrf, int sd) { if (sd == bvrf->bg_shop) { - THREAD_OFF(bvrf->bg_ev[0]); + EVENT_OFF(bvrf->bg_ev[0]); event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop, &bvrf->bg_ev[0]); } else if (sd == bvrf->bg_mhop) { - THREAD_OFF(bvrf->bg_ev[1]); + EVENT_OFF(bvrf->bg_ev[1]); event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop, &bvrf->bg_ev[1]); } else if (sd == bvrf->bg_shop6) { - THREAD_OFF(bvrf->bg_ev[2]); + EVENT_OFF(bvrf->bg_ev[2]); event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop6, &bvrf->bg_ev[2]); } else if (sd == bvrf->bg_mhop6) { - THREAD_OFF(bvrf->bg_ev[3]); + EVENT_OFF(bvrf->bg_ev[3]); event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop6, &bvrf->bg_ev[3]); } else if (sd == bvrf->bg_echo) { - THREAD_OFF(bvrf->bg_ev[4]); + EVENT_OFF(bvrf->bg_ev[4]); event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echo, &bvrf->bg_ev[4]); } else if (sd == bvrf->bg_echov6) { - THREAD_OFF(bvrf->bg_ev[5]); + EVENT_OFF(bvrf->bg_ev[5]); event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echov6, &bvrf->bg_ev[5]); } @@ -770,7 +770,7 @@ static void cp_debug(bool mhop, struct sockaddr_any *peer, void bfd_recv_cb(struct event *t) { - int sd = THREAD_FD(t); + int sd = EVENT_FD(t); struct bfd_session *bfd; struct bfd_pkt *cp; bool is_mhop; @@ -781,7 +781,7 @@ void bfd_recv_cb(struct event *t) struct sockaddr_any local, peer; uint8_t msgbuf[1516]; struct interface *ifp = NULL; - struct bfd_vrf_global *bvrf = THREAD_ARG(t); + struct bfd_vrf_global *bvrf = EVENT_ARG(t); /* Schedule next read. */ bfd_sd_reschedule(bvrf, sd); diff --git a/bfdd/control.c b/bfdd/control.c index 739de23b5..f435358f3 100644 --- a/bfdd/control.c +++ b/bfdd/control.c @@ -144,7 +144,7 @@ void control_shutdown(void) void control_accept(struct event *t) { - int csock, sd = THREAD_FD(t); + int csock, sd = EVENT_FD(t); csock = accept(sd, NULL, 0); if (csock == -1) { @@ -381,7 +381,7 @@ static void control_reset_buf(struct bfd_control_buffer *bcb) static void control_read(struct event *t) { - struct bfd_control_socket *bcs = THREAD_ARG(t); + struct bfd_control_socket *bcs = EVENT_ARG(t); struct bfd_control_buffer *bcb = &bcs->bcs_bin; int sd = bcs->bcs_sd; struct bfd_control_msg bcm; @@ -516,7 +516,7 @@ schedule_next_read: static void control_write(struct event *t) { - struct bfd_control_socket *bcs = THREAD_ARG(t); + struct bfd_control_socket *bcs = EVENT_ARG(t); struct bfd_control_buffer *bcb = bcs->bcs_bout; int sd = bcs->bcs_sd; ssize_t bwrite; diff --git a/bfdd/dplane.c b/bfdd/dplane.c index 7bdebfa1f..92e9466a1 100644 --- a/bfdd/dplane.c +++ b/bfdd/dplane.c @@ -307,14 +307,14 @@ static ssize_t bfd_dplane_flush(struct bfd_dplane_ctx *bdc) stream_pulldown(bdc->outbuf); /* Disable write ready events. */ - THREAD_OFF(bdc->outbufev); + EVENT_OFF(bdc->outbufev); return total; } static void bfd_dplane_write(struct event *t) { - struct bfd_dplane_ctx *bdc = THREAD_ARG(t); + struct bfd_dplane_ctx *bdc = EVENT_ARG(t); /* Handle connection stage. */ if (bdc->connecting && bfd_dplane_client_connecting(bdc)) @@ -601,7 +601,7 @@ skip_read: static void bfd_dplane_read(struct event *t) { - struct bfd_dplane_ctx *bdc = THREAD_ARG(t); + struct bfd_dplane_ctx *bdc = EVENT_ARG(t); int rv; rv = bfd_dplane_expect(bdc, 0, bfd_dplane_handle_message, NULL); @@ -672,7 +672,7 @@ static void bfd_dplane_ctx_free(struct bfd_dplane_ctx *bdc) /* Client mode has special treatment. */ if (bdc->client) { /* Disable connection event if any. */ - THREAD_OFF(bdc->connectev); + EVENT_OFF(bdc->connectev); /* Normal treatment on shutdown. */ if (bglobal.bg_shutdown) @@ -680,8 +680,8 @@ static void bfd_dplane_ctx_free(struct bfd_dplane_ctx *bdc) /* Attempt reconnection. */ socket_close(&bdc->sock); - THREAD_OFF(bdc->inbufev); - THREAD_OFF(bdc->outbufev); + EVENT_OFF(bdc->inbufev); + EVENT_OFF(bdc->outbufev); event_add_timer(master, bfd_dplane_client_connect, bdc, 3, &bdc->connectev); return; @@ -699,8 +699,8 @@ free_resources: socket_close(&bdc->sock); stream_free(bdc->inbuf); stream_free(bdc->outbuf); - THREAD_OFF(bdc->inbufev); - THREAD_OFF(bdc->outbufev); + EVENT_OFF(bdc->inbufev); + EVENT_OFF(bdc->outbufev); XFREE(MTYPE_BFDD_DPLANE_CTX, bdc); } @@ -821,7 +821,7 @@ static uint16_t bfd_dplane_request_counters(const struct bfd_session *bs) */ static void bfd_dplane_accept(struct event *t) { - struct bfd_global *bg = THREAD_ARG(t); + struct bfd_global *bg = EVENT_ARG(t); struct bfd_dplane_ctx *bdc; int sock; @@ -901,7 +901,7 @@ static bool bfd_dplane_client_connecting(struct bfd_dplane_ctx *bdc) static void bfd_dplane_client_connect(struct event *t) { - struct bfd_dplane_ctx *bdc = THREAD_ARG(t); + struct bfd_dplane_ctx *bdc = EVENT_ARG(t); int rv, sock; socklen_t rvlen = sizeof(rv); @@ -949,8 +949,8 @@ static void bfd_dplane_client_connect(struct event *t) } reschedule_connect: - THREAD_OFF(bdc->inbufev); - THREAD_OFF(bdc->outbufev); + EVENT_OFF(bdc->inbufev); + EVENT_OFF(bdc->outbufev); socket_close(&sock); event_add_timer(master, bfd_dplane_client_connect, bdc, 3, &bdc->connectev); @@ -997,7 +997,7 @@ static int bfd_dplane_finish_late(void) bfd_dplane_ctx_free(bdc); /* Cancel accept thread and close socket. */ - THREAD_OFF(bglobal.bg_dplane_sockev); + EVENT_OFF(bglobal.bg_dplane_sockev); close(bglobal.bg_dplane_sock); return 0; diff --git a/bfdd/event.c b/bfdd/event.c index c6326ef91..e797e71f0 100644 --- a/bfdd/event.c +++ b/bfdd/event.c @@ -95,20 +95,20 @@ void bfd_echo_xmttimer_update(struct bfd_session *bs, uint64_t jitter) void bfd_recvtimer_delete(struct bfd_session *bs) { - THREAD_OFF(bs->recvtimer_ev); + EVENT_OFF(bs->recvtimer_ev); } void bfd_echo_recvtimer_delete(struct bfd_session *bs) { - THREAD_OFF(bs->echo_recvtimer_ev); + EVENT_OFF(bs->echo_recvtimer_ev); } void bfd_xmttimer_delete(struct bfd_session *bs) { - THREAD_OFF(bs->xmttimer_ev); + EVENT_OFF(bs->xmttimer_ev); } void bfd_echo_xmttimer_delete(struct bfd_session *bs) { - THREAD_OFF(bs->echo_xmttimer_ev); + EVENT_OFF(bs->echo_xmttimer_ev); } diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index 22bfefc83..8e9739843 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -1337,7 +1337,7 @@ static void bmp_stat_put_u32(struct stream *s, size_t *cnt, uint16_t type, static void bmp_stats(struct event *thread) { - struct bmp_targets *bt = THREAD_ARG(thread); + struct bmp_targets *bt = EVENT_ARG(thread); struct stream *s; struct peer *peer; struct listnode *node; @@ -1390,7 +1390,7 @@ static void bmp_stats(struct event *thread) /* read from the BMP socket to detect session termination */ static void bmp_read(struct event *t) { - struct bmp *bmp = THREAD_ARG(t); + struct bmp *bmp = EVENT_ARG(t); char buf[1024]; ssize_t n; @@ -1495,7 +1495,7 @@ static struct bmp *bmp_open(struct bmp_targets *bt, int bmp_sock) static void bmp_accept(struct event *thread) { union sockunion su; - struct bmp_listener *bl = THREAD_ARG(thread); + struct bmp_listener *bl = EVENT_ARG(thread); int bmp_sock; /* We continue hearing BMP socket. */ @@ -1517,7 +1517,7 @@ static void bmp_close(struct bmp *bmp) struct bmp_queue_entry *bqe; struct bmp_mirrorq *bmq; - THREAD_OFF(bmp->t_read); + EVENT_OFF(bmp->t_read); if (bmp->active) bmp_active_disconnected(bmp->active); @@ -1529,7 +1529,7 @@ static void bmp_close(struct bmp *bmp) if (!bqe->refcount) XFREE(MTYPE_BMP_QUEUE, bqe); - THREAD_OFF(bmp->t_read); + EVENT_OFF(bmp->t_read); pullwr_del(bmp->pullwr); close(bmp->socket); } @@ -1644,7 +1644,7 @@ static void bmp_targets_put(struct bmp_targets *bt) struct bmp *bmp; struct bmp_active *ba; - THREAD_OFF(bt->t_stats); + EVENT_OFF(bt->t_stats); frr_each_safe (bmp_actives, &bt->actives, ba) bmp_active_put(ba); @@ -1729,7 +1729,7 @@ out_sock: static void bmp_listener_stop(struct bmp_listener *bl) { - THREAD_OFF(bl->t_accept); + EVENT_OFF(bl->t_accept); if (bl->sock != -1) close(bl->sock); @@ -1768,9 +1768,9 @@ static struct bmp_active *bmp_active_get(struct bmp_targets *bt, static void bmp_active_put(struct bmp_active *ba) { - THREAD_OFF(ba->t_timer); - THREAD_OFF(ba->t_read); - THREAD_OFF(ba->t_write); + EVENT_OFF(ba->t_timer); + EVENT_OFF(ba->t_read); + EVENT_OFF(ba->t_write); bmp_actives_del(&ba->targets->actives, ba); @@ -1904,16 +1904,16 @@ static void bmp_active_resolved(struct resolver_query *resq, const char *errstr, static void bmp_active_thread(struct event *t) { - struct bmp_active *ba = THREAD_ARG(t); + struct bmp_active *ba = EVENT_ARG(t); socklen_t slen; int status, ret; vrf_id_t vrf_id; /* all 3 end up here, though only timer or read+write are active * at a time */ - THREAD_OFF(ba->t_timer); - THREAD_OFF(ba->t_read); - THREAD_OFF(ba->t_write); + EVENT_OFF(ba->t_timer); + EVENT_OFF(ba->t_read); + EVENT_OFF(ba->t_write); ba->last_err = NULL; @@ -1967,9 +1967,9 @@ static void bmp_active_disconnected(struct bmp_active *ba) static void bmp_active_setup(struct bmp_active *ba) { - THREAD_OFF(ba->t_timer); - THREAD_OFF(ba->t_read); - THREAD_OFF(ba->t_write); + EVENT_OFF(ba->t_timer); + EVENT_OFF(ba->t_read); + EVENT_OFF(ba->t_write); if (ba->bmp) return; @@ -2190,7 +2190,7 @@ DEFPY(bmp_stats_cfg, { VTY_DECLVAR_CONTEXT_SUB(bmp_targets, bt); - THREAD_OFF(bt->t_stats); + EVENT_OFF(bt->t_stats); if (no) bt->stat_msec = 0; else if (interval_str) diff --git a/bgpd/bgp_conditional_adv.c b/bgpd/bgp_conditional_adv.c index 0510ded2e..53652f7dc 100644 --- a/bgpd/bgp_conditional_adv.c +++ b/bgpd/bgp_conditional_adv.c @@ -165,7 +165,7 @@ static void bgp_conditional_adv_timer(struct event *t) route_map_result_t ret; bool advmap_table_changed = false; - bgp = THREAD_ARG(t); + bgp = EVENT_ARG(t); assert(bgp); event_add_timer(bm->master, bgp_conditional_adv_timer, bgp, @@ -351,7 +351,7 @@ void bgp_conditional_adv_disable(struct peer *peer, afi_t afi, safi_t safi) } /* Last filter removed. So cancel conditional routes polling thread. */ - THREAD_OFF(bgp->t_condition_check); + EVENT_OFF(bgp->t_condition_check); } static void peer_advertise_map_filter_update(struct peer *peer, afi_t afi, diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index b33480b63..419587ae1 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -104,7 +104,7 @@ static void bgp_reuse_timer(struct event *t) struct bgp_damp_info *next; time_t t_now, t_diff; - struct bgp_damp_config *bdc = THREAD_ARG(t); + struct bgp_damp_config *bdc = EVENT_ARG(t); bdc->t_reuse = NULL; event_add_timer(bm->master, bgp_reuse_timer, bdc, DELTA_REUSE, @@ -451,7 +451,7 @@ int bgp_damp_disable(struct bgp *bgp, afi_t afi, safi_t safi) return 0; /* Cancel reuse event. */ - THREAD_OFF(bdc->t_reuse); + EVENT_OFF(bdc->t_reuse); /* Clean BGP dampening information. */ bgp_damp_info_clean(afi, safi); diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 0087de95a..d59e1925e 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -431,7 +431,7 @@ static unsigned int bgp_dump_routes_func(int afi, int first_run, static void bgp_dump_interval_func(struct event *t) { struct bgp_dump *bgp_dump; - bgp_dump = THREAD_ARG(t); + bgp_dump = EVENT_ARG(t); /* Reschedule dump even if file couldn't be opened this time... */ if (bgp_dump_open_file(bgp_dump) != NULL) { @@ -691,7 +691,7 @@ static int bgp_dump_unset(struct bgp_dump *bgp_dump) } /* Removing interval event. */ - THREAD_OFF(bgp_dump->t_interval); + EVENT_OFF(bgp_dump->t_interval); bgp_dump->interval = 0; diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c index c0daae45d..d821d4d58 100644 --- a/bgpd/bgp_evpn_mh.c +++ b/bgpd/bgp_evpn_mh.c @@ -4936,7 +4936,7 @@ void bgp_evpn_mh_finish(void) bgp_evpn_es_local_info_clear(es, true); } if (bgp_mh_info->t_cons_check) - THREAD_OFF(bgp_mh_info->t_cons_check); + EVENT_OFF(bgp_mh_info->t_cons_check); list_delete(&bgp_mh_info->local_es_list); list_delete(&bgp_mh_info->pend_es_list); list_delete(&bgp_mh_info->ead_es_export_rtl); diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 9e9861310..9118be3a7 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -169,17 +169,17 @@ static struct peer *peer_xfer_conn(struct peer *from_peer) */ bgp_keepalives_off(from_peer); - THREAD_OFF(peer->t_routeadv); - THREAD_OFF(peer->t_connect); - THREAD_OFF(peer->t_delayopen); - THREAD_OFF(peer->t_connect_check_r); - THREAD_OFF(peer->t_connect_check_w); - THREAD_OFF(from_peer->t_routeadv); - THREAD_OFF(from_peer->t_connect); - THREAD_OFF(from_peer->t_delayopen); - THREAD_OFF(from_peer->t_connect_check_r); - THREAD_OFF(from_peer->t_connect_check_w); - THREAD_OFF(from_peer->t_process_packet); + EVENT_OFF(peer->t_routeadv); + EVENT_OFF(peer->t_connect); + EVENT_OFF(peer->t_delayopen); + EVENT_OFF(peer->t_connect_check_r); + EVENT_OFF(peer->t_connect_check_w); + EVENT_OFF(from_peer->t_routeadv); + EVENT_OFF(from_peer->t_connect); + EVENT_OFF(from_peer->t_delayopen); + EVENT_OFF(from_peer->t_connect_check_r); + EVENT_OFF(from_peer->t_connect_check_w); + EVENT_OFF(from_peer->t_process_packet); /* * At this point in time, it is possible that there are packets pending @@ -364,23 +364,23 @@ void bgp_timer_set(struct peer *peer) inactive. All other timer must be turned off */ if (BGP_PEER_START_SUPPRESSED(peer) || !peer_active(peer) || peer->bgp->vrf_id == VRF_UNKNOWN) { - THREAD_OFF(peer->t_start); + EVENT_OFF(peer->t_start); } else { BGP_TIMER_ON(peer->t_start, bgp_start_timer, peer->v_start); } - THREAD_OFF(peer->t_connect); - THREAD_OFF(peer->t_holdtime); + EVENT_OFF(peer->t_connect); + EVENT_OFF(peer->t_holdtime); bgp_keepalives_off(peer); - THREAD_OFF(peer->t_routeadv); - THREAD_OFF(peer->t_delayopen); + EVENT_OFF(peer->t_routeadv); + EVENT_OFF(peer->t_delayopen); break; case Connect: /* After start timer is expired, the peer moves to Connect status. Make sure start timer is off and connect timer is on. */ - THREAD_OFF(peer->t_start); + EVENT_OFF(peer->t_start); if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER_DELAYOPEN)) BGP_TIMER_ON(peer->t_connect, bgp_connect_timer, (peer->v_delayopen + peer->v_connect)); @@ -388,19 +388,19 @@ void bgp_timer_set(struct peer *peer) BGP_TIMER_ON(peer->t_connect, bgp_connect_timer, peer->v_connect); - THREAD_OFF(peer->t_holdtime); + EVENT_OFF(peer->t_holdtime); bgp_keepalives_off(peer); - THREAD_OFF(peer->t_routeadv); + EVENT_OFF(peer->t_routeadv); break; case Active: /* Active is waiting connection from remote peer. And if connect timer is expired, change status to Connect. */ - THREAD_OFF(peer->t_start); + EVENT_OFF(peer->t_start); /* If peer is passive mode, do not set connect timer. */ if (CHECK_FLAG(peer->flags, PEER_FLAG_PASSIVE) || CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)) { - THREAD_OFF(peer->t_connect); + EVENT_OFF(peer->t_connect); } else { if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER_DELAYOPEN)) BGP_TIMER_ON( @@ -410,30 +410,30 @@ void bgp_timer_set(struct peer *peer) BGP_TIMER_ON(peer->t_connect, bgp_connect_timer, peer->v_connect); } - THREAD_OFF(peer->t_holdtime); + EVENT_OFF(peer->t_holdtime); bgp_keepalives_off(peer); - THREAD_OFF(peer->t_routeadv); + EVENT_OFF(peer->t_routeadv); break; case OpenSent: /* OpenSent status. */ - THREAD_OFF(peer->t_start); - THREAD_OFF(peer->t_connect); + EVENT_OFF(peer->t_start); + EVENT_OFF(peer->t_connect); if (peer->v_holdtime != 0) { BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer, peer->v_holdtime); } else { - THREAD_OFF(peer->t_holdtime); + EVENT_OFF(peer->t_holdtime); } bgp_keepalives_off(peer); - THREAD_OFF(peer->t_routeadv); - THREAD_OFF(peer->t_delayopen); + EVENT_OFF(peer->t_routeadv); + EVENT_OFF(peer->t_delayopen); break; case OpenConfirm: /* OpenConfirm status. */ - THREAD_OFF(peer->t_start); - THREAD_OFF(peer->t_connect); + EVENT_OFF(peer->t_start); + EVENT_OFF(peer->t_connect); /* * If the negotiated Hold Time value is zero, then the Hold Time @@ -441,7 +441,7 @@ void bgp_timer_set(struct peer *peer) * Additionally if a different hold timer has been negotiated * than we must stop then start the timer again */ - THREAD_OFF(peer->t_holdtime); + EVENT_OFF(peer->t_holdtime); if (peer->v_holdtime == 0) bgp_keepalives_off(peer); else { @@ -449,16 +449,16 @@ void bgp_timer_set(struct peer *peer) peer->v_holdtime); bgp_keepalives_on(peer); } - THREAD_OFF(peer->t_routeadv); - THREAD_OFF(peer->t_delayopen); + EVENT_OFF(peer->t_routeadv); + EVENT_OFF(peer->t_delayopen); break; case Established: /* In Established status start and connect timer is turned off. */ - THREAD_OFF(peer->t_start); - THREAD_OFF(peer->t_connect); - THREAD_OFF(peer->t_delayopen); + EVENT_OFF(peer->t_start); + EVENT_OFF(peer->t_connect); + EVENT_OFF(peer->t_delayopen); /* * Same as OpenConfirm, if holdtime is zero then both holdtime @@ -466,7 +466,7 @@ void bgp_timer_set(struct peer *peer) * Additionally if a different hold timer has been negotiated * then we must stop then start the timer again */ - THREAD_OFF(peer->t_holdtime); + EVENT_OFF(peer->t_holdtime); if (peer->v_holdtime == 0) bgp_keepalives_off(peer); else { @@ -476,22 +476,22 @@ void bgp_timer_set(struct peer *peer) } break; case Deleted: - THREAD_OFF(peer->t_gr_restart); - THREAD_OFF(peer->t_gr_stale); + EVENT_OFF(peer->t_gr_restart); + EVENT_OFF(peer->t_gr_stale); FOREACH_AFI_SAFI (afi, safi) - THREAD_OFF(peer->t_llgr_stale[afi][safi]); + EVENT_OFF(peer->t_llgr_stale[afi][safi]); - THREAD_OFF(peer->t_pmax_restart); - THREAD_OFF(peer->t_refresh_stalepath); + EVENT_OFF(peer->t_pmax_restart); + EVENT_OFF(peer->t_refresh_stalepath); /* fallthru */ case Clearing: - THREAD_OFF(peer->t_start); - THREAD_OFF(peer->t_connect); - THREAD_OFF(peer->t_holdtime); + EVENT_OFF(peer->t_start); + EVENT_OFF(peer->t_connect); + EVENT_OFF(peer->t_holdtime); bgp_keepalives_off(peer); - THREAD_OFF(peer->t_routeadv); - THREAD_OFF(peer->t_delayopen); + EVENT_OFF(peer->t_routeadv); + EVENT_OFF(peer->t_delayopen); break; case BGP_STATUS_MAX: flog_err(EC_LIB_DEVELOPMENT, @@ -506,12 +506,12 @@ static void bgp_start_timer(struct event *thread) { struct peer *peer; - peer = THREAD_ARG(thread); + peer = EVENT_ARG(thread); if (bgp_debug_neighbor_events(peer)) zlog_debug("%s [FSM] Timer (start timer expire).", peer->host); - THREAD_VAL(thread) = BGP_Start; + EVENT_VAL(thread) = BGP_Start; bgp_event(thread); /* bgp_event unlocks peer */ } @@ -520,10 +520,10 @@ static void bgp_connect_timer(struct event *thread) { struct peer *peer; - peer = THREAD_ARG(thread); + peer = EVENT_ARG(thread); /* stop the DelayOpenTimer if it is running */ - THREAD_OFF(peer->t_delayopen); + EVENT_OFF(peer->t_delayopen); assert(!peer->t_write); assert(!peer->t_read); @@ -534,7 +534,7 @@ static void bgp_connect_timer(struct event *thread) if (CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER)) bgp_stop(peer); else { - THREAD_VAL(thread) = ConnectRetry_timer_expired; + EVENT_VAL(thread) = ConnectRetry_timer_expired; bgp_event(thread); /* bgp_event unlocks peer */ } } @@ -545,7 +545,7 @@ static void bgp_holdtime_timer(struct event *thread) atomic_size_t inq_count; struct peer *peer; - peer = THREAD_ARG(thread); + peer = EVENT_ARG(thread); if (bgp_debug_neighbor_events(peer)) zlog_debug("%s [FSM] Timer (holdtime timer expire)", @@ -567,7 +567,7 @@ static void bgp_holdtime_timer(struct event *thread) BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer, peer->v_holdtime); - THREAD_VAL(thread) = Hold_Timer_expired; + EVENT_VAL(thread) = Hold_Timer_expired; bgp_event(thread); /* bgp_event unlocks peer */ } @@ -575,7 +575,7 @@ void bgp_routeadv_timer(struct event *thread) { struct peer *peer; - peer = THREAD_ARG(thread); + peer = EVENT_ARG(thread); if (bgp_debug_neighbor_events(peer)) zlog_debug("%s [FSM] Timer (routeadv timer expire)", @@ -596,13 +596,13 @@ void bgp_delayopen_timer(struct event *thread) { struct peer *peer; - peer = THREAD_ARG(thread); + peer = EVENT_ARG(thread); if (bgp_debug_neighbor_events(peer)) zlog_debug("%s [FSM] Timer (DelayOpentimer expire)", peer->host); - THREAD_VAL(thread) = DelayOpen_timer_expired; + EVENT_VAL(thread) = DelayOpen_timer_expired; bgp_event(thread); /* bgp_event unlocks peer */ } @@ -655,7 +655,7 @@ static void bgp_graceful_restart_timer_off(struct peer *peer) return; UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT); - THREAD_OFF(peer->t_gr_stale); + EVENT_OFF(peer->t_gr_stale); if (peer_dynamic_neighbor(peer) && !(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) { @@ -675,7 +675,7 @@ static void bgp_llgr_stale_timer_expire(struct event *thread) afi_t afi; safi_t safi; - paf = THREAD_ARG(thread); + paf = EVENT_ARG(thread); peer = paf->peer; afi = paf->afi; @@ -778,7 +778,7 @@ static void bgp_graceful_restart_timer_expire(struct event *thread) afi_t afi; safi_t safi; - peer = THREAD_ARG(thread); + peer = EVENT_ARG(thread); if (bgp_debug_neighbor_events(peer)) { zlog_debug("%pBP graceful restart timer expired", peer); @@ -841,7 +841,7 @@ static void bgp_graceful_stale_timer_expire(struct event *thread) afi_t afi; safi_t safi; - peer = THREAD_ARG(thread); + peer = EVENT_ARG(thread); if (bgp_debug_neighbor_events(peer)) zlog_debug("%pBP graceful restart stalepath timer expired", @@ -861,7 +861,7 @@ static void bgp_graceful_deferral_timer_expire(struct event *thread) safi_t safi; struct bgp *bgp; - info = THREAD_ARG(thread); + info = EVENT_ARG(thread); afi = info->afi; safi = info->safi; bgp = info->bgp; @@ -908,8 +908,8 @@ bool bgp_update_delay_configured(struct bgp *bgp) on ending the update delay. */ void bgp_update_delay_end(struct bgp *bgp) { - THREAD_OFF(bgp->t_update_delay); - THREAD_OFF(bgp->t_establish_wait); + EVENT_OFF(bgp->t_update_delay); + EVENT_OFF(bgp->t_establish_wait); /* Reset update-delay related state */ bgp->update_delay_over = 1; @@ -972,7 +972,7 @@ void bgp_start_routeadv(struct bgp *bgp) for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { if (!peer_established(peer)) continue; - THREAD_OFF(peer->t_routeadv); + EVENT_OFF(peer->t_routeadv); BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0); } } @@ -992,7 +992,7 @@ void bgp_adjust_routeadv(struct peer *peer) * different * duration and schedule write thread immediately. */ - THREAD_OFF(peer->t_routeadv); + EVENT_OFF(peer->t_routeadv); peer->synctime = monotime(NULL); /* If suppress fib pending is enabled, route is advertised to @@ -1024,7 +1024,7 @@ void bgp_adjust_routeadv(struct peer *peer) */ diff = difftime(nowtime, peer->last_update); if (diff > (double)peer->v_routeadv) { - THREAD_OFF(peer->t_routeadv); + EVENT_OFF(peer->t_routeadv); BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0); return; } @@ -1051,7 +1051,7 @@ void bgp_adjust_routeadv(struct peer *peer) remain = peer->v_routeadv; diff = peer->v_routeadv - diff; if (diff <= (double)remain) { - THREAD_OFF(peer->t_routeadv); + EVENT_OFF(peer->t_routeadv); BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, diff); } } @@ -1130,8 +1130,8 @@ static void bgp_maxmed_onstartup_timer(struct event *thread) zlog_info("Max med on startup ended - timer expired."); - bgp = THREAD_ARG(thread); - THREAD_OFF(bgp->t_maxmed_onstartup); + bgp = EVENT_ARG(thread); + EVENT_OFF(bgp->t_maxmed_onstartup); bgp->maxmed_onstartup_over = 1; bgp_maxmed_update(bgp); @@ -1172,8 +1172,8 @@ static void bgp_update_delay_timer(struct event *thread) zlog_info("Update delay ended - timer expired."); - bgp = THREAD_ARG(thread); - THREAD_OFF(bgp->t_update_delay); + bgp = EVENT_ARG(thread); + EVENT_OFF(bgp->t_update_delay); bgp_update_delay_end(bgp); } @@ -1184,8 +1184,8 @@ static void bgp_establish_wait_timer(struct event *thread) zlog_info("Establish wait - timer expired."); - bgp = THREAD_ARG(thread); - THREAD_OFF(bgp->t_establish_wait); + bgp = EVENT_ARG(thread); + EVENT_OFF(bgp->t_establish_wait); bgp_check_update_delay(bgp); } @@ -1412,7 +1412,7 @@ enum bgp_fsm_state_progress bgp_stop(struct peer *peer) /* graceful restart */ if (peer->t_gr_stale) { - THREAD_OFF(peer->t_gr_stale); + EVENT_OFF(peer->t_gr_stale); if (bgp_debug_neighbor_events(peer)) zlog_debug( "%pBP graceful restart stalepath timer stopped", @@ -1442,7 +1442,7 @@ enum bgp_fsm_state_progress bgp_stop(struct peer *peer) /* Stop route-refresh stalepath timer */ if (peer->t_refresh_stalepath) { - THREAD_OFF(peer->t_refresh_stalepath); + EVENT_OFF(peer->t_refresh_stalepath); if (bgp_debug_neighbor_events(peer)) zlog_debug( @@ -1476,11 +1476,11 @@ enum bgp_fsm_state_progress bgp_stop(struct peer *peer) /* There is no pending EOR message */ if (gr_info->eor_required == 0) { if (gr_info->t_select_deferral) { - void *info = THREAD_ARG( + void *info = EVENT_ARG( gr_info->t_select_deferral); XFREE(MTYPE_TMP, info); } - THREAD_OFF(gr_info->t_select_deferral); + EVENT_OFF(gr_info->t_select_deferral); gr_info->eor_received = 0; } } @@ -1505,15 +1505,15 @@ enum bgp_fsm_state_progress bgp_stop(struct peer *peer) bgp_writes_off(peer); bgp_reads_off(peer); - THREAD_OFF(peer->t_connect_check_r); - THREAD_OFF(peer->t_connect_check_w); + EVENT_OFF(peer->t_connect_check_r); + EVENT_OFF(peer->t_connect_check_w); /* Stop all timers. */ - THREAD_OFF(peer->t_start); - THREAD_OFF(peer->t_connect); - THREAD_OFF(peer->t_holdtime); - THREAD_OFF(peer->t_routeadv); - THREAD_OFF(peer->t_delayopen); + EVENT_OFF(peer->t_start); + EVENT_OFF(peer->t_connect); + EVENT_OFF(peer->t_holdtime); + EVENT_OFF(peer->t_routeadv); + EVENT_OFF(peer->t_delayopen); /* Clear input and output buffer. */ frr_with_mutex (&peer->io_mtx) { @@ -1660,14 +1660,14 @@ static void bgp_connect_check(struct event *thread) int ret; struct peer *peer; - peer = THREAD_ARG(thread); + peer = EVENT_ARG(thread); assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_READS_ON)); assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON)); assert(!peer->t_read); assert(!peer->t_write); - THREAD_OFF(peer->t_connect_check_r); - THREAD_OFF(peer->t_connect_check_w); + EVENT_OFF(peer->t_connect_check_r); + EVENT_OFF(peer->t_connect_check_w); /* Check file descriptor. */ slen = sizeof(status); @@ -2012,7 +2012,7 @@ static enum bgp_fsm_state_progress bgp_fsm_delayopen_timer_expire(struct peer *peer) { /* Stop the DelayOpenTimer */ - THREAD_OFF(peer->t_delayopen); + EVENT_OFF(peer->t_delayopen); /* Send open message to peer */ bgp_open_send(peer); @@ -2225,7 +2225,7 @@ static enum bgp_fsm_state_progress bgp_establish(struct peer *peer) else { UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_MODE); if (peer->t_gr_stale) { - THREAD_OFF(peer->t_gr_stale); + EVENT_OFF(peer->t_gr_stale); if (bgp_debug_neighbor_events(peer)) zlog_debug( "%pBP graceful restart stalepath timer stopped", @@ -2234,7 +2234,7 @@ static enum bgp_fsm_state_progress bgp_establish(struct peer *peer) } if (peer->t_gr_restart) { - THREAD_OFF(peer->t_gr_restart); + EVENT_OFF(peer->t_gr_restart); if (bgp_debug_neighbor_events(peer)) zlog_debug("%pBP graceful restart timer stopped", peer); } @@ -2250,7 +2250,7 @@ static enum bgp_fsm_state_progress bgp_establish(struct peer *peer) */ FOREACH_AFI_SAFI (afi, safi) { if (peer->t_llgr_stale[afi][safi]) { - THREAD_OFF(peer->t_llgr_stale[afi][safi]); + EVENT_OFF(peer->t_llgr_stale[afi][safi]); if (bgp_debug_neighbor_events(peer)) zlog_debug( "%pBP Long-lived stale timer stopped for afi/safi: %d/%d", @@ -2295,7 +2295,7 @@ static enum bgp_fsm_state_progress bgp_establish(struct peer *peer) * of read-only mode. */ if (!bgp_update_delay_active(peer->bgp)) { - THREAD_OFF(peer->t_routeadv); + EVENT_OFF(peer->t_routeadv); BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0); } @@ -2330,14 +2330,14 @@ static enum bgp_fsm_state_progress bgp_establish(struct peer *peer) /* Keepalive packet is received. */ static enum bgp_fsm_state_progress bgp_fsm_keepalive(struct peer *peer) { - THREAD_OFF(peer->t_holdtime); + EVENT_OFF(peer->t_holdtime); return BGP_FSM_SUCCESS; } /* Update packet is received. */ static enum bgp_fsm_state_progress bgp_fsm_update(struct peer *peer) { - THREAD_OFF(peer->t_holdtime); + EVENT_OFF(peer->t_holdtime); return BGP_FSM_SUCCESS; } @@ -2379,13 +2379,13 @@ void bgp_fsm_nht_update(struct peer *peer, bool has_valid_nexthops) break; case Connect: if (!has_valid_nexthops) { - THREAD_OFF(peer->t_connect); + EVENT_OFF(peer->t_connect); BGP_EVENT_ADD(peer, TCP_fatal_error); } break; case Active: if (has_valid_nexthops) { - THREAD_OFF(peer->t_connect); + EVENT_OFF(peer->t_connect); BGP_EVENT_ADD(peer, ConnectRetry_timer_expired); } break; @@ -2576,8 +2576,8 @@ void bgp_event(struct event *thread) enum bgp_fsm_events event; struct peer *peer; - peer = THREAD_ARG(thread); - event = THREAD_VAL(thread); + peer = EVENT_ARG(thread); + event = EVENT_VAL(thread); peer_lock(peer); bgp_event_update(peer, event); diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index 7781a6c8e..56f01ab23 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -17,7 +17,7 @@ #include "network.h" // for ERRNO_IO_RETRY #include "stream.h" // for stream_get_endp, stream_getw_from, str... #include "ringbuf.h" // for ringbuf_remain, ringbuf_peek, ringbuf_... -#include "event.h" // for THREAD_OFF, THREAD_ARG, thread... +#include "event.h" // for EVENT_OFF, EVENT_ARG, thread... #include "bgpd/bgp_io.h" #include "bgpd/bgp_debug.h" // for bgp_debug_neighbor_events, bgp_type_str @@ -66,7 +66,7 @@ void bgp_writes_off(struct peer *peer) assert(fpt->running); event_cancel_async(fpt->master, &peer->t_write, NULL); - THREAD_OFF(peer->t_generate_updgrp_packets); + EVENT_OFF(peer->t_generate_updgrp_packets); UNSET_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON); } @@ -97,8 +97,8 @@ void bgp_reads_off(struct peer *peer) assert(fpt->running); event_cancel_async(fpt->master, &peer->t_read, NULL); - THREAD_OFF(peer->t_process_packet); - THREAD_OFF(peer->t_process_packet_error); + EVENT_OFF(peer->t_process_packet); + EVENT_OFF(peer->t_process_packet_error); UNSET_FLAG(peer->thread_flags, PEER_THREAD_READS_ON); } @@ -111,7 +111,7 @@ void bgp_reads_off(struct peer *peer) static void bgp_process_writes(struct event *thread) { static struct peer *peer; - peer = THREAD_ARG(thread); + peer = EVENT_ARG(thread); uint16_t status; bool reschedule; bool fatal = false; @@ -223,7 +223,7 @@ static void bgp_process_reads(struct event *thread) int ret = 1; /* clang-format on */ - peer = THREAD_ARG(thread); + peer = EVENT_ARG(thread); if (peer->fd < 0 || bm->terminating) return; diff --git a/bgpd/bgp_keepalives.c b/bgpd/bgp_keepalives.c index e0dea2aed..48bde1220 100644 --- a/bgpd/bgp_keepalives.c +++ b/bgpd/bgp_keepalives.c @@ -15,7 +15,7 @@ #include "memory.h" // for MTYPE_TMP, XFREE, XCALLOC, XMALLOC #include "monotime.h" // for monotime, monotime_since -#include "bgpd/bgpd.h" // for peer, PEER_THREAD_KEEPALIVES_ON, peer... +#include "bgpd/bgpd.h" // for peer, PEER_EVENT_KEEPALIVES_ON, peer... #include "bgpd/bgp_debug.h" // for bgp_debug_neighbor_events #include "bgpd/bgp_packet.h" // for bgp_keepalive_send #include "bgpd/bgp_keepalives.h" diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 91c791499..f5fe9e0fd 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -343,7 +343,7 @@ static void bgp_accept(struct event *thread) int bgp_sock; int accept_sock; union sockunion su; - struct bgp_listener *listener = THREAD_ARG(thread); + struct bgp_listener *listener = EVENT_ARG(thread); struct peer *peer; struct peer *peer1; char buf[SU_ADDRSTRLEN]; @@ -354,7 +354,7 @@ static void bgp_accept(struct event *thread) bgp = bgp_lookup_by_name(listener->name); /* Register accept thread. */ - accept_sock = THREAD_FD(thread); + accept_sock = EVENT_FD(thread); if (accept_sock < 0) { flog_err_sys(EC_LIB_SOCKET, "[Error] BGP accept socket fd is negative: %d", @@ -391,7 +391,7 @@ static void bgp_accept(struct event *thread) "[Error] accept() failed with error \"%s\" on BGP listener socket %d for BGP instance in VRF \"%s\"; refreshing socket", safe_strerror(save_errno), accept_sock, VRF_LOGNAME(vrf)); - THREAD_OFF(listener->thread); + EVENT_OFF(listener->thread); } else { flog_err_sys( EC_LIB_SOCKET, @@ -436,7 +436,7 @@ static void bgp_accept(struct event *thread) sockopt_tcp_mss_set(bgp_sock, peer1->tcp_mss); bgp_fsm_change_status(peer1, Active); - THREAD_OFF( + EVENT_OFF( peer1->t_start); /* created in peer_create() */ if (peer_active(peer1)) { @@ -569,7 +569,7 @@ static void bgp_accept(struct event *thread) } bgp_peer_reg_with_nht(peer); bgp_fsm_change_status(peer, Active); - THREAD_OFF(peer->t_start); /* created in peer_create() */ + EVENT_OFF(peer->t_start); /* created in peer_create() */ SET_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER); /* Make dummy peer until read Open packet. */ @@ -961,7 +961,7 @@ void bgp_close_vrf_socket(struct bgp *bgp) for (ALL_LIST_ELEMENTS(bm->listen_sockets, node, next, listener)) { if (listener->bgp == bgp) { - THREAD_OFF(listener->thread); + EVENT_OFF(listener->thread); close(listener->fd); listnode_delete(bm->listen_sockets, listener); XFREE(MTYPE_BGP_LISTENER, listener->name); @@ -983,7 +983,7 @@ void bgp_close(void) for (ALL_LIST_ELEMENTS(bm->listen_sockets, node, next, listener)) { if (listener->bgp) continue; - THREAD_OFF(listener->thread); + EVENT_OFF(listener->thread); close(listener->fd); listnode_delete(bm->listen_sockets, listener); XFREE(MTYPE_BGP_LISTENER, listener->name); diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 9eef27f76..436e94412 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -758,8 +758,8 @@ void bgp_nht_ifp_down(struct interface *ifp) static void bgp_nht_ifp_initial(struct event *thread) { - ifindex_t ifindex = THREAD_VAL(thread); - struct bgp *bgp = THREAD_ARG(thread); + ifindex_t ifindex = EVENT_VAL(thread); + struct bgp *bgp = EVENT_ARG(thread); struct interface *ifp = if_lookup_by_index(ifindex, bgp->vrf_id); if (!ifp) diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index b8bf38304..6d3ca8aba 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -444,7 +444,7 @@ static void bgp_write_proceed_actions(struct peer *peer) */ void bgp_generate_updgrp_packets(struct event *thread) { - struct peer *peer = THREAD_ARG(thread); + struct peer *peer = EVENT_ARG(thread); struct stream *s; struct peer_af *paf; @@ -1796,7 +1796,7 @@ static void bgp_refresh_stalepath_timer_expire(struct event *thread) { struct peer_af *paf; - paf = THREAD_ARG(thread); + paf = EVENT_ARG(thread); afi_t afi = paf->afi; safi_t safi = paf->safi; @@ -2106,11 +2106,11 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) "EOR RCV", gr_info->eor_received); if (gr_info->t_select_deferral) { - void *info = THREAD_ARG( + void *info = EVENT_ARG( gr_info->t_select_deferral); XFREE(MTYPE_TMP, info); } - THREAD_OFF(gr_info->t_select_deferral); + EVENT_OFF(gr_info->t_select_deferral); gr_info->eor_required = 0; gr_info->eor_received = 0; /* Best path selection */ @@ -2613,7 +2613,7 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size) return BGP_PACKET_NOOP; } - THREAD_OFF(peer->t_refresh_stalepath); + EVENT_OFF(peer->t_refresh_stalepath); SET_FLAG(peer->af_sflags[afi][safi], PEER_STATUS_EORR_RECEIVED); UNSET_FLAG(peer->af_sflags[afi][safi], @@ -2863,7 +2863,7 @@ int bgp_capability_receive(struct peer *peer, bgp_size_t size) * would not, making event flow difficult to understand. Please think twice * before hacking this. * - * Thread type: THREAD_EVENT + * Thread type: EVENT_EVENT * @param thread * @return 0 */ @@ -2875,7 +2875,7 @@ void bgp_process_packet(struct event *thread) int fsm_update_result; // return code of bgp_event_update() int mprc; // message processing return code - peer = THREAD_ARG(thread); + peer = EVENT_ARG(thread); rpkt_quanta_old = atomic_load_explicit(&peer->bgp->rpkt_quanta, memory_order_relaxed); fsm_update_result = 0; @@ -3049,8 +3049,8 @@ void bgp_packet_process_error(struct event *thread) struct peer *peer; int code; - peer = THREAD_ARG(thread); - code = THREAD_VAL(thread); + peer = EVENT_ARG(thread); + code = EVENT_VAL(thread); if (bgp_debug_neighbor_events(peer)) zlog_debug("%s [Event] BGP error %d on fd %d", diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index f2451e588..7296f63f7 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2625,7 +2625,7 @@ static void bgp_route_select_timer_expire(struct event *thread) safi_t safi; struct bgp *bgp; - info = THREAD_ARG(thread); + info = EVENT_ARG(thread); afi = info->afi; safi = info->safi; bgp = info->bgp; @@ -3383,9 +3383,9 @@ void bgp_best_path_select_defer(struct bgp *bgp, afi_t afi, safi_t safi) if (bgp->gr_info[afi][safi].t_route_select) { struct event *t = bgp->gr_info[afi][safi].t_route_select; - thread_info = THREAD_ARG(t); + thread_info = EVENT_ARG(t); XFREE(MTYPE_TMP, thread_info); - THREAD_OFF(bgp->gr_info[afi][safi].t_route_select); + EVENT_OFF(bgp->gr_info[afi][safi].t_route_select); } if (BGP_DEBUG(update, UPDATE_OUT)) { @@ -3589,7 +3589,7 @@ static void bgp_maximum_prefix_restart_timer(struct event *thread) { struct peer *peer; - peer = THREAD_ARG(thread); + peer = EVENT_ARG(thread); peer->t_pmax_restart = NULL; if (bgp_debug_neighbor_events(peer)) @@ -5046,7 +5046,7 @@ void bgp_stop_announce_route_timer(struct peer_af *paf) if (!paf->t_announce_route) return; - THREAD_OFF(paf->t_announce_route); + EVENT_OFF(paf->t_announce_route); } /* @@ -5060,7 +5060,7 @@ static void bgp_announce_route_timer_expired(struct event *t) struct peer_af *paf; struct peer *peer; - paf = THREAD_ARG(t); + paf = EVENT_ARG(t); peer = paf->peer; if (!peer_established(peer)) @@ -5225,7 +5225,7 @@ static void bgp_soft_reconfig_table_task(struct event *thread) struct prefix_rd *prd; struct listnode *node, *nnode; - table = THREAD_ARG(thread); + table = EVENT_ARG(thread); prd = NULL; max_iter = SOFT_RECONFIG_TASK_MAX_PREFIX; @@ -5319,7 +5319,7 @@ void bgp_soft_reconfig_table_task_cancel(const struct bgp *bgp, list_delete(&ntable->soft_reconfig_peers); bgp_soft_reconfig_table_flag(ntable, false); - THREAD_OFF(ntable->soft_reconfig_thread); + EVENT_OFF(ntable->soft_reconfig_thread); } } @@ -13346,7 +13346,7 @@ static void bgp_table_stats_walker(struct event *t) { struct bgp_dest *dest, *ndest; struct bgp_dest *top; - struct bgp_table_stats *ts = THREAD_ARG(t); + struct bgp_table_stats *ts = EVENT_ARG(t); unsigned int space = 0; if (!(top = bgp_table_top(ts->table))) @@ -13743,7 +13743,7 @@ static void bgp_peer_count_walker(struct event *t) { struct bgp_dest *rn, *rm; const struct bgp_table *table; - struct peer_pcounts *pc = THREAD_ARG(t); + struct peer_pcounts *pc = EVENT_ARG(t); if (pc->safi == SAFI_MPLS_VPN || pc->safi == SAFI_ENCAP || pc->safi == SAFI_EVPN) { diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 4fcee75ae..4faf4a9f1 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -4357,7 +4357,7 @@ static void bgp_route_map_mark_update(const char *rmap_name) /* If new update is received before the current timer timed out, * turn it off and start a new timer. */ - THREAD_OFF(bm->t_rmap_update); + EVENT_OFF(bm->t_rmap_update); /* rmap_update_timer of 0 means don't do route updates */ if (bm->rmap_update_timer) { diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index 603ec9c27..cbdb70441 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -383,7 +383,7 @@ struct rpki_revalidate_prefix { static void rpki_revalidate_prefix(struct event *thread) { - struct rpki_revalidate_prefix *rrp = THREAD_ARG(thread); + struct rpki_revalidate_prefix *rrp = EVENT_ARG(thread); struct bgp_dest *match, *node; match = bgp_table_subtree_lookup(rrp->bgp->rib[rrp->afi][rrp->safi], @@ -491,7 +491,7 @@ struct rpki_revalidate_peer { static void bgp_rpki_revalidate_peer(struct event *thread) { - struct rpki_revalidate_peer *rvp = THREAD_ARG(thread); + struct rpki_revalidate_peer *rvp = EVENT_ARG(thread); /* * Here's the expensive bit of gnomish deviousness @@ -693,7 +693,7 @@ static void stop(void) { rtr_is_stopping = true; if (is_running()) { - THREAD_OFF(t_rpki_sync); + EVENT_OFF(t_rpki_sync); rtr_mgr_stop(rtr_config); rtr_mgr_free(rtr_config); rtr_is_running = false; diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index b661303ce..69eda0dd9 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -1099,8 +1099,8 @@ static void update_subgroup_delete(struct update_subgroup *subgrp) if (subgrp->update_group) UPDGRP_INCR_STAT(subgrp->update_group, subgrps_deleted); - THREAD_OFF(subgrp->t_merge_check); - THREAD_OFF(subgrp->t_coalesce); + EVENT_OFF(subgrp->t_merge_check); + EVENT_OFF(subgrp->t_coalesce); bpacket_queue_cleanup(SUBGRP_PKTQ(subgrp)); subgroup_clear_table(subgrp); @@ -1422,7 +1422,7 @@ static void update_subgroup_merge_check_thread_cb(struct event *thread) { struct update_subgroup *subgrp; - subgrp = THREAD_ARG(thread); + subgrp = EVENT_ARG(thread); subgrp->t_merge_check = NULL; @@ -2112,10 +2112,10 @@ void update_group_refresh_default_originate_route_map(struct event *thread) struct bgp *bgp; char reason[] = "refresh default-originate route-map"; - bgp = THREAD_ARG(thread); + bgp = EVENT_ARG(thread); update_group_walk(bgp, update_group_default_originate_route_map_walkcb, reason); - THREAD_OFF(bgp->t_rmap_def_originate_eval); + EVENT_OFF(bgp->t_rmap_def_originate_eval); bgp_unlock(bgp); } diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index b45e9cf82..e2fc9f68b 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -303,7 +303,7 @@ static void subgroup_coalesce_timer(struct event *thread) struct update_subgroup *subgrp; struct bgp *bgp; - subgrp = THREAD_ARG(thread); + subgrp = EVENT_ARG(thread); if (bgp_debug_update(NULL, NULL, subgrp->update_group, 0)) zlog_debug("u%" PRIu64 ":s%" PRIu64" announcing routes upon coalesce timer expiry(%u ms)", (SUBGRP_UPDGRP(subgrp))->id, subgrp->id, @@ -329,7 +329,7 @@ static void subgroup_coalesce_timer(struct event *thread) SUBGRP_FOREACH_PEER (subgrp, paf) { peer = PAF_PEER(paf); - THREAD_OFF(peer->t_routeadv); + EVENT_OFF(peer->t_routeadv); BGP_TIMER_ON(peer->t_routeadv, bgp_routeadv_timer, 0); } } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index c412e2442..342d01866 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -2194,7 +2194,7 @@ DEFUN (no_bgp_maxmed_onstartup, /* Cancel max-med onstartup if its on */ if (bgp->t_maxmed_onstartup) { - THREAD_OFF(bgp->t_maxmed_onstartup); + EVENT_OFF(bgp->t_maxmed_onstartup); bgp->maxmed_onstartup_over = 1; } @@ -7518,7 +7518,7 @@ DEFUN (bgp_set_route_map_delay_timer, * fired. */ if (!rmap_delay_timer && bm->t_rmap_update) { - THREAD_OFF(bm->t_rmap_update); + EVENT_OFF(bm->t_rmap_update); event_execute(bm->master, bgp_route_map_update_timer, NULL, 0); } @@ -18783,7 +18783,7 @@ static void bgp_config_finish(struct event *t) static void bgp_config_start(void) { #define BGP_PRE_CONFIG_MAX_WAIT_SECONDS 600 - THREAD_OFF(t_bgp_cfg); + EVENT_OFF(t_bgp_cfg); event_add_timer(bm->master, bgp_config_finish, NULL, BGP_PRE_CONFIG_MAX_WAIT_SECONDS, &t_bgp_cfg); } @@ -18807,7 +18807,7 @@ static void bgp_config_end(void) if (!bgp_config_inprocess()) return; - THREAD_OFF(t_bgp_cfg); + EVENT_OFF(t_bgp_cfg); /* Start a new timer to make sure we don't send EoR * before route-maps are processed. diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 310b4162c..bca993c60 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1058,7 +1058,7 @@ static void bgp_zebra_tm_connect(struct event *t) struct zclient *zclient; int delay = 10, ret = 0; - zclient = THREAD_ARG(t); + zclient = EVENT_ARG(t); if (bgp_tm_status_connected && zclient->sock > 0) delay = 60; else { diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index abacde9d9..3bf5709c9 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -1128,7 +1128,7 @@ static void peer_free(struct peer *peer) bgp_writes_off(peer); event_cancel_event_ready(bm->master, peer); FOREACH_AFI_SAFI (afi, safi) - THREAD_OFF(peer->t_revalidate_all[afi][safi]); + EVENT_OFF(peer->t_revalidate_all[afi][safi]); assert(!peer->t_write); assert(!peer->t_read); BGP_EVENT_FLUSH(peer); @@ -2467,16 +2467,16 @@ void peer_nsf_stop(struct peer *peer) FOREACH_AFI_SAFI_NSF (afi, safi) { peer->nsf[afi][safi] = 0; - THREAD_OFF(peer->t_llgr_stale[afi][safi]); + EVENT_OFF(peer->t_llgr_stale[afi][safi]); } if (peer->t_gr_restart) { - THREAD_OFF(peer->t_gr_restart); + EVENT_OFF(peer->t_gr_restart); if (bgp_debug_neighbor_events(peer)) zlog_debug("%pBP graceful restart timer stopped", peer); } if (peer->t_gr_stale) { - THREAD_OFF(peer->t_gr_stale); + EVENT_OFF(peer->t_gr_stale); if (bgp_debug_neighbor_events(peer)) zlog_debug( "%pBP graceful restart stalepath timer stopped", @@ -2518,7 +2518,7 @@ int peer_delete(struct peer *peer) bgp_writes_off(peer); event_cancel_event_ready(bm->master, peer); FOREACH_AFI_SAFI (afi, safi) - THREAD_OFF(peer->t_revalidate_all[afi][safi]); + EVENT_OFF(peer->t_revalidate_all[afi][safi]); assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON)); assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_READS_ON)); assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_KEEPALIVES_ON)); @@ -3201,7 +3201,7 @@ static void bgp_startup_timer_expire(struct event *thread) { struct bgp *bgp; - bgp = THREAD_ARG(thread); + bgp = EVENT_ARG(thread); bgp->t_startup = NULL; } @@ -3696,7 +3696,7 @@ void bgp_instance_down(struct bgp *bgp) /* Stop timers. */ if (bgp->t_rmap_def_originate_eval) { - THREAD_OFF(bgp->t_rmap_def_originate_eval); + EVENT_OFF(bgp->t_rmap_def_originate_eval); bgp_unlock(bgp); /* TODO - This timer is started with a lock - why? */ } @@ -3748,13 +3748,13 @@ int bgp_delete(struct bgp *bgp) hook_call(bgp_inst_delete, bgp); FOREACH_AFI_SAFI (afi, safi) - THREAD_OFF(bgp->t_revalidate[afi][safi]); + EVENT_OFF(bgp->t_revalidate[afi][safi]); - THREAD_OFF(bgp->t_condition_check); - THREAD_OFF(bgp->t_startup); - THREAD_OFF(bgp->t_maxmed_onstartup); - THREAD_OFF(bgp->t_update_delay); - THREAD_OFF(bgp->t_establish_wait); + EVENT_OFF(bgp->t_condition_check); + EVENT_OFF(bgp->t_startup); + EVENT_OFF(bgp->t_maxmed_onstartup); + EVENT_OFF(bgp->t_update_delay); + EVENT_OFF(bgp->t_establish_wait); /* Set flag indicating bgp instance delete in progress */ SET_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS); @@ -3768,19 +3768,19 @@ int bgp_delete(struct bgp *bgp) continue; t = gr_info->t_select_deferral; if (t) { - void *info = THREAD_ARG(t); + void *info = EVENT_ARG(t); XFREE(MTYPE_TMP, info); } - THREAD_OFF(gr_info->t_select_deferral); + EVENT_OFF(gr_info->t_select_deferral); t = gr_info->t_route_select; if (t) { - void *info = THREAD_ARG(t); + void *info = EVENT_ARG(t); XFREE(MTYPE_TMP, info); } - THREAD_OFF(gr_info->t_route_select); + EVENT_OFF(gr_info->t_route_select); } if (BGP_DEBUG(zebra, ZEBRA)) { @@ -3803,7 +3803,7 @@ int bgp_delete(struct bgp *bgp) /* Stop timers. */ if (bgp->t_rmap_def_originate_eval) { - THREAD_OFF(bgp->t_rmap_def_originate_eval); + EVENT_OFF(bgp->t_rmap_def_originate_eval); bgp_unlock(bgp); /* TODO - This timer is started with a lock - why? */ } @@ -4528,7 +4528,7 @@ static void peer_flag_modify_action(struct peer *peer, uint64_t flag) UNSET_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW); if (peer->t_pmax_restart) { - THREAD_OFF(peer->t_pmax_restart); + EVENT_OFF(peer->t_pmax_restart); if (bgp_debug_neighbor_events(peer)) zlog_debug( "%pBP Maximum-prefix restart timer canceled", @@ -7398,7 +7398,7 @@ static bool peer_maximum_prefix_clear_overflow(struct peer *peer) UNSET_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW); if (peer->t_pmax_restart) { - THREAD_OFF(peer->t_pmax_restart); + EVENT_OFF(peer->t_pmax_restart); if (bgp_debug_neighbor_events(peer)) zlog_debug( "%pBP Maximum-prefix restart timer cancelled", @@ -8276,7 +8276,7 @@ void bgp_terminate(void) if (bm->listen_sockets) list_delete(&bm->listen_sockets); - THREAD_OFF(bm->t_rmap_update); + EVENT_OFF(bm->t_rmap_update); bgp_mac_finish(); } diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 5c02cd8af..73d7930b4 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -848,10 +848,10 @@ static void rfapiBgpInfoChainFree(struct bgp_path_info *bpi) if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra->vnc.import.timer) { struct rfapi_withdraw *wcb = - THREAD_ARG(bpi->extra->vnc.import.timer); + EVENT_ARG(bpi->extra->vnc.import.timer); XFREE(MTYPE_RFAPI_WITHDRAW, wcb); - THREAD_OFF(bpi->extra->vnc.import.timer); + EVENT_OFF(bpi->extra->vnc.import.timer); } next = bpi->next; @@ -2347,7 +2347,7 @@ static void rfapiMonitorEncapDelete(struct bgp_path_info *vpn_bpi) */ static void rfapiWithdrawTimerVPN(struct event *t) { - struct rfapi_withdraw *wcb = THREAD_ARG(t); + struct rfapi_withdraw *wcb = EVENT_ARG(t); struct bgp_path_info *bpi = wcb->info; struct bgp *bgp = bgp_get_default(); const struct prefix *p; @@ -2656,7 +2656,7 @@ rfapiWithdrawEncapUpdateCachedUn(struct rfapi_import_table *import_table, static void rfapiWithdrawTimerEncap(struct event *t) { - struct rfapi_withdraw *wcb = THREAD_ARG(t); + struct rfapi_withdraw *wcb = EVENT_ARG(t); struct bgp_path_info *bpi = wcb->info; int was_first_route = 0; struct rfapi_monitor_encap *em; @@ -3076,12 +3076,11 @@ static void rfapiBgpInfoFilteredImportEncap( */ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra->vnc.import.timer) { - struct rfapi_withdraw *wcb = THREAD_ARG( + struct rfapi_withdraw *wcb = EVENT_ARG( bpi->extra->vnc.import.timer); XFREE(MTYPE_RFAPI_WITHDRAW, wcb); - THREAD_OFF( - bpi->extra->vnc.import.timer); + EVENT_OFF(bpi->extra->vnc.import.timer); } if (action == FIF_ACTION_UPDATE) { @@ -3169,10 +3168,10 @@ static void rfapiBgpInfoFilteredImportEncap( __func__); if (bpi->extra->vnc.import.timer) { struct rfapi_withdraw *wcb = - THREAD_ARG(bpi->extra->vnc.import.timer); + EVENT_ARG(bpi->extra->vnc.import.timer); XFREE(MTYPE_RFAPI_WITHDRAW, wcb); - THREAD_OFF(bpi->extra->vnc.import.timer); + EVENT_OFF(bpi->extra->vnc.import.timer); } rfapiExpireEncapNow(import_table, rn, bpi); } @@ -3529,12 +3528,11 @@ void rfapiBgpInfoFilteredImportVPN( */ if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra->vnc.import.timer) { - struct rfapi_withdraw *wcb = THREAD_ARG( + struct rfapi_withdraw *wcb = EVENT_ARG( bpi->extra->vnc.import.timer); XFREE(MTYPE_RFAPI_WITHDRAW, wcb); - THREAD_OFF( - bpi->extra->vnc.import.timer); + EVENT_OFF(bpi->extra->vnc.import.timer); import_table->holddown_count[afi] -= 1; RFAPI_UPDATE_ITABLE_COUNT( @@ -3748,10 +3746,10 @@ void rfapiBgpInfoFilteredImportVPN( __func__); if (bpi->extra->vnc.import.timer) { struct rfapi_withdraw *wcb = - THREAD_ARG(bpi->extra->vnc.import.timer); + EVENT_ARG(bpi->extra->vnc.import.timer); XFREE(MTYPE_RFAPI_WITHDRAW, wcb); - THREAD_OFF(bpi->extra->vnc.import.timer); + EVENT_OFF(bpi->extra->vnc.import.timer); } rfapiExpireVpnNow(import_table, rn, bpi, 0); } @@ -4485,7 +4483,7 @@ static void rfapiDeleteRemotePrefixesIt( continue; if (bpi->extra->vnc.import.timer) { struct rfapi_withdraw *wcb = - THREAD_ARG( + EVENT_ARG( bpi->extra->vnc .import .timer); @@ -4498,9 +4496,8 @@ static void rfapiDeleteRemotePrefixesIt( afi, 1); XFREE(MTYPE_RFAPI_WITHDRAW, wcb); - THREAD_OFF( - bpi->extra->vnc.import - .timer); + EVENT_OFF(bpi->extra->vnc.import + .timer); } } else { if (!delete_active) diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c index d3a1b84b5..3fe957ba4 100644 --- a/bgpd/rfapi/rfapi_monitor.c +++ b/bgpd/rfapi/rfapi_monitor.c @@ -619,7 +619,7 @@ void rfapiMonitorDel(struct bgp *bgp, struct rfapi_descriptor *rfd, rfapiMonitorDetachImport(m); } - THREAD_OFF(m->timer); + EVENT_OFF(m->timer); /* * remove from rfd list @@ -656,7 +656,7 @@ int rfapiMonitorDelHd(struct rfapi_descriptor *rfd) rfapiMonitorDetachImport(m); } - THREAD_OFF(m->timer); + EVENT_OFF(m->timer); XFREE(MTYPE_RFAPI_MONITOR, m); rn->info = NULL; @@ -690,7 +690,7 @@ int rfapiMonitorDelHd(struct rfapi_descriptor *rfd) #endif } - THREAD_OFF(mon_eth->timer); + EVENT_OFF(mon_eth->timer); /* * remove from rfd list @@ -732,7 +732,7 @@ void rfapiMonitorResponseRemovalOn(struct bgp *bgp) static void rfapiMonitorTimerExpire(struct event *t) { - struct rfapi_monitor_vpn *m = THREAD_ARG(t); + struct rfapi_monitor_vpn *m = EVENT_ARG(t); /* forget reference to thread, it's gone */ m->timer = NULL; @@ -753,7 +753,7 @@ static void rfapiMonitorTimerRestart(struct rfapi_monitor_vpn *m) if (m->rfd->response_lifetime - remain < 2) return; - THREAD_OFF(m->timer); + EVENT_OFF(m->timer); { char buf[BUFSIZ]; @@ -1038,7 +1038,7 @@ void rfapiMonitorMovedUp(struct rfapi_import_table *import_table, static void rfapiMonitorEthTimerExpire(struct event *t) { - struct rfapi_monitor_eth *m = THREAD_ARG(t); + struct rfapi_monitor_eth *m = EVENT_ARG(t); /* forget reference to thread, it's gone */ m->timer = NULL; @@ -1061,7 +1061,7 @@ static void rfapiMonitorEthTimerRestart(struct rfapi_monitor_eth *m) if (m->rfd->response_lifetime - remain < 2) return; - THREAD_OFF(m->timer); + EVENT_OFF(m->timer); { char buf[BUFSIZ]; @@ -1399,7 +1399,7 @@ void rfapiMonitorEthDel(struct bgp *bgp, struct rfapi_descriptor *rfd, rfapiMonitorEthDetachImport(bgp, val); } - THREAD_OFF(val->timer); + EVENT_OFF(val->timer); /* * remove from rfd list diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c index 3febea96b..4dc3139ed 100644 --- a/bgpd/rfapi/rfapi_rib.c +++ b/bgpd/rfapi/rfapi_rib.c @@ -255,8 +255,8 @@ static void rfapi_info_free(struct rfapi_info *goner) if (goner->timer) { struct rfapi_rib_tcb *tcb; - tcb = THREAD_ARG(goner->timer); - THREAD_OFF(goner->timer); + tcb = EVENT_ARG(goner->timer); + EVENT_OFF(goner->timer); XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb); } XFREE(MTYPE_RFAPI_INFO, goner); @@ -280,7 +280,7 @@ struct rfapi_rib_tcb { */ static void rfapiRibExpireTimer(struct event *t) { - struct rfapi_rib_tcb *tcb = THREAD_ARG(t); + struct rfapi_rib_tcb *tcb = EVENT_ARG(t); RFAPI_RIB_CHECK_COUNTS(1, 0); @@ -325,8 +325,8 @@ static void rfapiRibStartTimer(struct rfapi_descriptor *rfd, struct rfapi_rib_tcb *tcb = NULL; if (ri->timer) { - tcb = THREAD_ARG(ri->timer); - THREAD_OFF(ri->timer); + tcb = EVENT_ARG(ri->timer); + EVENT_OFF(ri->timer); } else { tcb = XCALLOC(MTYPE_RFAPI_RECENT_DELETE, sizeof(struct rfapi_rib_tcb)); @@ -900,8 +900,8 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd, if (ri->timer) { struct rfapi_rib_tcb *tcb; - tcb = THREAD_ARG(ri->timer); - THREAD_OFF(ri->timer); + tcb = EVENT_ARG(ri->timer); + EVENT_OFF(ri->timer); XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb); } @@ -985,8 +985,8 @@ static void process_pending_node(struct bgp *bgp, struct rfapi_descriptor *rfd, if (ori->timer) { struct rfapi_rib_tcb *tcb; - tcb = THREAD_ARG(ori->timer); - THREAD_OFF(ori->timer); + tcb = EVENT_ARG(ori->timer); + EVENT_OFF(ori->timer); XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb); } @@ -1319,8 +1319,8 @@ callback: if (ri->timer) { struct rfapi_rib_tcb *tcb; - tcb = THREAD_ARG(ri->timer); - THREAD_OFF(ri->timer); + tcb = EVENT_ARG(ri->timer); + EVENT_OFF(ri->timer); XFREE(MTYPE_RFAPI_RECENT_DELETE, tcb); } RFAPI_RIB_CHECK_COUNTS(0, delete_list->count); diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c index e15c61e6d..7decb7578 100644 --- a/bgpd/rfapi/vnc_export_bgp.c +++ b/bgpd/rfapi/vnc_export_bgp.c @@ -1692,7 +1692,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi, * export expiration timer is already running on * this route: cancel it */ - THREAD_OFF(eti->timer); + EVENT_OFF(eti->timer); bgp_update(peer, prefix, /* prefix */ 0, /* addpath_id */ @@ -1706,7 +1706,7 @@ void vnc_direct_bgp_rh_add_route(struct bgp *bgp, afi_t afi, static void vncExportWithdrawTimer(struct event *t) { - struct vnc_export_info *eti = THREAD_ARG(t); + struct vnc_export_info *eti = EVENT_ARG(t); const struct prefix *p = agg_node_get_prefix(eti->node); /* @@ -1922,7 +1922,7 @@ void vnc_direct_bgp_rh_vpn_enable(struct bgp *bgp, afi_t afi) * already running on * this route: cancel it */ - THREAD_OFF(eti->timer); + EVENT_OFF(eti->timer); vnc_zlog_debug_verbose( "%s: calling bgp_update", @@ -1991,7 +1991,7 @@ void vnc_direct_bgp_rh_vpn_disable(struct bgp *bgp, afi_t afi) ZEBRA_ROUTE_VNC_DIRECT_RH, BGP_ROUTE_REDISTRIBUTE); if (eti) { - THREAD_OFF(eti->timer); + EVENT_OFF(eti->timer); vnc_eti_delete(eti); } diff --git a/eigrpd/eigrp_filter.c b/eigrpd/eigrp_filter.c index cfa4b22af..b56380f0e 100644 --- a/eigrpd/eigrp_filter.c +++ b/eigrpd/eigrp_filter.c @@ -246,7 +246,7 @@ void eigrp_distribute_timer_process(struct event *thread) { struct eigrp *eigrp; - eigrp = THREAD_ARG(thread); + eigrp = EVENT_ARG(thread); /* execute GR for whole process */ eigrp_update_send_process_GR(eigrp, EIGRP_GR_FILTER, NULL); @@ -267,7 +267,7 @@ void eigrp_distribute_timer_interface(struct event *thread) { struct eigrp_interface *ei; - ei = THREAD_ARG(thread); + ei = EVENT_ARG(thread); ei->t_distribute = NULL; /* execute GR for interface */ diff --git a/eigrpd/eigrp_hello.c b/eigrpd/eigrp_hello.c index 12de6d4a1..d8cc4a45e 100644 --- a/eigrpd/eigrp_hello.c +++ b/eigrpd/eigrp_hello.c @@ -70,7 +70,7 @@ void eigrp_hello_timer(struct event *thread) { struct eigrp_interface *ei; - ei = THREAD_ARG(thread); + ei = EVENT_ARG(thread); if (IS_DEBUG_EIGRP(0, TIMERS)) zlog_debug("Start Hello Timer (%s) Expire [%u]", IF_NAME(ei), diff --git a/eigrpd/eigrp_interface.c b/eigrpd/eigrp_interface.c index 297a312a6..e983f46cc 100644 --- a/eigrpd/eigrp_interface.c +++ b/eigrpd/eigrp_interface.c @@ -333,7 +333,7 @@ int eigrp_if_down(struct eigrp_interface *ei) return 0; /* Shutdown packet reception and sending */ - THREAD_OFF(ei->t_hello); + EVENT_OFF(ei->t_hello); eigrp_if_stream_unset(ei); diff --git a/eigrpd/eigrp_neighbor.c b/eigrpd/eigrp_neighbor.c index 05d1b12f1..667fb02ce 100644 --- a/eigrpd/eigrp_neighbor.c +++ b/eigrpd/eigrp_neighbor.c @@ -167,7 +167,7 @@ void eigrp_nbr_delete(struct eigrp_neighbor *nbr) event_cancel_event(master, nbr); eigrp_fifo_free(nbr->multicast_queue); eigrp_fifo_free(nbr->retrans_queue); - THREAD_OFF(nbr->t_holddown); + EVENT_OFF(nbr->t_holddown); if (nbr->ei) listnode_delete(nbr->ei->nbrs, nbr); @@ -176,7 +176,7 @@ void eigrp_nbr_delete(struct eigrp_neighbor *nbr) void holddown_timer_expired(struct event *thread) { - struct eigrp_neighbor *nbr = THREAD_ARG(thread); + struct eigrp_neighbor *nbr = EVENT_ARG(thread); struct eigrp *eigrp = nbr->ei->eigrp; zlog_info("Neighbor %pI4 (%s) is down: holding time expired", &nbr->src, @@ -210,7 +210,7 @@ void eigrp_nbr_state_set(struct eigrp_neighbor *nbr, uint8_t state) // hold time.. nbr->v_holddown = EIGRP_HOLD_INTERVAL_DEFAULT; - THREAD_OFF(nbr->t_holddown); + EVENT_OFF(nbr->t_holddown); /* out with the old */ if (nbr->multicast_queue) @@ -252,22 +252,22 @@ void eigrp_nbr_state_update(struct eigrp_neighbor *nbr) switch (nbr->state) { case EIGRP_NEIGHBOR_DOWN: { /*Start Hold Down Timer for neighbor*/ - // THREAD_OFF(nbr->t_holddown); - // THREAD_TIMER_ON(master, nbr->t_holddown, + // EVENT_OFF(nbr->t_holddown); + // EVENT_TIMER_ON(master, nbr->t_holddown, // holddown_timer_expired, // nbr, nbr->v_holddown); break; } case EIGRP_NEIGHBOR_PENDING: { /*Reset Hold Down Timer for neighbor*/ - THREAD_OFF(nbr->t_holddown); + EVENT_OFF(nbr->t_holddown); event_add_timer(master, holddown_timer_expired, nbr, nbr->v_holddown, &nbr->t_holddown); break; } case EIGRP_NEIGHBOR_UP: { /*Reset Hold Down Timer for neighbor*/ - THREAD_OFF(nbr->t_holddown); + EVENT_OFF(nbr->t_holddown); event_add_timer(master, holddown_timer_expired, nbr, nbr->v_holddown, &nbr->t_holddown); break; diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c index 51b68fb34..8c3e75228 100644 --- a/eigrpd/eigrp_packet.c +++ b/eigrpd/eigrp_packet.c @@ -307,7 +307,7 @@ int eigrp_check_sha256_digest(struct stream *s, void eigrp_write(struct event *thread) { - struct eigrp *eigrp = THREAD_ARG(thread); + struct eigrp *eigrp = EVENT_ARG(thread); struct eigrp_header *eigrph; struct eigrp_interface *ei; struct eigrp_packet *ep; @@ -474,7 +474,7 @@ void eigrp_read(struct event *thread) uint16_t length = 0; /* first of all get interface pointer. */ - eigrp = THREAD_ARG(thread); + eigrp = EVENT_ARG(thread); /* prepare for next packet. */ event_add_read(master, eigrp_read, eigrp, eigrp->fd, &eigrp->t_read); @@ -923,7 +923,7 @@ void eigrp_packet_free(struct eigrp_packet *ep) if (ep->s) stream_free(ep->s); - THREAD_OFF(ep->t_retrans_timer); + EVENT_OFF(ep->t_retrans_timer); XFREE(MTYPE_EIGRP_PACKET, ep); } @@ -973,7 +973,7 @@ static int eigrp_check_network_mask(struct eigrp_interface *ei, void eigrp_unack_packet_retrans(struct event *thread) { struct eigrp_neighbor *nbr; - nbr = (struct eigrp_neighbor *)THREAD_ARG(thread); + nbr = (struct eigrp_neighbor *)EVENT_ARG(thread); struct eigrp_packet *ep; ep = eigrp_fifo_next(nbr->retrans_queue); @@ -1009,7 +1009,7 @@ void eigrp_unack_packet_retrans(struct event *thread) void eigrp_unack_multicast_packet_retrans(struct event *thread) { struct eigrp_neighbor *nbr; - nbr = (struct eigrp_neighbor *)THREAD_ARG(thread); + nbr = (struct eigrp_neighbor *)EVENT_ARG(thread); struct eigrp_packet *ep; ep = eigrp_fifo_next(nbr->multicast_queue); diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c index 1a0729d32..fb39c6efd 100644 --- a/eigrpd/eigrp_update.c +++ b/eigrpd/eigrp_update.c @@ -900,7 +900,7 @@ void eigrp_update_send_GR_thread(struct event *thread) struct eigrp_neighbor *nbr; /* get argument from thread */ - nbr = THREAD_ARG(thread); + nbr = EVENT_ARG(thread); /* remove this thread pointer */ /* if there is packet waiting in queue, diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c index f94bcea73..58241b5f1 100644 --- a/eigrpd/eigrpd.c +++ b/eigrpd/eigrpd.c @@ -260,8 +260,8 @@ void eigrp_finish_final(struct eigrp *eigrp) eigrp_if_free(ei, INTERFACE_DOWN_BY_FINAL); } - THREAD_OFF(eigrp->t_write); - THREAD_OFF(eigrp->t_read); + EVENT_OFF(eigrp->t_write); + EVENT_OFF(eigrp->t_read); close(eigrp->fd); list_delete(&eigrp->eiflist); diff --git a/isisd/fabricd.c b/isisd/fabricd.c index 52fd8df00..4fd39498a 100644 --- a/isisd/fabricd.c +++ b/isisd/fabricd.c @@ -225,11 +225,11 @@ struct fabricd *fabricd_new(struct isis_area *area) void fabricd_finish(struct fabricd *f) { - THREAD_OFF(f->initial_sync_timeout); + EVENT_OFF(f->initial_sync_timeout); - THREAD_OFF(f->tier_calculation_timer); + EVENT_OFF(f->tier_calculation_timer); - THREAD_OFF(f->tier_set_timer); + EVENT_OFF(f->tier_set_timer); isis_spftree_del(f->spftree); neighbor_lists_clear(f); @@ -239,7 +239,7 @@ void fabricd_finish(struct fabricd *f) static void fabricd_initial_sync_timeout(struct event *thread) { - struct fabricd *f = THREAD_ARG(thread); + struct fabricd *f = EVENT_ARG(thread); if (IS_DEBUG_ADJ_PACKETS) zlog_debug( @@ -325,7 +325,7 @@ void fabricd_initial_sync_finish(struct isis_area *area) f->initial_sync_circuit->interface->name); f->initial_sync_state = FABRICD_SYNC_COMPLETE; f->initial_sync_circuit = NULL; - THREAD_OFF(f->initial_sync_timeout); + EVENT_OFF(f->initial_sync_timeout); } static void fabricd_bump_tier_calculation_timer(struct fabricd *f); @@ -391,14 +391,14 @@ static uint8_t fabricd_calculate_fabric_tier(struct isis_area *area) static void fabricd_tier_set_timer(struct event *thread) { - struct fabricd *f = THREAD_ARG(thread); + struct fabricd *f = EVENT_ARG(thread); fabricd_set_tier(f, f->tier_pending); } static void fabricd_tier_calculation_cb(struct event *thread) { - struct fabricd *f = THREAD_ARG(thread); + struct fabricd *f = EVENT_ARG(thread); uint8_t tier = ISIS_TIER_UNDEFINED; tier = fabricd_calculate_fabric_tier(f->area); @@ -417,14 +417,14 @@ static void fabricd_bump_tier_calculation_timer(struct fabricd *f) { /* Cancel timer if we already know our tier */ if (f->tier != ISIS_TIER_UNDEFINED || f->tier_set_timer) { - THREAD_OFF(f->tier_calculation_timer); + EVENT_OFF(f->tier_calculation_timer); return; } /* If we need to calculate the tier, wait some * time for the topology to settle before running * the calculation */ - THREAD_OFF(f->tier_calculation_timer); + EVENT_OFF(f->tier_calculation_timer); event_add_timer(master, fabricd_tier_calculation_cb, f, 2 * f->area->lsp_gen_interval[ISIS_LEVEL2 - 1], @@ -709,7 +709,7 @@ void fabricd_trigger_csnp(struct isis_area *area, bool circuit_scoped) if (!circuit->t_send_csnp[1]) continue; - THREAD_OFF(circuit->t_send_csnp[ISIS_LEVEL2 - 1]); + EVENT_OFF(circuit->t_send_csnp[ISIS_LEVEL2 - 1]); event_add_timer_msec(master, send_l2_csnp, circuit, isis_jitter(f->csnp_delay, CSNP_JITTER), &circuit->t_send_csnp[ISIS_LEVEL2 - 1]); diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index 4443f346d..c7c958292 100644 --- a/isisd/isis_adjacency.c +++ b/isisd/isis_adjacency.c @@ -148,7 +148,7 @@ void isis_delete_adj(void *arg) /* Remove self from snmp list without walking the list*/ list_delete_node(adj->circuit->snmp_adj_list, adj->snmp_list_node); - THREAD_OFF(adj->t_expire); + EVENT_OFF(adj->t_expire); if (adj->adj_state != ISIS_ADJ_DOWN) adj->adj_state = ISIS_ADJ_DOWN; @@ -485,7 +485,7 @@ void isis_adj_expire(struct event *thread) /* * Get the adjacency */ - adj = THREAD_ARG(thread); + adj = EVENT_ARG(thread); assert(adj); adj->t_expire = NULL; diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 2a33d1021..8d6239074 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -863,12 +863,12 @@ void isis_circuit_down(struct isis_circuit *circuit) memset(circuit->u.bc.l2_desig_is, 0, ISIS_SYS_ID_LEN + 1); memset(circuit->u.bc.snpa, 0, ETH_ALEN); - THREAD_OFF(circuit->u.bc.t_send_lan_hello[0]); - THREAD_OFF(circuit->u.bc.t_send_lan_hello[1]); - THREAD_OFF(circuit->u.bc.t_run_dr[0]); - THREAD_OFF(circuit->u.bc.t_run_dr[1]); - THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[0]); - THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[1]); + EVENT_OFF(circuit->u.bc.t_send_lan_hello[0]); + EVENT_OFF(circuit->u.bc.t_send_lan_hello[1]); + EVENT_OFF(circuit->u.bc.t_run_dr[0]); + EVENT_OFF(circuit->u.bc.t_run_dr[1]); + EVENT_OFF(circuit->u.bc.t_refresh_pseudo_lsp[0]); + EVENT_OFF(circuit->u.bc.t_refresh_pseudo_lsp[1]); circuit->lsp_regenerate_pending[0] = 0; circuit->lsp_regenerate_pending[1] = 0; @@ -878,7 +878,7 @@ void isis_circuit_down(struct isis_circuit *circuit) } else if (circuit->circ_type == CIRCUIT_T_P2P) { isis_delete_adj(circuit->u.p2p.neighbor); circuit->u.p2p.neighbor = NULL; - THREAD_OFF(circuit->u.p2p.t_send_p2p_hello); + EVENT_OFF(circuit->u.p2p.t_send_p2p_hello); } /* @@ -891,11 +891,11 @@ void isis_circuit_down(struct isis_circuit *circuit) circuit->snmp_adj_idx_gen = 0; /* Cancel all active threads */ - THREAD_OFF(circuit->t_send_csnp[0]); - THREAD_OFF(circuit->t_send_csnp[1]); - THREAD_OFF(circuit->t_send_psnp[0]); - THREAD_OFF(circuit->t_send_psnp[1]); - THREAD_OFF(circuit->t_read); + EVENT_OFF(circuit->t_send_csnp[0]); + EVENT_OFF(circuit->t_send_csnp[1]); + EVENT_OFF(circuit->t_send_psnp[0]); + EVENT_OFF(circuit->t_send_psnp[1]); + EVENT_OFF(circuit->t_read); if (circuit->tx_queue) { isis_tx_queue_free(circuit->tx_queue); diff --git a/isisd/isis_dr.c b/isisd/isis_dr.c index 9a10a61b2..3bc188273 100644 --- a/isisd/isis_dr.c +++ b/isisd/isis_dr.c @@ -50,7 +50,7 @@ const char *isis_disflag2string(int disflag) void isis_run_dr(struct event *thread) { - struct isis_circuit_arg *arg = THREAD_ARG(thread); + struct isis_circuit_arg *arg = EVENT_ARG(thread); assert(arg); @@ -211,8 +211,8 @@ int isis_dr_resign(struct isis_circuit *circuit, int level) circuit->u.bc.is_dr[level - 1] = 0; circuit->u.bc.run_dr_elect[level - 1] = 0; - THREAD_OFF(circuit->u.bc.t_run_dr[level - 1]); - THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); + EVENT_OFF(circuit->u.bc.t_run_dr[level - 1]); + EVENT_OFF(circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); circuit->lsp_regenerate_pending[level - 1] = 0; memcpy(id, circuit->isis->sysid, ISIS_SYS_ID_LEN); @@ -236,7 +236,7 @@ int isis_dr_resign(struct isis_circuit *circuit, int level) &circuit->t_send_psnp[1]); } - THREAD_OFF(circuit->t_send_csnp[level - 1]); + EVENT_OFF(circuit->t_send_csnp[level - 1]); event_add_timer(master, isis_run_dr, &circuit->level_arg[level - 1], 2 * circuit->hello_interval[level - 1], diff --git a/isisd/isis_dynhn.c b/isisd/isis_dynhn.c index e17141931..469f332be 100644 --- a/isisd/isis_dynhn.c +++ b/isisd/isis_dynhn.c @@ -44,7 +44,7 @@ void dyn_cache_finish(struct isis *isis) struct listnode *node, *nnode; struct isis_dynhn *dyn; - THREAD_OFF(isis->t_dync_clean); + EVENT_OFF(isis->t_dync_clean); for (ALL_LIST_ELEMENTS(isis->dyn_cache, node, nnode, dyn)) { list_delete_node(isis->dyn_cache, node); @@ -61,7 +61,7 @@ static void dyn_cache_cleanup(struct event *thread) time_t now = time(NULL); struct isis *isis = NULL; - isis = THREAD_ARG(thread); + isis = EVENT_ARG(thread); isis->t_dync_clean = NULL; diff --git a/isisd/isis_events.c b/isisd/isis_events.c index 4610bb2c9..708a2747f 100644 --- a/isisd/isis_events.c +++ b/isisd/isis_events.c @@ -96,13 +96,13 @@ static void circuit_resign_level(struct isis_circuit *circuit, int level) circuit->area->area_tag, circuit->circuit_id, circuit->interface->name, level); - THREAD_OFF(circuit->t_send_csnp[idx]); - THREAD_OFF(circuit->t_send_psnp[idx]); + EVENT_OFF(circuit->t_send_csnp[idx]); + EVENT_OFF(circuit->t_send_psnp[idx]); if (circuit->circ_type == CIRCUIT_T_BROADCAST) { - THREAD_OFF(circuit->u.bc.t_send_lan_hello[idx]); - THREAD_OFF(circuit->u.bc.t_run_dr[idx]); - THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[idx]); + EVENT_OFF(circuit->u.bc.t_send_lan_hello[idx]); + EVENT_OFF(circuit->u.bc.t_run_dr[idx]); + EVENT_OFF(circuit->u.bc.t_refresh_pseudo_lsp[idx]); circuit->lsp_regenerate_pending[idx] = 0; circuit->u.bc.run_dr_elect[idx] = 0; circuit->u.bc.is_dr[idx] = 0; @@ -200,7 +200,7 @@ void isis_event_dis_status_change(struct event *thread) { struct isis_circuit *circuit; - circuit = THREAD_ARG(thread); + circuit = EVENT_ARG(thread); /* invalid arguments */ if (!circuit || !circuit->area) diff --git a/isisd/isis_ldp_sync.c b/isisd/isis_ldp_sync.c index 6c9292ffc..59596e1af 100644 --- a/isisd/isis_ldp_sync.c +++ b/isisd/isis_ldp_sync.c @@ -171,7 +171,7 @@ void isis_ldp_sync_if_complete(struct isis_circuit *circuit) if (ldp_sync_info->state == LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP) ldp_sync_info->state = LDP_IGP_SYNC_STATE_REQUIRED_UP; - THREAD_OFF(ldp_sync_info->t_holddown); + EVENT_OFF(ldp_sync_info->t_holddown); isis_ldp_sync_set_if_metric(circuit, true); } @@ -191,7 +191,7 @@ void isis_ldp_sync_ldp_fail(struct isis_circuit *circuit) if (ldp_sync_info && ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED && ldp_sync_info->state != LDP_IGP_SYNC_STATE_NOT_REQUIRED) { - THREAD_OFF(ldp_sync_info->t_holddown); + EVENT_OFF(ldp_sync_info->t_holddown); ldp_sync_info->state = LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP; isis_ldp_sync_set_if_metric(circuit, true); } @@ -340,7 +340,7 @@ static void isis_ldp_sync_holddown_timer(struct event *thread) * didn't receive msg from LDP indicating sync-complete * restore interface cost to original value */ - circuit = THREAD_ARG(thread); + circuit = EVENT_ARG(thread); if (circuit->ldp_sync_info == NULL) return; @@ -516,7 +516,7 @@ void isis_if_ldp_sync_disable(struct isis_circuit *circuit) if (!CHECK_FLAG(area->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) return; - THREAD_OFF(ldp_sync_info->t_holddown); + EVENT_OFF(ldp_sync_info->t_holddown); ldp_sync_info->state = LDP_IGP_SYNC_STATE_NOT_REQUIRED; isis_ldp_sync_set_if_metric(circuit, true); } diff --git a/isisd/isis_lfa.c b/isisd/isis_lfa.c index 323a25c26..7a25a9253 100644 --- a/isisd/isis_lfa.c +++ b/isisd/isis_lfa.c @@ -1390,7 +1390,7 @@ static struct rlfa *rlfa_lookup(struct isis_spftree *spftree, static void isis_area_verify_routes_cb(struct event *thread) { - struct isis_area *area = THREAD_ARG(thread); + struct isis_area *area = EVENT_ARG(thread); if (IS_DEBUG_LFA) zlog_debug("ISIS-LFA: updating RLFAs in the RIB"); @@ -1506,7 +1506,7 @@ int isis_rlfa_activate(struct isis_spftree *spftree, struct rlfa *rlfa, spftree->route_table_backup); spftree->lfa.protection_counters.rlfa[vertex->N.ip.priority] += 1; - THREAD_OFF(area->t_rlfa_rib_update); + EVENT_OFF(area->t_rlfa_rib_update); event_add_timer(master, isis_area_verify_routes_cb, area, 2, &area->t_rlfa_rib_update); @@ -1525,7 +1525,7 @@ void isis_rlfa_deactivate(struct isis_spftree *spftree, struct rlfa *rlfa) isis_route_delete(area, rn, spftree->route_table_backup); spftree->lfa.protection_counters.rlfa[vertex->N.ip.priority] -= 1; - THREAD_OFF(area->t_rlfa_rib_update); + EVENT_OFF(area->t_rlfa_rib_update); event_add_timer(master, isis_area_verify_routes_cb, area, 2, &area->t_rlfa_rib_update); } diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 1635d66c3..32540b0fa 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -431,7 +431,7 @@ bool isis_level2_adj_up(struct isis_area *area) */ void set_overload_on_start_timer(struct event *thread) { - struct isis_area *area = THREAD_ARG(thread); + struct isis_area *area = EVENT_ARG(thread); assert(area); area->t_overload_on_startup_timer = NULL; @@ -1418,7 +1418,7 @@ int lsp_generate(struct isis_area *area, int level) refresh_time = lsp_refresh_time(newlsp, rem_lifetime); - THREAD_OFF(area->t_lsp_refresh[level - 1]); + EVENT_OFF(area->t_lsp_refresh[level - 1]); area->lsp_regenerate_pending[level - 1] = 0; event_add_timer(master, lsp_refresh, &area->lsp_refresh_arg[level - 1], refresh_time, &area->t_lsp_refresh[level - 1]); @@ -1523,7 +1523,7 @@ static int lsp_regenerate(struct isis_area *area, int level) */ static void lsp_refresh(struct event *thread) { - struct lsp_refresh_arg *arg = THREAD_ARG(thread); + struct lsp_refresh_arg *arg = EVENT_ARG(thread); assert(arg); @@ -1627,7 +1627,7 @@ int _lsp_regenerate_schedule(struct isis_area *area, int level, "ISIS (%s): Will schedule regen timer. Last run was: %lld, Now is: %lld", area->area_tag, (long long)lsp->last_generated, (long long)now); - THREAD_OFF(area->t_lsp_refresh[lvl - 1]); + EVENT_OFF(area->t_lsp_refresh[lvl - 1]); diff = now - lsp->last_generated; if (diff < area->lsp_gen_interval[lvl - 1] && !(area->bfd_signalled_down)) { @@ -1819,7 +1819,7 @@ int lsp_generate_pseudo(struct isis_circuit *circuit, int level) lsp_flood(lsp, NULL); refresh_time = lsp_refresh_time(lsp, rem_lifetime); - THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); + EVENT_OFF(circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); circuit->lsp_regenerate_pending[level - 1] = 0; if (level == IS_LEVEL_1) event_add_timer(master, lsp_l1_refresh_pseudo, circuit, @@ -1905,7 +1905,7 @@ static void lsp_l1_refresh_pseudo(struct event *thread) struct isis_circuit *circuit; uint8_t id[ISIS_SYS_ID_LEN + 2]; - circuit = THREAD_ARG(thread); + circuit = EVENT_ARG(thread); circuit->u.bc.t_refresh_pseudo_lsp[0] = NULL; circuit->lsp_regenerate_pending[0] = 0; @@ -1927,7 +1927,7 @@ static void lsp_l2_refresh_pseudo(struct event *thread) struct isis_circuit *circuit; uint8_t id[ISIS_SYS_ID_LEN + 2]; - circuit = THREAD_ARG(thread); + circuit = EVENT_ARG(thread); circuit->u.bc.t_refresh_pseudo_lsp[1] = NULL; circuit->lsp_regenerate_pending[1] = 0; @@ -2010,7 +2010,7 @@ int lsp_regenerate_schedule_pseudo(struct isis_circuit *circuit, int level) "ISIS (%s): Will schedule PSN regen timer. Last run was: %lld, Now is: %lld", area->area_tag, (long long)lsp->last_generated, (long long)now); - THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[lvl - 1]); + EVENT_OFF(circuit->u.bc.t_refresh_pseudo_lsp[lvl - 1]); diff = now - lsp->last_generated; if (diff < circuit->area->lsp_gen_interval[lvl - 1]) { timeout = @@ -2054,7 +2054,7 @@ void lsp_tick(struct event *thread) uint16_t rem_lifetime; bool fabricd_sync_incomplete = false; - area = THREAD_ARG(thread); + area = EVENT_ARG(thread); assert(area); area->t_tick = NULL; event_add_timer(master, lsp_tick, area, 1, &area->t_tick); diff --git a/isisd/isis_main.c b/isisd/isis_main.c index 7b5d47235..0e8780c47 100644 --- a/isisd/isis_main.c +++ b/isisd/isis_main.c @@ -185,7 +185,7 @@ static void isis_config_start(void) { /* Max wait time for config to load before generating lsp */ #define ISIS_PRE_CONFIG_MAX_WAIT_SECONDS 600 - THREAD_OFF(t_isis_cfg); + EVENT_OFF(t_isis_cfg); event_add_timer(im->master, isis_config_finish, NULL, ISIS_PRE_CONFIG_MAX_WAIT_SECONDS, &t_isis_cfg); } @@ -198,7 +198,7 @@ static void isis_config_end(void) if (!event_is_scheduled(t_isis_cfg)) return; - THREAD_OFF(t_isis_cfg); + EVENT_OFF(t_isis_cfg); isis_config_finish(t_isis_cfg); } diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 00ee7f8eb..a5d5679c0 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -192,7 +192,7 @@ static int process_p2p_hello(struct iih_info *iih) adj); /* lets take care of the expiry */ - THREAD_OFF(adj->t_expire); + EVENT_OFF(adj->t_expire); event_add_timer(master, isis_adj_expire, adj, (long)adj->hold_time, &adj->t_expire); @@ -484,7 +484,7 @@ static int process_lan_hello(struct iih_info *iih) adj); /* lets take care of the expiry */ - THREAD_OFF(adj->t_expire); + EVENT_OFF(adj->t_expire); event_add_timer(master, isis_adj_expire, adj, (long)adj->hold_time, &adj->t_expire); @@ -1788,7 +1788,7 @@ void isis_receive(struct event *thread) /* * Get the circuit */ - circuit = THREAD_ARG(thread); + circuit = EVENT_ARG(thread); assert(circuit); circuit->t_read = NULL; @@ -2011,7 +2011,7 @@ int send_hello(struct isis_circuit *circuit, int level) static void send_hello_cb(struct event *thread) { - struct isis_circuit_arg *arg = THREAD_ARG(thread); + struct isis_circuit_arg *arg = EVENT_ARG(thread); assert(arg); struct isis_circuit *circuit = arg->circuit; @@ -2056,7 +2056,7 @@ static void _send_hello_sched(struct isis_circuit *circuit, if (event_timer_remain_msec(*threadp) < (unsigned long)delay) return; - THREAD_OFF(*threadp); + EVENT_OFF(*threadp); } event_add_timer_msec(master, send_hello_cb, @@ -2242,7 +2242,7 @@ void send_l1_csnp(struct event *thread) { struct isis_circuit *circuit; - circuit = THREAD_ARG(thread); + circuit = EVENT_ARG(thread); assert(circuit); circuit->t_send_csnp[0] = NULL; @@ -2262,7 +2262,7 @@ void send_l2_csnp(struct event *thread) { struct isis_circuit *circuit; - circuit = THREAD_ARG(thread); + circuit = EVENT_ARG(thread); assert(circuit); circuit->t_send_csnp[1] = NULL; @@ -2397,7 +2397,7 @@ void send_l1_psnp(struct event *thread) struct isis_circuit *circuit; - circuit = THREAD_ARG(thread); + circuit = EVENT_ARG(thread); assert(circuit); circuit->t_send_psnp[0] = NULL; @@ -2417,7 +2417,7 @@ void send_l2_psnp(struct event *thread) { struct isis_circuit *circuit; - circuit = THREAD_ARG(thread); + circuit = EVENT_ARG(thread); assert(circuit); circuit->t_send_psnp[1] = NULL; diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index aabf79024..f63b00006 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -1855,7 +1855,7 @@ void isis_spf_switchover_routes(struct isis_area *area, static void isis_run_spf_cb(struct event *thread) { - struct isis_spf_run *run = THREAD_ARG(thread); + struct isis_spf_run *run = EVENT_ARG(thread); struct isis_area *area = run->area; int level = run->level; int have_run = 0; @@ -1950,7 +1950,7 @@ int _isis_spf_schedule(struct isis_area *area, int level, area->area_tag, level, diff, func, file, line); } - THREAD_OFF(area->t_rlfa_rib_update); + EVENT_OFF(area->t_rlfa_rib_update); if (area->spf_delay_ietf[level - 1]) { /* Need to call schedule function also if spf delay is running * to diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c index 791d221cf..cb330603e 100644 --- a/isisd/isis_sr.c +++ b/isisd/isis_sr.c @@ -1085,7 +1085,7 @@ static void sr_start_label_manager(struct event *start) { struct isis_area *area; - area = THREAD_ARG(start); + area = EVENT_ARG(start); /* re-attempt to start SR & Label Manager connection */ isis_sr_start(area); @@ -1168,7 +1168,7 @@ void isis_sr_stop(struct isis_area *area) area->area_tag); /* Disable any re-attempt to connect to Label Manager */ - THREAD_OFF(srdb->t_start_lm); + EVENT_OFF(srdb->t_start_lm); /* Uninstall all local Adjacency-SIDs. */ for (ALL_LIST_ELEMENTS(area->srdb.adj_sids, node, nnode, sra)) diff --git a/isisd/isis_tx_queue.c b/isisd/isis_tx_queue.c index e0c5e164f..ec2d50d60 100644 --- a/isisd/isis_tx_queue.c +++ b/isisd/isis_tx_queue.c @@ -79,7 +79,7 @@ static void tx_queue_element_free(void *element) { struct isis_tx_queue_entry *e = element; - THREAD_OFF(e->retry); + EVENT_OFF(e->retry); XFREE(MTYPE_TX_QUEUE_ENTRY, e); } @@ -102,7 +102,7 @@ static struct isis_tx_queue_entry *tx_queue_find(struct isis_tx_queue *queue, static void tx_queue_send_event(struct event *thread) { - struct isis_tx_queue_entry *e = THREAD_ARG(thread); + struct isis_tx_queue_entry *e = EVENT_ARG(thread); struct isis_tx_queue *queue = e->queue; event_add_timer(master, tx_queue_send_event, e, 5, &e->retry); @@ -147,7 +147,7 @@ void _isis_tx_queue_add(struct isis_tx_queue *queue, e->type = type; - THREAD_OFF(e->retry); + EVENT_OFF(e->retry); event_add_event(master, tx_queue_send_event, e, 0, &e->retry); e->is_retry = false; @@ -170,7 +170,7 @@ void _isis_tx_queue_del(struct isis_tx_queue *queue, struct isis_lsp *lsp, func, file, line); } - THREAD_OFF(e->retry); + EVENT_OFF(e->retry); hash_release(queue->hash, e); XFREE(MTYPE_TX_QUEUE_ENTRY, e); diff --git a/isisd/isisd.c b/isisd/isisd.c index 267c31670..40f64089c 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -519,11 +519,11 @@ void isis_area_destroy(struct isis_area *area) spftree_area_del(area); if (area->spf_timer[0]) - isis_spf_timer_free(THREAD_ARG(area->spf_timer[0])); - THREAD_OFF(area->spf_timer[0]); + isis_spf_timer_free(EVENT_ARG(area->spf_timer[0])); + EVENT_OFF(area->spf_timer[0]); if (area->spf_timer[1]) - isis_spf_timer_free(THREAD_ARG(area->spf_timer[1])); - THREAD_OFF(area->spf_timer[1]); + isis_spf_timer_free(EVENT_ARG(area->spf_timer[1])); + EVENT_OFF(area->spf_timer[1]); spf_backoff_free(area->spf_delay_ietf[0]); spf_backoff_free(area->spf_delay_ietf[1]); @@ -543,10 +543,10 @@ void isis_area_destroy(struct isis_area *area) isis_lfa_tiebreakers_clear(area, ISIS_LEVEL1); isis_lfa_tiebreakers_clear(area, ISIS_LEVEL2); - THREAD_OFF(area->t_tick); - THREAD_OFF(area->t_lsp_refresh[0]); - THREAD_OFF(area->t_lsp_refresh[1]); - THREAD_OFF(area->t_rlfa_rib_update); + EVENT_OFF(area->t_tick); + EVENT_OFF(area->t_lsp_refresh[0]); + EVENT_OFF(area->t_lsp_refresh[1]); + EVENT_OFF(area->t_rlfa_rib_update); event_cancel_event(master, area); @@ -3119,14 +3119,14 @@ static void area_resign_level(struct isis_area *area, int level) } if (area->spf_timer[level - 1]) - isis_spf_timer_free(THREAD_ARG(area->spf_timer[level - 1])); + isis_spf_timer_free(EVENT_ARG(area->spf_timer[level - 1])); - THREAD_OFF(area->spf_timer[level - 1]); + EVENT_OFF(area->spf_timer[level - 1]); sched_debug( "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.", area->area_tag, level); - THREAD_OFF(area->t_lsp_refresh[level - 1]); + EVENT_OFF(area->t_lsp_refresh[level - 1]); area->lsp_regenerate_pending[level - 1] = 0; } @@ -3215,7 +3215,7 @@ void isis_area_overload_bit_set(struct isis_area *area, bool overload_bit) } else { /* Cancel overload on startup timer if it's running */ if (area->t_overload_on_startup_timer) { - THREAD_OFF(area->t_overload_on_startup_timer); + EVENT_OFF(area->t_overload_on_startup_timer); area->t_overload_on_startup_timer = NULL; } } diff --git a/ldpd/accept.c b/ldpd/accept.c index 2088ce977..8e881e78a 100644 --- a/ldpd/accept.c +++ b/ldpd/accept.c @@ -61,7 +61,7 @@ accept_del(int fd) LIST_FOREACH(av, &accept_queue.queue, entry) if (av->fd == fd) { log_debug("%s: %d removed from queue", __func__, fd); - THREAD_OFF(av->ev); + EVENT_OFF(av->ev); LIST_REMOVE(av, entry); free(av); return; @@ -81,7 +81,7 @@ accept_unpause(void) { if (accept_queue.evt != NULL) { log_debug(__func__); - THREAD_OFF(accept_queue.evt); + EVENT_OFF(accept_queue.evt); accept_arm(); } } @@ -100,12 +100,12 @@ accept_unarm(void) { struct accept_ev *av; LIST_FOREACH(av, &accept_queue.queue, entry) - THREAD_OFF(av->ev); + EVENT_OFF(av->ev); } static void accept_cb(struct event *thread) { - struct accept_ev *av = THREAD_ARG(thread); + struct accept_ev *av = EVENT_ARG(thread); event_add_read(master, accept_cb, av, av->fd, &av->ev); av->accept_cb(thread); } diff --git a/ldpd/adjacency.c b/ldpd/adjacency.c index 794bc66ce..0108af804 100644 --- a/ldpd/adjacency.c +++ b/ldpd/adjacency.c @@ -163,7 +163,7 @@ adj_get_af(const struct adj *adj) /* ARGSUSED */ static void adj_itimer(struct event *thread) { - struct adj *adj = THREAD_ARG(thread); + struct adj *adj = EVENT_ARG(thread); adj->inactivity_timer = NULL; @@ -185,7 +185,7 @@ static void adj_itimer(struct event *thread) void adj_start_itimer(struct adj *adj) { - THREAD_OFF(adj->inactivity_timer); + EVENT_OFF(adj->inactivity_timer); adj->inactivity_timer = NULL; event_add_timer(master, adj_itimer, adj, adj->holdtime, &adj->inactivity_timer); @@ -194,7 +194,7 @@ adj_start_itimer(struct adj *adj) void adj_stop_itimer(struct adj *adj) { - THREAD_OFF(adj->inactivity_timer); + EVENT_OFF(adj->inactivity_timer); } /* targeted neighbors */ @@ -333,7 +333,7 @@ tnbr_get_hello_interval(struct tnbr *tnbr) /* ARGSUSED */ static void tnbr_hello_timer(struct event *thread) { - struct tnbr *tnbr = THREAD_ARG(thread); + struct tnbr *tnbr = EVENT_ARG(thread); tnbr->hello_timer = NULL; send_hello(HELLO_TARGETED, NULL, tnbr); @@ -343,7 +343,7 @@ static void tnbr_hello_timer(struct event *thread) static void tnbr_start_hello_timer(struct tnbr *tnbr) { - THREAD_OFF(tnbr->hello_timer); + EVENT_OFF(tnbr->hello_timer); tnbr->hello_timer = NULL; event_add_timer(master, tnbr_hello_timer, tnbr, tnbr_get_hello_interval(tnbr), &tnbr->hello_timer); @@ -352,7 +352,7 @@ tnbr_start_hello_timer(struct tnbr *tnbr) static void tnbr_stop_hello_timer(struct tnbr *tnbr) { - THREAD_OFF(tnbr->hello_timer); + EVENT_OFF(tnbr->hello_timer); } struct ctl_adj * diff --git a/ldpd/control.c b/ldpd/control.c index ade50edd4..6bb5204d1 100644 --- a/ldpd/control.c +++ b/ldpd/control.c @@ -98,8 +98,8 @@ static void control_accept(struct event *thread) struct ctl_conn *c; len = sizeof(s_un); - if ((connfd = accept(THREAD_FD(thread), (struct sockaddr *)&s_un, - &len)) == -1) { + if ((connfd = accept(EVENT_FD(thread), (struct sockaddr *)&s_un, + &len)) == -1) { /* * Pause accept if we are out of file descriptors, or * libevent will haunt us here too. @@ -169,8 +169,8 @@ control_close(int fd) msgbuf_clear(&c->iev.ibuf.w); TAILQ_REMOVE(&ctl_conns, c, entry); - THREAD_OFF(c->iev.ev_read); - THREAD_OFF(c->iev.ev_write); + EVENT_OFF(c->iev.ev_read); + EVENT_OFF(c->iev.ev_write); close(c->iev.ibuf.fd); accept_unpause(); free(c); @@ -179,7 +179,7 @@ control_close(int fd) /* ARGSUSED */ static void control_dispatch_imsg(struct event *thread) { - int fd = THREAD_FD(thread); + int fd = EVENT_FD(thread); struct ctl_conn *c; struct imsg imsg; ssize_t n; diff --git a/ldpd/interface.c b/ldpd/interface.c index 32a23bf0b..ad5d853b6 100644 --- a/ldpd/interface.c +++ b/ldpd/interface.c @@ -446,7 +446,7 @@ if_get_wait_for_sync_interval(void) /* ARGSUSED */ static void if_hello_timer(struct event *thread) { - struct iface_af *ia = THREAD_ARG(thread); + struct iface_af *ia = EVENT_ARG(thread); ia->hello_timer = NULL; send_hello(HELLO_LINK, ia, NULL); @@ -456,7 +456,7 @@ static void if_hello_timer(struct event *thread) static void if_start_hello_timer(struct iface_af *ia) { - THREAD_OFF(ia->hello_timer); + EVENT_OFF(ia->hello_timer); event_add_timer(master, if_hello_timer, ia, if_get_hello_interval(ia), &ia->hello_timer); } @@ -464,7 +464,7 @@ if_start_hello_timer(struct iface_af *ia) static void if_stop_hello_timer(struct iface_af *ia) { - THREAD_OFF(ia->hello_timer); + EVENT_OFF(ia->hello_timer); } struct ctl_iface * @@ -722,7 +722,7 @@ ldp_sync_act_iface_start_sync(struct iface *iface) static void iface_wait_for_ldp_sync_timer(struct event *thread) { - struct iface *iface = THREAD_ARG(thread); + struct iface *iface = EVENT_ARG(thread); ldp_sync_fsm(iface, LDP_SYNC_EVT_LDP_SYNC_COMPLETE); } @@ -732,7 +732,7 @@ static void start_wait_for_ldp_sync_timer(struct iface *iface) if (iface->ldp_sync.wait_for_sync_timer) return; - THREAD_OFF(iface->ldp_sync.wait_for_sync_timer); + EVENT_OFF(iface->ldp_sync.wait_for_sync_timer); event_add_timer(master, iface_wait_for_ldp_sync_timer, iface, if_get_wait_for_sync_interval(), &iface->ldp_sync.wait_for_sync_timer); @@ -740,7 +740,7 @@ static void start_wait_for_ldp_sync_timer(struct iface *iface) static void stop_wait_for_ldp_sync_timer(struct iface *iface) { - THREAD_OFF(iface->ldp_sync.wait_for_sync_timer); + EVENT_OFF(iface->ldp_sync.wait_for_sync_timer); } static int diff --git a/ldpd/lde.c b/ldpd/lde.c index 78205794b..806bab6a2 100644 --- a/ldpd/lde.c +++ b/ldpd/lde.c @@ -234,7 +234,7 @@ lde_imsg_compose_ldpe(int type, uint32_t peerid, pid_t pid, void *data, /* ARGSUSED */ static void lde_dispatch_imsg(struct event *thread) { - struct imsgev *iev = THREAD_ARG(thread); + struct imsgev *iev = EVENT_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; struct imsg imsg; struct lde_nbr *ln; @@ -395,8 +395,8 @@ static void lde_dispatch_imsg(struct event *thread) imsg_event_add(iev); else { /* this pipe is dead, so remove the event handlers and exit */ - THREAD_OFF(iev->ev_read); - THREAD_OFF(iev->ev_write); + EVENT_OFF(iev->ev_read); + EVENT_OFF(iev->ev_write); lde_shutdown(); } } @@ -415,7 +415,7 @@ static void lde_dispatch_parent(struct event *thread) struct kif *kif; struct kroute *kr; int fd; - struct imsgev *iev = THREAD_ARG(thread); + struct imsgev *iev = EVENT_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; ssize_t n; int shut = 0; @@ -673,8 +673,8 @@ static void lde_dispatch_parent(struct event *thread) imsg_event_add(iev); else { /* this pipe is dead, so remove the event handlers and exit */ - THREAD_OFF(iev->ev_read); - THREAD_OFF(iev->ev_write); + EVENT_OFF(iev->ev_read); + EVENT_OFF(iev->ev_write); lde_shutdown(); } } diff --git a/ldpd/lde_lib.c b/ldpd/lde_lib.c index 721a1c11e..470580ff5 100644 --- a/ldpd/lde_lib.c +++ b/ldpd/lde_lib.c @@ -1057,12 +1057,12 @@ void lde_gc_timer(struct event *thread) void lde_gc_start_timer(void) { - THREAD_OFF(gc_timer); + EVENT_OFF(gc_timer); event_add_timer(master, lde_gc_timer, NULL, LDE_GC_INTERVAL, &gc_timer); } void lde_gc_stop_timer(void) { - THREAD_OFF(gc_timer); + EVENT_OFF(gc_timer); } diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index 30c0472d9..8d173c608 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -559,7 +559,7 @@ start_child(enum ldpd_process p, char *argv0, int fd_async, int fd_sync) /* ARGSUSED */ static void main_dispatch_ldpe(struct event *thread) { - struct imsgev *iev = THREAD_ARG(thread); + struct imsgev *iev = EVENT_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; struct imsg imsg; int af; @@ -613,8 +613,8 @@ static void main_dispatch_ldpe(struct event *thread) imsg_event_add(iev); else { /* this pipe is dead, so remove the event handlers and exit */ - THREAD_OFF(iev->ev_read); - THREAD_OFF(iev->ev_write); + EVENT_OFF(iev->ev_read); + EVENT_OFF(iev->ev_write); ldpe_pid = 0; if (lde_pid == 0) @@ -627,7 +627,7 @@ static void main_dispatch_ldpe(struct event *thread) /* ARGSUSED */ static void main_dispatch_lde(struct event *thread) { - struct imsgev *iev = THREAD_ARG(thread); + struct imsgev *iev = EVENT_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; struct imsg imsg; ssize_t n; @@ -722,8 +722,8 @@ static void main_dispatch_lde(struct event *thread) imsg_event_add(iev); else { /* this pipe is dead, so remove the event handlers and exit */ - THREAD_OFF(iev->ev_read); - THREAD_OFF(iev->ev_write); + EVENT_OFF(iev->ev_read); + EVENT_OFF(iev->ev_write); lde_pid = 0; if (ldpe_pid == 0) ldpd_shutdown(); @@ -735,7 +735,7 @@ static void main_dispatch_lde(struct event *thread) /* ARGSUSED */ void ldp_write_handler(struct event *thread) { - struct imsgev *iev = THREAD_ARG(thread); + struct imsgev *iev = EVENT_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; ssize_t n; @@ -745,8 +745,8 @@ void ldp_write_handler(struct event *thread) fatal("msgbuf_write"); if (n == 0) { /* this pipe is dead, so remove the event handlers */ - THREAD_OFF(iev->ev_read); - THREAD_OFF(iev->ev_write); + EVENT_OFF(iev->ev_read); + EVENT_OFF(iev->ev_write); return; } @@ -835,7 +835,7 @@ void evbuf_init(struct evbuf *eb, int fd, void (*handler)(struct event *), void evbuf_clear(struct evbuf *eb) { - THREAD_OFF(eb->ev); + EVENT_OFF(eb->ev); msgbuf_clear(&eb->wbuf); eb->wbuf.fd = -1; } diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c index 2e6acd8d0..d3193b16d 100644 --- a/ldpd/ldpe.c +++ b/ldpd/ldpe.c @@ -200,7 +200,7 @@ ldpe_shutdown(void) #ifdef __OpenBSD__ if (sysdep.no_pfkey == 0) { - THREAD_OFF(pfkey_ev); + EVENT_OFF(pfkey_ev); close(global.pfkeysock); } #endif @@ -273,7 +273,7 @@ static void ldpe_dispatch_main(struct event *thread) struct l2vpn_pw *pw, *npw; struct imsg imsg; int fd; - struct imsgev *iev = THREAD_ARG(thread); + struct imsgev *iev = EVENT_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; struct iface *iface = NULL; struct kif *kif; @@ -615,8 +615,8 @@ static void ldpe_dispatch_main(struct event *thread) imsg_event_add(iev); else { /* this pipe is dead, so remove the event handlers and exit */ - THREAD_OFF(iev->ev_read); - THREAD_OFF(iev->ev_write); + EVENT_OFF(iev->ev_read); + EVENT_OFF(iev->ev_write); ldpe_shutdown(); } } @@ -624,7 +624,7 @@ static void ldpe_dispatch_main(struct event *thread) /* ARGSUSED */ static void ldpe_dispatch_lde(struct event *thread) { - struct imsgev *iev = THREAD_ARG(thread); + struct imsgev *iev = EVENT_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; struct imsg imsg; struct map *map; @@ -751,8 +751,8 @@ static void ldpe_dispatch_lde(struct event *thread) imsg_event_add(iev); else { /* this pipe is dead, so remove the event handlers and exit */ - THREAD_OFF(iev->ev_read); - THREAD_OFF(iev->ev_write); + EVENT_OFF(iev->ev_read); + EVENT_OFF(iev->ev_write); ldpe_shutdown(); } } @@ -761,7 +761,7 @@ static void ldpe_dispatch_lde(struct event *thread) /* ARGSUSED */ static void ldpe_dispatch_pfkey(struct event *thread) { - int fd = THREAD_FD(thread); + int fd = EVENT_FD(thread); event_add_read(master, ldpe_dispatch_pfkey, NULL, global.pfkeysock, &pfkey_ev); @@ -802,14 +802,14 @@ ldpe_close_sockets(int af) af_global = ldp_af_global_get(&global, af); /* discovery socket */ - THREAD_OFF(af_global->disc_ev); + EVENT_OFF(af_global->disc_ev); if (af_global->ldp_disc_socket != -1) { close(af_global->ldp_disc_socket); af_global->ldp_disc_socket = -1; } /* extended discovery socket */ - THREAD_OFF(af_global->edisc_ev); + EVENT_OFF(af_global->edisc_ev); if (af_global->ldp_edisc_socket != -1) { close(af_global->ldp_edisc_socket); af_global->ldp_edisc_socket = -1; diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c index 50a35e9f6..6f9177fe8 100644 --- a/ldpd/neighbor.c +++ b/ldpd/neighbor.c @@ -296,7 +296,7 @@ nbr_del(struct nbr *nbr) nbr->auth.method = AUTH_NONE; if (nbr_pending_connect(nbr)) - THREAD_OFF(nbr->ev_connect); + EVENT_OFF(nbr->ev_connect); nbr_stop_ktimer(nbr); nbr_stop_ktimeout(nbr); nbr_stop_itimeout(nbr); @@ -409,7 +409,7 @@ nbr_session_active_role(struct nbr *nbr) static void nbr_ktimer(struct event *thread) { - struct nbr *nbr = THREAD_ARG(thread); + struct nbr *nbr = EVENT_ARG(thread); nbr->keepalive_timer = NULL; send_keepalive(nbr); @@ -423,7 +423,7 @@ nbr_start_ktimer(struct nbr *nbr) /* send three keepalives per period */ secs = nbr->keepalive / KEEPALIVE_PER_PERIOD; - THREAD_OFF(nbr->keepalive_timer); + EVENT_OFF(nbr->keepalive_timer); nbr->keepalive_timer = NULL; event_add_timer(master, nbr_ktimer, nbr, secs, &nbr->keepalive_timer); } @@ -431,14 +431,14 @@ nbr_start_ktimer(struct nbr *nbr) void nbr_stop_ktimer(struct nbr *nbr) { - THREAD_OFF(nbr->keepalive_timer); + EVENT_OFF(nbr->keepalive_timer); } /* Keepalive timeout: if the nbr hasn't sent keepalive */ static void nbr_ktimeout(struct event *thread) { - struct nbr *nbr = THREAD_ARG(thread); + struct nbr *nbr = EVENT_ARG(thread); nbr->keepalive_timeout = NULL; @@ -450,7 +450,7 @@ static void nbr_ktimeout(struct event *thread) static void nbr_start_ktimeout(struct nbr *nbr) { - THREAD_OFF(nbr->keepalive_timeout); + EVENT_OFF(nbr->keepalive_timeout); nbr->keepalive_timeout = NULL; event_add_timer(master, nbr_ktimeout, nbr, nbr->keepalive, &nbr->keepalive_timeout); @@ -459,14 +459,14 @@ nbr_start_ktimeout(struct nbr *nbr) void nbr_stop_ktimeout(struct nbr *nbr) { - THREAD_OFF(nbr->keepalive_timeout); + EVENT_OFF(nbr->keepalive_timeout); } /* Session initialization timeout: if nbr got stuck in the initialization FSM */ static void nbr_itimeout(struct event *thread) { - struct nbr *nbr = THREAD_ARG(thread); + struct nbr *nbr = EVENT_ARG(thread); log_debug("%s: lsr-id %pI4", __func__, &nbr->id); @@ -479,7 +479,7 @@ nbr_start_itimeout(struct nbr *nbr) int secs; secs = INIT_FSM_TIMEOUT; - THREAD_OFF(nbr->init_timeout); + EVENT_OFF(nbr->init_timeout); nbr->init_timeout = NULL; event_add_timer(master, nbr_itimeout, nbr, secs, &nbr->init_timeout); } @@ -487,14 +487,14 @@ nbr_start_itimeout(struct nbr *nbr) void nbr_stop_itimeout(struct nbr *nbr) { - THREAD_OFF(nbr->init_timeout); + EVENT_OFF(nbr->init_timeout); } /* Init delay timer: timer to retry to iniziatize session */ static void nbr_idtimer(struct event *thread) { - struct nbr *nbr = THREAD_ARG(thread); + struct nbr *nbr = EVENT_ARG(thread); nbr->initdelay_timer = NULL; @@ -525,7 +525,7 @@ nbr_start_idtimer(struct nbr *nbr) break; } - THREAD_OFF(nbr->initdelay_timer); + EVENT_OFF(nbr->initdelay_timer); nbr->initdelay_timer = NULL; event_add_timer(master, nbr_idtimer, nbr, secs, &nbr->initdelay_timer); } @@ -533,7 +533,7 @@ nbr_start_idtimer(struct nbr *nbr) void nbr_stop_idtimer(struct nbr *nbr) { - THREAD_OFF(nbr->initdelay_timer); + EVENT_OFF(nbr->initdelay_timer); } int @@ -550,7 +550,7 @@ nbr_pending_connect(struct nbr *nbr) static void nbr_connect_cb(struct event *thread) { - struct nbr *nbr = THREAD_ARG(thread); + struct nbr *nbr = EVENT_ARG(thread); int error; socklen_t len; diff --git a/ldpd/packet.c b/ldpd/packet.c index ef2f6e82b..71eeb1adb 100644 --- a/ldpd/packet.c +++ b/ldpd/packet.c @@ -97,8 +97,8 @@ send_packet(int fd, int af, union ldpd_addr *dst, struct iface_af *ia, /* Discovery functions */ void disc_recv_packet(struct event *thread) { - int fd = THREAD_FD(thread); - struct event **threadp = THREAD_ARG(thread); + int fd = EVENT_FD(thread); + struct event **threadp = EVENT_ARG(thread); union { struct cmsghdr hdr; @@ -292,7 +292,7 @@ disc_find_iface(unsigned int ifindex, int af, union ldpd_addr *src) void session_accept(struct event *thread) { - int fd = THREAD_FD(thread); + int fd = EVENT_FD(thread); struct sockaddr_storage src; socklen_t len = sizeof(src); int newfd; @@ -396,8 +396,8 @@ session_accept_nbr(struct nbr *nbr, int fd) static void session_read(struct event *thread) { - int fd = THREAD_FD(thread); - struct nbr *nbr = THREAD_ARG(thread); + int fd = EVENT_FD(thread); + struct nbr *nbr = EVENT_ARG(thread); struct tcp_conn *tcp = nbr->tcp; struct ldp_hdr *ldp_hdr; struct ldp_msg *msg; @@ -612,7 +612,7 @@ static void session_read(struct event *thread) static void session_write(struct event *thread) { - struct tcp_conn *tcp = THREAD_ARG(thread); + struct tcp_conn *tcp = EVENT_ARG(thread); struct nbr *nbr = tcp->nbr; tcp->wbuf.ev = NULL; @@ -640,7 +640,7 @@ session_shutdown(struct nbr *nbr, uint32_t status, uint32_t msg_id, switch (nbr->state) { case NBR_STA_PRESENT: if (nbr_pending_connect(nbr)) - THREAD_OFF(nbr->ev_connect); + EVENT_OFF(nbr->ev_connect); break; case NBR_STA_INITIAL: case NBR_STA_OPENREC: @@ -745,7 +745,7 @@ tcp_close(struct tcp_conn *tcp) evbuf_clear(&tcp->wbuf); if (tcp->nbr) { - THREAD_OFF(tcp->rev); + EVENT_OFF(tcp->rev); free(tcp->rbuf); tcp->nbr->tcp = NULL; } @@ -777,7 +777,7 @@ pending_conn_new(int fd, int af, union ldpd_addr *addr) void pending_conn_del(struct pending_conn *pconn) { - THREAD_OFF(pconn->ev_timeout); + EVENT_OFF(pconn->ev_timeout); TAILQ_REMOVE(&global.pending_conns, pconn, entry); free(pconn); } @@ -797,7 +797,7 @@ pending_conn_find(int af, union ldpd_addr *addr) static void pending_conn_timeout(struct event *thread) { - struct pending_conn *pconn = THREAD_ARG(thread); + struct pending_conn *pconn = EVENT_ARG(thread); struct tcp_conn *tcp; pconn->ev_timeout = NULL; diff --git a/lib/agentx.c b/lib/agentx.c index e20303813..3b9be3397 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -46,13 +46,13 @@ static void agentx_read(struct event *t) fd_set fds; int flags, new_flags = 0; int nonblock = false; - struct listnode *ln = THREAD_ARG(t); + struct listnode *ln = EVENT_ARG(t); struct event **thr = listgetdata(ln); XFREE(MTYPE_TMP, thr); list_delete_node(events, ln); /* fix for non blocking socket */ - flags = fcntl(THREAD_FD(t), F_GETFL, 0); + flags = fcntl(EVENT_FD(t), F_GETFL, 0); if (-1 == flags) { flog_err(EC_LIB_SYSTEM_CALL, "Failed to get FD settings fcntl: %s(%d)", strerror(errno), errno); @@ -62,19 +62,19 @@ static void agentx_read(struct event *t) if (flags & O_NONBLOCK) nonblock = true; else - new_flags = fcntl(THREAD_FD(t), F_SETFL, flags | O_NONBLOCK); + new_flags = fcntl(EVENT_FD(t), F_SETFL, flags | O_NONBLOCK); if (new_flags == -1) flog_err(EC_LIB_SYSTEM_CALL, "Failed to set snmp fd non blocking: %s(%d)", strerror(errno), errno); FD_ZERO(&fds); - FD_SET(THREAD_FD(t), &fds); + FD_SET(EVENT_FD(t), &fds); snmp_read(&fds); /* Reset the flag */ if (!nonblock) { - new_flags = fcntl(THREAD_FD(t), F_SETFL, flags); + new_flags = fcntl(EVENT_FD(t), F_SETFL, flags); if (new_flags == -1) flog_err( @@ -109,7 +109,7 @@ static void agentx_events_update(void) ln = listhead(events); thr = ln ? listgetdata(ln) : NULL; - thr_fd = thr ? THREAD_FD(*thr) : -1; + thr_fd = thr ? EVENT_FD(*thr) : -1; /* "two-pointer" / two-list simultaneous iteration * ln/thr/thr_fd point to the next existing event listener to hit while @@ -125,7 +125,7 @@ static void agentx_events_update(void) } ln = nextln; thr = ln ? listgetdata(ln) : NULL; - thr_fd = thr ? THREAD_FD(*thr) : -1; + thr_fd = thr ? EVENT_FD(*thr) : -1; } /* need listener, but haven't hit one where it would be */ else if (FD_ISSET(fd, &fds)) { @@ -487,7 +487,7 @@ static bool _bfd_sess_valid(const struct bfd_session_params *bsp) static void _bfd_sess_send(struct event *t) { - struct bfd_session_params *bsp = THREAD_ARG(t); + struct bfd_session_params *bsp = EVENT_ARG(t); int rv; /* Validate configuration before trying to send bogus data. */ @@ -533,7 +533,7 @@ static void _bfd_sess_send(struct event *t) static void _bfd_sess_remove(struct bfd_session_params *bsp) { /* Cancel any pending installation request. */ - THREAD_OFF(bsp->installev); + EVENT_OFF(bsp->installev); /* Not installed, nothing to do. */ if (!bsp->installed) @@ -890,7 +890,7 @@ int zclient_bfd_session_replay(ZAPI_CALLBACK_ARGS) bsp->installed = false; /* Cancel any pending installation request. */ - THREAD_OFF(bsp->installev); + EVENT_OFF(bsp->installev); /* Ask for installation. */ bsp->lastev = BSE_INSTALL; diff --git a/lib/event.h b/lib/event.h index 36766899c..9f8e8831f 100644 --- a/lib/event.h +++ b/lib/event.h @@ -153,14 +153,14 @@ struct cpu_event_history { #define EVENT_TIMER_STRLEN 12 /* Macros. */ -#define THREAD_ARG(X) ((X)->arg) -#define THREAD_FD(X) ((X)->u.fd) -#define THREAD_VAL(X) ((X)->u.val) +#define EVENT_ARG(X) ((X)->arg) +#define EVENT_FD(X) ((X)->u.fd) +#define EVENT_VAL(X) ((X)->u.val) /* * Please consider this macro deprecated, and do not use it in new code. */ -#define THREAD_OFF(thread) \ +#define EVENT_OFF(thread) \ do { \ if ((thread)) \ event_cancel(&(thread)); \ diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c index eb4102cb8..0c7d2c475 100644 --- a/lib/frr_pthread.c +++ b/lib/frr_pthread.c @@ -231,7 +231,7 @@ static void fpt_dummy(struct event *thread) /* poison pill task to end event loop */ static void fpt_finish(struct event *thread) { - struct frr_pthread *fpt = THREAD_ARG(thread); + struct frr_pthread *fpt = EVENT_ARG(thread); atomic_store_explicit(&fpt->running, false, memory_order_relaxed); } diff --git a/lib/frr_zmq.c b/lib/frr_zmq.c index a9a394aeb..98cf9ee44 100644 --- a/lib/frr_zmq.c +++ b/lib/frr_zmq.c @@ -45,7 +45,7 @@ void frrzmq_finish(void) static void frrzmq_read_msg(struct event *t) { - struct frrzmq_cb **cbp = THREAD_ARG(t); + struct frrzmq_cb **cbp = EVENT_ARG(t); struct frrzmq_cb *cb; zmq_msg_t msg; unsigned partno; @@ -202,7 +202,7 @@ int _frrzmq_event_add_read(const struct xref_eventsched *xref, static void frrzmq_write_msg(struct event *t) { - struct frrzmq_cb **cbp = THREAD_ARG(t); + struct frrzmq_cb **cbp = EVENT_ARG(t); struct frrzmq_cb *cb; unsigned char written = 0; int ret; diff --git a/lib/ldp_sync.c b/lib/ldp_sync.c index 3ecbfcabf..b0608c391 100644 --- a/lib/ldp_sync.c +++ b/lib/ldp_sync.c @@ -66,7 +66,7 @@ bool ldp_sync_if_down(struct ldp_sync_info *ldp_sync_info) * update state */ if (ldp_sync_info && ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED) { - THREAD_OFF(ldp_sync_info->t_holddown); + EVENT_OFF(ldp_sync_info->t_holddown); if (ldp_sync_info->state == LDP_IGP_SYNC_STATE_REQUIRED_UP) ldp_sync_info->state = diff --git a/lib/mgmt_be_client.c b/lib/mgmt_be_client.c index f710e062c..4445c2b49 100644 --- a/lib/mgmt_be_client.c +++ b/lib/mgmt_be_client.c @@ -899,7 +899,7 @@ static void mgmt_be_client_process_msg(void *user_ctx, uint8_t *data, static void mgmt_be_client_proc_msgbufs(struct event *thread) { - struct mgmt_be_client_ctx *client_ctx = THREAD_ARG(thread); + struct mgmt_be_client_ctx *client_ctx = EVENT_ARG(thread); if (mgmt_msg_procbufs(&client_ctx->mstate, mgmt_be_client_process_msg, client_ctx, mgmt_debug_be_client)) @@ -908,7 +908,7 @@ static void mgmt_be_client_proc_msgbufs(struct event *thread) static void mgmt_be_client_read(struct event *thread) { - struct mgmt_be_client_ctx *client_ctx = THREAD_ARG(thread); + struct mgmt_be_client_ctx *client_ctx = EVENT_ARG(thread); enum mgmt_msg_rsched rv; rv = mgmt_msg_read(&client_ctx->mstate, client_ctx->conn_fd, @@ -964,7 +964,7 @@ static int mgmt_be_client_send_msg(struct mgmt_be_client_ctx *client_ctx, static void mgmt_be_client_write(struct event *thread) { - struct mgmt_be_client_ctx *client_ctx = THREAD_ARG(thread); + struct mgmt_be_client_ctx *client_ctx = EVENT_ARG(thread); enum mgmt_msg_wsched rv; rv = mgmt_msg_write(&client_ctx->mstate, client_ctx->conn_fd, @@ -985,7 +985,7 @@ static void mgmt_be_client_resume_writes(struct event *thread) { struct mgmt_be_client_ctx *client_ctx; - client_ctx = (struct mgmt_be_client_ctx *)THREAD_ARG(thread); + client_ctx = (struct mgmt_be_client_ctx *)EVENT_ARG(thread); assert(client_ctx && client_ctx->conn_fd != -1); mgmt_be_client_writes_on(client_ctx); @@ -1042,7 +1042,7 @@ static void mgmt_be_server_connect(struct mgmt_be_client_ctx *client_ctx) static void mgmt_be_client_conn_timeout(struct event *thread) { - mgmt_be_server_connect(THREAD_ARG(thread)); + mgmt_be_server_connect(EVENT_ARG(thread)); } static void @@ -1213,11 +1213,11 @@ void mgmt_be_client_lib_destroy(uintptr_t lib_hndl) mgmt_msg_destroy(&client_ctx->mstate); - THREAD_OFF(client_ctx->conn_retry_tmr); - THREAD_OFF(client_ctx->conn_read_ev); - THREAD_OFF(client_ctx->conn_write_ev); - THREAD_OFF(client_ctx->conn_writes_on); - THREAD_OFF(client_ctx->msg_proc_ev); + EVENT_OFF(client_ctx->conn_retry_tmr); + EVENT_OFF(client_ctx->conn_read_ev); + EVENT_OFF(client_ctx->conn_write_ev); + EVENT_OFF(client_ctx->conn_writes_on); + EVENT_OFF(client_ctx->msg_proc_ev); mgmt_be_cleanup_all_txns(client_ctx); mgmt_be_txns_fini(&client_ctx->txn_head); } diff --git a/lib/mgmt_fe_client.c b/lib/mgmt_fe_client.c index 58ee93ac1..a54de4244 100644 --- a/lib/mgmt_fe_client.c +++ b/lib/mgmt_fe_client.c @@ -179,7 +179,7 @@ static void mgmt_fe_client_write(struct event *thread) struct mgmt_fe_client_ctx *client_ctx; enum mgmt_msg_wsched rv; - client_ctx = (struct mgmt_fe_client_ctx *)THREAD_ARG(thread); + client_ctx = (struct mgmt_fe_client_ctx *)EVENT_ARG(thread); rv = mgmt_msg_write(&client_ctx->mstate, client_ctx->conn_fd, mgmt_debug_fe_client); if (rv == MSW_SCHED_STREAM) @@ -198,7 +198,7 @@ static void mgmt_fe_client_resume_writes(struct event *thread) { struct mgmt_fe_client_ctx *client_ctx; - client_ctx = (struct mgmt_fe_client_ctx *)THREAD_ARG(thread); + client_ctx = (struct mgmt_fe_client_ctx *)EVENT_ARG(thread); assert(client_ctx && client_ctx->conn_fd != -1); mgmt_fe_client_writes_on(client_ctx); @@ -674,7 +674,7 @@ static void mgmt_fe_client_proc_msgbufs(struct event *thread) { struct mgmt_fe_client_ctx *client_ctx; - client_ctx = (struct mgmt_fe_client_ctx *)THREAD_ARG(thread); + client_ctx = (struct mgmt_fe_client_ctx *)EVENT_ARG(thread); if (mgmt_msg_procbufs(&client_ctx->mstate, mgmt_fe_client_process_msg, client_ctx, mgmt_debug_fe_client)) mgmt_fe_client_register_event(client_ctx, MGMTD_FE_PROC_MSG); @@ -685,7 +685,7 @@ static void mgmt_fe_client_read(struct event *thread) struct mgmt_fe_client_ctx *client_ctx; enum mgmt_msg_rsched rv; - client_ctx = (struct mgmt_fe_client_ctx *)THREAD_ARG(thread); + client_ctx = (struct mgmt_fe_client_ctx *)EVENT_ARG(thread); rv = mgmt_msg_read(&client_ctx->mstate, client_ctx->conn_fd, mgmt_debug_fe_client); @@ -727,7 +727,7 @@ static void mgmt_fe_server_connect(struct mgmt_fe_client_ctx *client_ctx) static void mgmt_fe_client_conn_timeout(struct event *thread) { - mgmt_fe_server_connect(THREAD_ARG(thread)); + mgmt_fe_server_connect(EVENT_ARG(thread)); } static void @@ -1067,10 +1067,10 @@ void mgmt_fe_client_lib_destroy(uintptr_t lib_hndl) mgmt_fe_destroy_client_sessions(lib_hndl); - THREAD_OFF(client_ctx->conn_retry_tmr); - THREAD_OFF(client_ctx->conn_read_ev); - THREAD_OFF(client_ctx->conn_write_ev); - THREAD_OFF(client_ctx->conn_writes_on); - THREAD_OFF(client_ctx->msg_proc_ev); + EVENT_OFF(client_ctx->conn_retry_tmr); + EVENT_OFF(client_ctx->conn_read_ev); + EVENT_OFF(client_ctx->conn_write_ev); + EVENT_OFF(client_ctx->conn_writes_on); + EVENT_OFF(client_ctx->msg_proc_ev); mgmt_msg_destroy(&client_ctx->mstate); } diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index 87ce347b6..f480182c7 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -302,7 +302,7 @@ int nb_cli_confirmed_commit_rollback(struct vty *vty) static void nb_cli_confirmed_commit_timeout(struct event *thread) { - struct vty *vty = THREAD_ARG(thread); + struct vty *vty = EVENT_ARG(thread); /* XXX: broadcast this message to all logged-in users? */ vty_out(vty, diff --git a/lib/northbound_confd.c b/lib/northbound_confd.c index 6be2ed00b..0e01b0603 100644 --- a/lib/northbound_confd.c +++ b/lib/northbound_confd.c @@ -403,7 +403,7 @@ static int frr_confd_cdb_read_cb_abort(int fd, int *subp, int reslen) static void frr_confd_cdb_read_cb(struct event *thread) { - int fd = THREAD_FD(thread); + int fd = EVENT_FD(thread); enum cdb_sub_notification cdb_ev; int flags; int *subp = NULL; @@ -588,7 +588,7 @@ error: static void frr_confd_finish_cdb(void) { if (cdb_sub_sock > 0) { - THREAD_OFF(t_cdb_sub); + EVENT_OFF(t_cdb_sub); cdb_close(cdb_sub_sock); } } @@ -1175,8 +1175,8 @@ static int frr_confd_dp_read(struct confd_daemon_ctx *dctx, int fd) static void frr_confd_dp_ctl_read(struct event *thread) { - struct confd_daemon_ctx *dctx = THREAD_ARG(thread); - int fd = THREAD_FD(thread); + struct confd_daemon_ctx *dctx = EVENT_ARG(thread); + int fd = EVENT_FD(thread); event_add_read(master, frr_confd_dp_ctl_read, dctx, fd, &t_dp_ctl); @@ -1185,8 +1185,8 @@ static void frr_confd_dp_ctl_read(struct event *thread) static void frr_confd_dp_worker_read(struct event *thread) { - struct confd_daemon_ctx *dctx = THREAD_ARG(thread); - int fd = THREAD_FD(thread); + struct confd_daemon_ctx *dctx = EVENT_ARG(thread); + int fd = EVENT_FD(thread); event_add_read(master, frr_confd_dp_worker_read, dctx, fd, &t_dp_worker); @@ -1337,11 +1337,11 @@ error: static void frr_confd_finish_dp(void) { if (dp_worker_sock > 0) { - THREAD_OFF(t_dp_worker); + EVENT_OFF(t_dp_worker); close(dp_worker_sock); } if (dp_ctl_sock > 0) { - THREAD_OFF(t_dp_ctl); + EVENT_OFF(t_dp_ctl); close(dp_ctl_sock); } if (dctx != NULL) diff --git a/lib/northbound_grpc.cpp b/lib/northbound_grpc.cpp index 66edead5d..fcea77488 100644 --- a/lib/northbound_grpc.cpp +++ b/lib/northbound_grpc.cpp @@ -184,7 +184,7 @@ class RpcStateBase static void c_callback(struct event *thread) { - auto _tag = static_cast<RpcStateBase *>(THREAD_ARG(thread)); + auto _tag = static_cast<RpcStateBase *>(EVENT_ARG(thread)); /* * We hold the lock until the callback finishes and has updated * _tag->state, then we signal done and release. diff --git a/lib/northbound_sysrepo.c b/lib/northbound_sysrepo.c index 8a775b8ba..2cfee9de6 100644 --- a/lib/northbound_sysrepo.c +++ b/lib/northbound_sysrepo.c @@ -516,8 +516,8 @@ static int frr_sr_notification_send(const char *xpath, struct list *arguments) static void frr_sr_read_cb(struct event *thread) { - struct yang_module *module = THREAD_ARG(thread); - int fd = THREAD_FD(thread); + struct yang_module *module = EVENT_ARG(thread); + int fd = EVENT_FD(thread); int ret; ret = sr_subscription_process_events(module->sr_subscription, session, @@ -710,7 +710,7 @@ static int frr_sr_finish(void) if (!module->sr_subscription) continue; sr_unsubscribe(module->sr_subscription); - THREAD_OFF(module->sr_thread); + EVENT_OFF(module->sr_thread); } if (session) diff --git a/lib/pullwr.c b/lib/pullwr.c index 3dccecdfb..4dae87314 100644 --- a/lib/pullwr.c +++ b/lib/pullwr.c @@ -61,7 +61,7 @@ struct pullwr *_pullwr_new(struct event_master *tm, int fd, void *arg, void pullwr_del(struct pullwr *pullwr) { - THREAD_OFF(pullwr->writer); + EVENT_OFF(pullwr->writer); XFREE(MTYPE_PULLWR_BUF, pullwr->buffer); XFREE(MTYPE_PULLWR_HEAD, pullwr); @@ -177,7 +177,7 @@ void pullwr_write(struct pullwr *pullwr, const void *data, size_t len) static void pullwr_run(struct event *t) { - struct pullwr *pullwr = THREAD_ARG(t); + struct pullwr *pullwr = EVENT_ARG(t); struct iovec iov[2]; size_t niov, lastvalid; ssize_t nwr; diff --git a/lib/resolver.c b/lib/resolver.c index 9b1802dc8..e5932299f 100644 --- a/lib/resolver.c +++ b/lib/resolver.c @@ -102,7 +102,7 @@ static void resolver_update_timeouts(struct resolver_state *r); static void resolver_cb_timeout(struct event *t) { - struct resolver_state *r = THREAD_ARG(t); + struct resolver_state *r = EVENT_ARG(t); ares_process(r->channel, NULL, NULL); resolver_update_timeouts(r); @@ -110,13 +110,13 @@ static void resolver_cb_timeout(struct event *t) static void resolver_cb_socket_readable(struct event *t) { - struct resolver_fd *resfd = THREAD_ARG(t); + struct resolver_fd *resfd = EVENT_ARG(t); struct resolver_state *r = resfd->state; event_add_read(r->master, resolver_cb_socket_readable, resfd, resfd->fd, &resfd->t_read); /* ^ ordering important: - * ares_process_fd may transitively call THREAD_OFF(resfd->t_read) + * ares_process_fd may transitively call EVENT_OFF(resfd->t_read) * combined with resolver_fd_drop_maybe, so resfd may be free'd after! */ ares_process_fd(r->channel, resfd->fd, ARES_SOCKET_BAD); @@ -125,13 +125,13 @@ static void resolver_cb_socket_readable(struct event *t) static void resolver_cb_socket_writable(struct event *t) { - struct resolver_fd *resfd = THREAD_ARG(t); + struct resolver_fd *resfd = EVENT_ARG(t); struct resolver_state *r = resfd->state; event_add_write(r->master, resolver_cb_socket_writable, resfd, resfd->fd, &resfd->t_write); /* ^ ordering important: - * ares_process_fd may transitively call THREAD_OFF(resfd->t_write) + * ares_process_fd may transitively call EVENT_OFF(resfd->t_write) * combined with resolver_fd_drop_maybe, so resfd may be free'd after! */ ares_process_fd(r->channel, ARES_SOCKET_BAD, resfd->fd); @@ -142,7 +142,7 @@ static void resolver_update_timeouts(struct resolver_state *r) { struct timeval *tv, tvbuf; - THREAD_OFF(r->timeout); + EVENT_OFF(r->timeout); tv = ares_timeout(r->channel, NULL, &tvbuf); if (tv) { unsigned int timeoutms = tv->tv_sec * 1000 + tv->tv_usec / 1000; @@ -165,13 +165,13 @@ static void ares_socket_cb(void *data, ares_socket_t fd, int readable, assert(resfd->state == r); if (!readable) - THREAD_OFF(resfd->t_read); + EVENT_OFF(resfd->t_read); else if (!resfd->t_read) event_add_read(r->master, resolver_cb_socket_readable, resfd, fd, &resfd->t_read); if (!writable) - THREAD_OFF(resfd->t_write); + EVENT_OFF(resfd->t_write); else if (!resfd->t_write) event_add_write(r->master, resolver_cb_socket_writable, resfd, fd, &resfd->t_write); @@ -224,7 +224,7 @@ static void ares_address_cb(void *arg, int status, int timeouts, static void resolver_cb_literal(struct event *t) { - struct resolver_query *query = THREAD_ARG(t); + struct resolver_query *query = EVENT_ARG(t); void (*callback)(struct resolver_query *, const char *, int, union sockunion *); diff --git a/lib/sigevent.c b/lib/sigevent.c index 2ab56a279..88c010e57 100644 --- a/lib/sigevent.c +++ b/lib/sigevent.c @@ -131,7 +131,7 @@ void frr_signal_timer(struct event *t) { struct frr_sigevent_master_t *sigm; - sigm = THREAD_ARG(t); + sigm = EVENT_ARG(t); sigm->t = NULL; event_add_timer(sigm->t->master, frr_signal_timer, &sigmaster, FRR_SIGNAL_TIMER_INTERVAL, &sigm->t); diff --git a/lib/spf_backoff.c b/lib/spf_backoff.c index b95fd6085..b363f6f0b 100644 --- a/lib/spf_backoff.c +++ b/lib/spf_backoff.c @@ -106,7 +106,7 @@ void spf_backoff_free(struct spf_backoff *backoff) static void spf_backoff_timetolearn_elapsed(struct event *thread) { - struct spf_backoff *backoff = THREAD_ARG(thread); + struct spf_backoff *backoff = EVENT_ARG(thread); backoff->state = SPF_BACKOFF_LONG_WAIT; backoff_debug("SPF Back-off(%s) TIMETOLEARN elapsed, move to state %s", @@ -115,9 +115,9 @@ static void spf_backoff_timetolearn_elapsed(struct event *thread) static void spf_backoff_holddown_elapsed(struct event *thread) { - struct spf_backoff *backoff = THREAD_ARG(thread); + struct spf_backoff *backoff = EVENT_ARG(thread); - THREAD_OFF(backoff->t_timetolearn); + EVENT_OFF(backoff->t_timetolearn); timerclear(&backoff->first_event_time); backoff->state = SPF_BACKOFF_QUIET; backoff_debug("SPF Back-off(%s) HOLDDOWN elapsed, move to state %s", @@ -1366,7 +1366,7 @@ static void vty_read(struct event *thread) int nbytes; unsigned char buf[VTY_READ_BUFSIZ]; - struct vty *vty = THREAD_ARG(thread); + struct vty *vty = EVENT_ARG(thread); /* Read raw data from socket */ if ((nbytes = read(vty->fd, buf, VTY_READ_BUFSIZ)) <= 0) { @@ -1567,11 +1567,11 @@ static void vty_flush(struct event *thread) { int erase; buffer_status_t flushrc; - struct vty *vty = THREAD_ARG(thread); + struct vty *vty = EVENT_ARG(thread); /* Tempolary disable read thread. */ if (vty->lines == 0) - THREAD_OFF(vty->t_read); + EVENT_OFF(vty->t_read); /* Function execution continue. */ erase = ((vty->status == VTY_MORE || vty->status == VTY_MORELINE)); @@ -1757,9 +1757,9 @@ void vty_stdio_suspend(void) if (!stdio_vty) return; - THREAD_OFF(stdio_vty->t_write); - THREAD_OFF(stdio_vty->t_read); - THREAD_OFF(stdio_vty->t_timeout); + EVENT_OFF(stdio_vty->t_write); + EVENT_OFF(stdio_vty->t_read); + EVENT_OFF(stdio_vty->t_timeout); if (stdio_termios) tcsetattr(0, TCSANOW, &stdio_orig_termios); @@ -1825,7 +1825,7 @@ struct vty *vty_stdio(void (*atclose)(int isexit)) /* Accept connection from the network. */ static void vty_accept(struct event *thread) { - struct vty_serv *vtyserv = THREAD_ARG(thread); + struct vty_serv *vtyserv = EVENT_ARG(thread); int vty_sock; union sockunion su; int ret; @@ -2038,7 +2038,7 @@ static void vty_serv_un(const char *path) static void vtysh_accept(struct event *thread) { - struct vty_serv *vtyserv = THREAD_ARG(thread); + struct vty_serv *vtyserv = EVENT_ARG(thread); int accept_sock = vtyserv->sock; int sock; int client_len; @@ -2176,8 +2176,8 @@ static void vtysh_read(struct event *thread) unsigned char *p; uint8_t header[4] = {0, 0, 0, 0}; - sock = THREAD_FD(thread); - vty = THREAD_ARG(thread); + sock = EVENT_FD(thread); + vty = EVENT_ARG(thread); if ((nbytes = read(sock, buf, VTY_READ_BUFSIZ)) <= 0) { if (nbytes < 0) { @@ -2277,7 +2277,7 @@ static void vtysh_read(struct event *thread) static void vtysh_write(struct event *thread) { - struct vty *vty = THREAD_ARG(thread); + struct vty *vty = EVENT_ARG(thread); vtysh_flush(vty); } @@ -2322,9 +2322,9 @@ void vty_close(struct vty *vty) vty_config_exit(vty); /* Cancel threads.*/ - THREAD_OFF(vty->t_read); - THREAD_OFF(vty->t_write); - THREAD_OFF(vty->t_timeout); + EVENT_OFF(vty->t_read); + EVENT_OFF(vty->t_write); + EVENT_OFF(vty->t_timeout); if (vty->pass_fd != -1) { close(vty->pass_fd); @@ -2386,7 +2386,7 @@ static void vty_timeout(struct event *thread) { struct vty *vty; - vty = THREAD_ARG(thread); + vty = EVENT_ARG(thread); vty->v_timeout = 0; /* Clear buffer*/ @@ -2844,7 +2844,7 @@ static void vty_event(enum vty_event event, struct vty *vty) /* Time out treatment. */ if (vty->v_timeout) { - THREAD_OFF(vty->t_timeout); + EVENT_OFF(vty->t_timeout); event_add_timer(vty_master, vty_timeout, vty, vty->v_timeout, &vty->t_timeout); } @@ -2854,7 +2854,7 @@ static void vty_event(enum vty_event event, struct vty *vty) &vty->t_write); break; case VTY_TIMEOUT_RESET: - THREAD_OFF(vty->t_timeout); + EVENT_OFF(vty->t_timeout); if (vty->v_timeout) event_add_timer(vty_master, vty_timeout, vty, vty->v_timeout, &vty->t_timeout); @@ -3726,7 +3726,7 @@ void vty_terminate(void) vtys_init(vtysh_sessions); while ((vtyserv = vtyservs_pop(vty_servs))) { - THREAD_OFF(vtyserv->t_accept); + EVENT_OFF(vtyserv->t_accept); close(vtyserv->sock); XFREE(MTYPE_VTY_SERV, vtyserv); } diff --git a/lib/wheel.c b/lib/wheel.c index 88719d2ee..02f27e313 100644 --- a/lib/wheel.c +++ b/lib/wheel.c @@ -26,7 +26,7 @@ static void wheel_timer_thread_helper(struct event *t) struct timer_wheel *wheel; void *data; - wheel = THREAD_ARG(t); + wheel = EVENT_ARG(t); wheel->curr_slot += wheel->slots_to_skip; @@ -55,7 +55,7 @@ static void wheel_timer_thread(struct event *t) { struct timer_wheel *wheel; - wheel = THREAD_ARG(t); + wheel = EVENT_ARG(t); event_execute(wheel->master, wheel_timer_thread_helper, wheel, 0); } @@ -99,7 +99,7 @@ void wheel_delete(struct timer_wheel *wheel) list_delete(&wheel->wheel_slot_lists[i]); } - THREAD_OFF(wheel->timer); + EVENT_OFF(wheel->timer); XFREE(MTYPE_TIMER_WHEEL_LIST, wheel->wheel_slot_lists); XFREE(MTYPE_TIMER_WHEEL, wheel->name); XFREE(MTYPE_TIMER_WHEEL, wheel); diff --git a/lib/workqueue.c b/lib/workqueue.c index a8f48f946..1da7db682 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -88,7 +88,7 @@ void work_queue_free_and_null(struct work_queue **wqp) { struct work_queue *wq = *wqp; - THREAD_OFF(wq->thread); + EVENT_OFF(wq->thread); while (!work_queue_empty(wq)) { struct work_queue_item *item = work_queue_last_item(wq); @@ -198,7 +198,7 @@ void workqueue_cmd_init(void) */ void work_queue_plug(struct work_queue *wq) { - THREAD_OFF(wq->thread); + EVENT_OFF(wq->thread); UNSET_FLAG(wq->flags, WQ_UNPLUGGED); } @@ -226,7 +226,7 @@ void work_queue_run(struct event *thread) unsigned int cycles = 0; char yielded = 0; - wq = THREAD_ARG(thread); + wq = EVENT_ARG(thread); assert(wq); diff --git a/lib/zclient.c b/lib/zclient.c index c6a261207..0e9ce3d63 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -160,9 +160,9 @@ void zclient_stop(struct zclient *zclient) zlog_debug("zclient %p stopped", zclient); /* Stop threads. */ - THREAD_OFF(zclient->t_read); - THREAD_OFF(zclient->t_connect); - THREAD_OFF(zclient->t_write); + EVENT_OFF(zclient->t_read); + EVENT_OFF(zclient->t_connect); + EVENT_OFF(zclient->t_write); /* Reset streams. */ stream_reset(zclient->ibuf); @@ -251,7 +251,7 @@ static enum zclient_send_status zclient_failed(struct zclient *zclient) static void zclient_flush_data(struct event *thread) { - struct zclient *zclient = THREAD_ARG(thread); + struct zclient *zclient = EVENT_ARG(thread); zclient->t_write = NULL; if (zclient->sock < 0) @@ -295,7 +295,7 @@ enum zclient_send_status zclient_send_message(struct zclient *zclient) __func__, zclient->sock); return zclient_failed(zclient); case BUFFER_EMPTY: - THREAD_OFF(zclient->t_write); + EVENT_OFF(zclient->t_write); return ZCLIENT_SEND_SUCCESS; case BUFFER_PENDING: event_add_write(zclient->master, zclient_flush_data, zclient, @@ -748,7 +748,7 @@ static void zclient_connect(struct event *t) { struct zclient *zclient; - zclient = THREAD_ARG(t); + zclient = EVENT_ARG(t); zclient->t_connect = NULL; if (zclient_debug) @@ -4035,7 +4035,7 @@ static void zclient_read(struct event *thread) struct zclient *zclient; /* Get socket to zebra. */ - zclient = THREAD_ARG(thread); + zclient = EVENT_ARG(thread); zclient->t_read = NULL; /* Read zebra header (if we don't have it already). */ diff --git a/lib/zlog_5424.c b/lib/zlog_5424.c index 2a0e6aff8..984ab5d1f 100644 --- a/lib/zlog_5424.c +++ b/lib/zlog_5424.c @@ -791,8 +791,8 @@ static void zlog_5424_cycle(struct zlog_cfg_5424 *zcf, int fd) static void zlog_5424_reconnect(struct event *t) { - struct zlog_cfg_5424 *zcf = THREAD_ARG(t); - int fd = THREAD_FD(t); + struct zlog_cfg_5424 *zcf = EVENT_ARG(t); + int fd = EVENT_FD(t); char dummy[256]; ssize_t ret; diff --git a/mgmtd/mgmt_be_adapter.c b/mgmtd/mgmt_be_adapter.c index 6ef8875c9..a4ba75869 100644 --- a/mgmtd/mgmt_be_adapter.c +++ b/mgmtd/mgmt_be_adapter.c @@ -616,7 +616,7 @@ static void mgmt_be_adapter_process_msg(void *user_ctx, uint8_t *data, static void mgmt_be_adapter_proc_msgbufs(struct event *thread) { - struct mgmt_be_client_adapter *adapter = THREAD_ARG(thread); + struct mgmt_be_client_adapter *adapter = EVENT_ARG(thread); if (mgmt_msg_procbufs(&adapter->mstate, mgmt_be_adapter_process_msg, adapter, mgmt_debug_be)) @@ -628,7 +628,7 @@ static void mgmt_be_adapter_read(struct event *thread) struct mgmt_be_client_adapter *adapter; enum mgmt_msg_rsched rv; - adapter = (struct mgmt_be_client_adapter *)THREAD_ARG(thread); + adapter = (struct mgmt_be_client_adapter *)EVENT_ARG(thread); rv = mgmt_msg_read(&adapter->mstate, adapter->conn_fd, mgmt_debug_be); if (rv == MSR_DISCONNECT) { @@ -642,7 +642,7 @@ static void mgmt_be_adapter_read(struct event *thread) static void mgmt_be_adapter_write(struct event *thread) { - struct mgmt_be_client_adapter *adapter = THREAD_ARG(thread); + struct mgmt_be_client_adapter *adapter = EVENT_ARG(thread); enum mgmt_msg_wsched rv; rv = mgmt_msg_write(&adapter->mstate, adapter->conn_fd, mgmt_debug_be); @@ -662,7 +662,7 @@ static void mgmt_be_adapter_resume_writes(struct event *thread) { struct mgmt_be_client_adapter *adapter; - adapter = (struct mgmt_be_client_adapter *)THREAD_ARG(thread); + adapter = (struct mgmt_be_client_adapter *)EVENT_ARG(thread); assert(adapter && adapter->conn_fd >= 0); mgmt_be_adapter_writes_on(adapter); @@ -699,7 +699,7 @@ static void mgmt_be_adapter_conn_init(struct event *thread) { struct mgmt_be_client_adapter *adapter; - adapter = (struct mgmt_be_client_adapter *)THREAD_ARG(thread); + adapter = (struct mgmt_be_client_adapter *)EVENT_ARG(thread); assert(adapter && adapter->conn_fd >= 0); /* @@ -793,11 +793,11 @@ extern void mgmt_be_adapter_unlock(struct mgmt_be_client_adapter **adapter) (*adapter)->refcount--; if (!(*adapter)->refcount) { mgmt_be_adapters_del(&mgmt_be_adapters, *adapter); - THREAD_OFF((*adapter)->conn_init_ev); - THREAD_OFF((*adapter)->conn_read_ev); - THREAD_OFF((*adapter)->conn_write_ev); - THREAD_OFF((*adapter)->conn_writes_on); - THREAD_OFF((*adapter)->proc_msg_ev); + EVENT_OFF((*adapter)->conn_init_ev); + EVENT_OFF((*adapter)->conn_read_ev); + EVENT_OFF((*adapter)->conn_write_ev); + EVENT_OFF((*adapter)->conn_writes_on); + EVENT_OFF((*adapter)->proc_msg_ev); mgmt_msg_destroy(&(*adapter)->mstate); XFREE(MTYPE_MGMTD_BE_ADPATER, *adapter); } diff --git a/mgmtd/mgmt_be_server.c b/mgmtd/mgmt_be_server.c index 31ac18501..c985e2d0b 100644 --- a/mgmtd/mgmt_be_server.c +++ b/mgmtd/mgmt_be_server.c @@ -146,7 +146,7 @@ void mgmt_be_server_destroy(void) MGMTD_BE_SRVR_DBG("Closing MGMTD Backend Server!"); if (mgmt_be_listen_ev) { - THREAD_OFF(mgmt_be_listen_ev); + EVENT_OFF(mgmt_be_listen_ev); mgmt_be_listen_ev = NULL; } diff --git a/mgmtd/mgmt_fe_adapter.c b/mgmtd/mgmt_fe_adapter.c index 6552222ae..bb0ca4af0 100644 --- a/mgmtd/mgmt_fe_adapter.c +++ b/mgmtd/mgmt_fe_adapter.c @@ -633,7 +633,7 @@ static void mgmt_fe_session_cfg_txn_clnup(struct event *thread) { struct mgmt_fe_session_ctx *session; - session = (struct mgmt_fe_session_ctx *)THREAD_ARG(thread); + session = (struct mgmt_fe_session_ctx *)EVENT_ARG(thread); mgmt_fe_session_cfg_txn_cleanup(session); } @@ -642,7 +642,7 @@ static void mgmt_fe_session_show_txn_clnup(struct event *thread) { struct mgmt_fe_session_ctx *session; - session = (struct mgmt_fe_session_ctx *)THREAD_ARG(thread); + session = (struct mgmt_fe_session_ctx *)EVENT_ARG(thread); mgmt_fe_session_show_txn_cleanup(session); } @@ -1437,7 +1437,7 @@ static void mgmt_fe_adapter_process_msg(void *user_ctx, uint8_t *data, static void mgmt_fe_adapter_proc_msgbufs(struct event *thread) { - struct mgmt_fe_client_adapter *adapter = THREAD_ARG(thread); + struct mgmt_fe_client_adapter *adapter = EVENT_ARG(thread); if (mgmt_msg_procbufs(&adapter->mstate, mgmt_fe_adapter_process_msg, adapter, mgmt_debug_fe)) @@ -1446,7 +1446,7 @@ static void mgmt_fe_adapter_proc_msgbufs(struct event *thread) static void mgmt_fe_adapter_read(struct event *thread) { - struct mgmt_fe_client_adapter *adapter = THREAD_ARG(thread); + struct mgmt_fe_client_adapter *adapter = EVENT_ARG(thread); enum mgmt_msg_rsched rv; rv = mgmt_msg_read(&adapter->mstate, adapter->conn_fd, mgmt_debug_fe); @@ -1461,7 +1461,7 @@ static void mgmt_fe_adapter_read(struct event *thread) static void mgmt_fe_adapter_write(struct event *thread) { - struct mgmt_fe_client_adapter *adapter = THREAD_ARG(thread); + struct mgmt_fe_client_adapter *adapter = EVENT_ARG(thread); enum mgmt_msg_wsched rv; rv = mgmt_msg_write(&adapter->mstate, adapter->conn_fd, mgmt_debug_fe); @@ -1481,7 +1481,7 @@ static void mgmt_fe_adapter_resume_writes(struct event *thread) { struct mgmt_fe_client_adapter *adapter; - adapter = (struct mgmt_fe_client_adapter *)THREAD_ARG(thread); + adapter = (struct mgmt_fe_client_adapter *)EVENT_ARG(thread); assert(adapter && adapter->conn_fd != -1); mgmt_fe_adapter_writes_on(adapter); @@ -1538,10 +1538,10 @@ mgmt_fe_adapter_unlock(struct mgmt_fe_client_adapter **adapter) (*adapter)->refcount--; if (!(*adapter)->refcount) { mgmt_fe_adapters_del(&mgmt_fe_adapters, *adapter); - THREAD_OFF((*adapter)->conn_read_ev); - THREAD_OFF((*adapter)->conn_write_ev); - THREAD_OFF((*adapter)->proc_msg_ev); - THREAD_OFF((*adapter)->conn_writes_on); + EVENT_OFF((*adapter)->conn_read_ev); + EVENT_OFF((*adapter)->conn_write_ev); + EVENT_OFF((*adapter)->proc_msg_ev); + EVENT_OFF((*adapter)->conn_writes_on); mgmt_msg_destroy(&(*adapter)->mstate); XFREE(MTYPE_MGMTD_FE_ADPATER, *adapter); } diff --git a/mgmtd/mgmt_fe_server.c b/mgmtd/mgmt_fe_server.c index 07688c59b..5e5f32cde 100644 --- a/mgmtd/mgmt_fe_server.c +++ b/mgmtd/mgmt_fe_server.c @@ -146,7 +146,7 @@ void mgmt_fe_server_destroy(void) MGMTD_FE_SRVR_DBG("Closing MGMTD Frontend Server!"); if (mgmt_fe_listen_ev) { - THREAD_OFF(mgmt_fe_listen_ev); + EVENT_OFF(mgmt_fe_listen_ev); mgmt_fe_listen_ev = NULL; } diff --git a/mgmtd/mgmt_txn.c b/mgmtd/mgmt_txn.c index 4d4aad292..b0b726b58 100644 --- a/mgmtd/mgmt_txn.c +++ b/mgmtd/mgmt_txn.c @@ -628,7 +628,7 @@ static void mgmt_txn_process_set_cfg(struct event *thread) struct mgmt_commit_stats *cmt_stats; int ret = 0; - txn = (struct mgmt_txn_ctx *)THREAD_ARG(thread); + txn = (struct mgmt_txn_ctx *)EVENT_ARG(thread); assert(txn); cmt_stats = mgmt_fe_get_session_commit_stats(txn->session_id); @@ -780,7 +780,7 @@ static int mgmt_txn_send_commit_cfg_reply(struct mgmt_txn_ctx *txn, if (success) { /* Stop the commit-timeout timer */ - THREAD_OFF(txn->comm_cfg_timeout); + EVENT_OFF(txn->comm_cfg_timeout); create_cmt_info_rec = (result != MGMTD_NO_CFG_CHANGES && @@ -1458,7 +1458,7 @@ static void mgmt_txn_cfg_commit_timedout(struct event *thread) { struct mgmt_txn_ctx *txn; - txn = (struct mgmt_txn_ctx *)THREAD_ARG(thread); + txn = (struct mgmt_txn_ctx *)EVENT_ARG(thread); assert(txn); assert(txn->type == MGMTD_TXN_TYPE_CONFIG); @@ -1549,7 +1549,7 @@ static void mgmt_txn_process_commit_cfg(struct event *thread) struct mgmt_txn_ctx *txn; struct mgmt_commit_cfg_req *cmtcfg_req; - txn = (struct mgmt_txn_ctx *)THREAD_ARG(thread); + txn = (struct mgmt_txn_ctx *)EVENT_ARG(thread); assert(txn); MGMTD_TXN_DBG( @@ -1615,7 +1615,7 @@ static void mgmt_txn_process_commit_cfg(struct event *thread) * cleanup. Please see mgmt_fe_send_commit_cfg_reply() for * more details. */ - THREAD_OFF(txn->comm_cfg_timeout); + EVENT_OFF(txn->comm_cfg_timeout); mgmt_txn_send_commit_cfg_reply(txn, MGMTD_SUCCESS, NULL); break; case MGMTD_COMMIT_PHASE_MAX: @@ -1882,7 +1882,7 @@ static void mgmt_txn_process_get_cfg(struct event *thread) int num_processed = 0; bool error; - txn = (struct mgmt_txn_ctx *)THREAD_ARG(thread); + txn = (struct mgmt_txn_ctx *)EVENT_ARG(thread); assert(txn); MGMTD_TXN_DBG( @@ -1949,7 +1949,7 @@ static void mgmt_txn_process_get_data(struct event *thread) int num_processed = 0; bool error; - txn = (struct mgmt_txn_ctx *)THREAD_ARG(thread); + txn = (struct mgmt_txn_ctx *)EVENT_ARG(thread); assert(txn); MGMTD_TXN_DBG( @@ -2170,10 +2170,10 @@ static void mgmt_txn_unlock(struct mgmt_txn_ctx **txn, const char *file, if ((*txn)->type == MGMTD_TXN_TYPE_CONFIG) if (mgmt_txn_mm->cfg_txn == *txn) mgmt_txn_mm->cfg_txn = NULL; - THREAD_OFF((*txn)->proc_get_cfg); - THREAD_OFF((*txn)->proc_get_data); - THREAD_OFF((*txn)->proc_comm_cfg); - THREAD_OFF((*txn)->comm_cfg_timeout); + EVENT_OFF((*txn)->proc_get_cfg); + EVENT_OFF((*txn)->proc_get_data); + EVENT_OFF((*txn)->proc_comm_cfg); + EVENT_OFF((*txn)->comm_cfg_timeout); hash_release(mgmt_txn_mm->txn_hash, *txn); mgmt_txns_del(&mgmt_txn_mm->txn_list, *txn); @@ -2210,7 +2210,7 @@ static void mgmt_txn_cleanup(struct event *thread) { struct mgmt_txn_ctx *txn; - txn = (struct mgmt_txn_ctx *)THREAD_ARG(thread); + txn = (struct mgmt_txn_ctx *)EVENT_ARG(thread); assert(txn); mgmt_txn_cleanup_txn(&txn); diff --git a/nhrpd/netlink_arp.c b/nhrpd/netlink_arp.c index c929f6680..845d454d1 100644 --- a/nhrpd/netlink_arp.c +++ b/nhrpd/netlink_arp.c @@ -99,7 +99,7 @@ static void netlink_log_indication(struct nlmsghdr *msg, struct zbuf *zb) static void netlink_log_recv(struct event *t) { uint8_t buf[ZNL_BUFFER_SIZE]; - int fd = THREAD_FD(t); + int fd = EVENT_FD(t); struct zbuf payload, zb; struct nlmsghdr *n; diff --git a/nhrpd/nhrp_cache.c b/nhrpd/nhrp_cache.c index 8bc44f947..f41c0afc5 100644 --- a/nhrpd/nhrp_cache.c +++ b/nhrpd/nhrp_cache.c @@ -72,8 +72,8 @@ static void nhrp_cache_free(struct nhrp_cache *c) hash_release(nifp->cache_hash, c); nhrp_peer_unref(c->cur.peer); nhrp_peer_unref(c->new.peer); - THREAD_OFF(c->t_timeout); - THREAD_OFF(c->t_auth); + EVENT_OFF(c->t_timeout); + EVENT_OFF(c->t_auth); XFREE(MTYPE_NHRP_CACHE, c); } @@ -197,7 +197,7 @@ struct nhrp_cache *nhrp_cache_get(struct interface *ifp, static void nhrp_cache_do_free(struct event *t) { - struct nhrp_cache *c = THREAD_ARG(t); + struct nhrp_cache *c = EVENT_ARG(t); c->t_timeout = NULL; nhrp_cache_free(c); @@ -205,7 +205,7 @@ static void nhrp_cache_do_free(struct event *t) static void nhrp_cache_do_timeout(struct event *t) { - struct nhrp_cache *c = THREAD_ARG(t); + struct nhrp_cache *c = EVENT_ARG(t); c->t_timeout = NULL; if (c->cur.type != NHRP_CACHE_INVALID) @@ -310,7 +310,7 @@ static void nhrp_cache_peer_notifier(struct notifier_block *n, static void nhrp_cache_reset_new(struct nhrp_cache *c) { - THREAD_OFF(c->t_auth); + EVENT_OFF(c->t_auth); if (notifier_list_anywhere(&c->newpeer_notifier)) nhrp_peer_notify_del(c->new.peer, &c->newpeer_notifier); nhrp_peer_unref(c->new.peer); @@ -320,7 +320,7 @@ static void nhrp_cache_reset_new(struct nhrp_cache *c) static void nhrp_cache_update_timers(struct nhrp_cache *c) { - THREAD_OFF(c->t_timeout); + EVENT_OFF(c->t_timeout); switch (c->cur.type) { case NHRP_CACHE_INVALID: @@ -397,7 +397,7 @@ static void nhrp_cache_authorize_binding(struct nhrp_reqid *r, void *arg) static void nhrp_cache_do_auth_timeout(struct event *t) { - struct nhrp_cache *c = THREAD_ARG(t); + struct nhrp_cache *c = EVENT_ARG(t); c->t_auth = NULL; nhrp_cache_authorize_binding(&c->eventid, (void *)"timeout"); } diff --git a/nhrpd/nhrp_event.c b/nhrpd/nhrp_event.c index 3bcd42691..59bb62d28 100644 --- a/nhrpd/nhrp_event.c +++ b/nhrpd/nhrp_event.c @@ -31,8 +31,8 @@ static void evmgr_reconnect(struct event *t); static void evmgr_connection_error(struct event_manager *evmgr) { - THREAD_OFF(evmgr->t_read); - THREAD_OFF(evmgr->t_write); + EVENT_OFF(evmgr->t_read); + EVENT_OFF(evmgr->t_write); zbuf_reset(&evmgr->ibuf); zbufq_reset(&evmgr->obuf); @@ -76,7 +76,7 @@ static void evmgr_recv_message(struct event_manager *evmgr, struct zbuf *zb) static void evmgr_read(struct event *t) { - struct event_manager *evmgr = THREAD_ARG(t); + struct event_manager *evmgr = EVENT_ARG(t); struct zbuf *ibuf = &evmgr->ibuf; struct zbuf msg; @@ -94,7 +94,7 @@ static void evmgr_read(struct event *t) static void evmgr_write(struct event *t) { - struct event_manager *evmgr = THREAD_ARG(t); + struct event_manager *evmgr = EVENT_ARG(t); int r; r = zbufq_write(&evmgr->obuf, evmgr->fd); @@ -181,7 +181,7 @@ static void evmgr_submit(struct event_manager *evmgr, struct zbuf *obuf) static void evmgr_reconnect(struct event *t) { - struct event_manager *evmgr = THREAD_ARG(t); + struct event_manager *evmgr = EVENT_ARG(t); int fd; if (evmgr->fd >= 0 || !nhrp_event_socket_path) diff --git a/nhrpd/nhrp_multicast.c b/nhrpd/nhrp_multicast.c index 759dbd1b9..71f27ac21 100644 --- a/nhrpd/nhrp_multicast.c +++ b/nhrpd/nhrp_multicast.c @@ -141,7 +141,7 @@ static void netlink_mcast_log_handler(struct nlmsghdr *msg, struct zbuf *zb) static void netlink_mcast_log_recv(struct event *t) { uint8_t buf[65535]; /* Max OSPF Packet size */ - int fd = THREAD_FD(t); + int fd = EVENT_FD(t); struct zbuf payload, zb; struct nlmsghdr *n; @@ -190,7 +190,7 @@ static void netlink_mcast_log_register(int fd, int group) void netlink_mcast_set_nflog_group(int nlgroup) { if (netlink_mcast_log_fd >= 0) { - THREAD_OFF(netlink_mcast_log_thread); + EVENT_OFF(netlink_mcast_log_thread); close(netlink_mcast_log_fd); netlink_mcast_log_fd = -1; debugf(NHRP_DEBUG_COMMON, "De-register nflog group"); diff --git a/nhrpd/nhrp_nhs.c b/nhrpd/nhrp_nhs.c index 9ffb0c095..063e7bbf8 100644 --- a/nhrpd/nhrp_nhs.c +++ b/nhrpd/nhrp_nhs.c @@ -88,7 +88,7 @@ static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg) /* Success - schedule next registration, and route NHS */ r->timeout = 2; holdtime = nifp->afi[nhs->afi].holdtime; - THREAD_OFF(r->t_register); + EVENT_OFF(r->t_register); /* RFC 2332 5.2.3 - Registration is recommend to be renewed * every one third of holdtime */ @@ -105,7 +105,7 @@ static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg) static void nhrp_reg_timeout(struct event *t) { - struct nhrp_registration *r = THREAD_ARG(t); + struct nhrp_registration *r = EVENT_ARG(t); struct nhrp_cache *c; @@ -148,7 +148,7 @@ static void nhrp_reg_peer_notify(struct notifier_block *n, unsigned long cmd) case NOTIFY_PEER_MTU_CHANGED: debugf(NHRP_DEBUG_COMMON, "NHS: Flush timer for %pSU", &r->peer->vc->remote.nbma); - THREAD_OFF(r->t_register); + EVENT_OFF(r->t_register); event_add_timer_msec(master, nhrp_reg_send_req, r, 10, &r->t_register); break; @@ -157,7 +157,7 @@ static void nhrp_reg_peer_notify(struct notifier_block *n, unsigned long cmd) static void nhrp_reg_send_req(struct event *t) { - struct nhrp_registration *r = THREAD_ARG(t); + struct nhrp_registration *r = EVENT_ARG(t); struct nhrp_nhs *nhs = r->nhs; struct interface *ifp = nhs->ifp; struct nhrp_interface *nifp = ifp->info; @@ -244,7 +244,7 @@ static void nhrp_reg_delete(struct nhrp_registration *r) nhrp_peer_notify_del(r->peer, &r->peer_notifier); nhrp_peer_unref(r->peer); nhrp_reglist_del(&r->nhs->reglist_head, r); - THREAD_OFF(r->t_register); + EVENT_OFF(r->t_register); XFREE(MTYPE_NHRP_REGISTRATION, r); } @@ -311,7 +311,7 @@ static void nhrp_nhs_resolve_cb(struct resolver_query *q, const char *errstr, static void nhrp_nhs_resolve(struct event *t) { - struct nhrp_nhs *nhs = THREAD_ARG(t); + struct nhrp_nhs *nhs = EVENT_ARG(t); resolver_resolve(&nhs->dns_resolve, AF_INET, VRF_DEFAULT, nhs->nbma_fqdn, nhrp_nhs_resolve_cb); @@ -383,7 +383,7 @@ int nhrp_nhs_free(struct nhrp_interface *nifp, afi_t afi, struct nhrp_nhs *nhs) frr_each_safe (nhrp_reglist, &nhs->reglist_head, r) nhrp_reg_delete(r); - THREAD_OFF(nhs->t_resolve); + EVENT_OFF(nhs->t_resolve); nhrp_nhslist_del(&nifp->afi[afi].nhslist_head, nhs); free((void *)nhs->nbma_fqdn); XFREE(MTYPE_NHRP_NHS, nhs); diff --git a/nhrpd/nhrp_packet.c b/nhrpd/nhrp_packet.c index 6502cff51..3366a64b4 100644 --- a/nhrpd/nhrp_packet.c +++ b/nhrpd/nhrp_packet.c @@ -288,7 +288,7 @@ err: static void nhrp_packet_recvraw(struct event *t) { - int fd = THREAD_FD(t), ifindex; + int fd = EVENT_FD(t), ifindex; struct zbuf *zb; struct interface *ifp; struct nhrp_peer *p; diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c index 9ca7b8441..f41a7d314 100644 --- a/nhrpd/nhrp_peer.c +++ b/nhrpd/nhrp_peer.c @@ -43,8 +43,8 @@ static void nhrp_peer_check_delete(struct nhrp_peer *p) debugf(NHRP_DEBUG_COMMON, "Deleting peer ref:%d remote:%pSU local:%pSU", p->ref, &p->vc->remote.nbma, &p->vc->local.nbma); - THREAD_OFF(p->t_fallback); - THREAD_OFF(p->t_timer); + EVENT_OFF(p->t_fallback); + EVENT_OFF(p->t_timer); hash_release(nifp->peer_hash, p); nhrp_interface_notify_del(p->ifp, &p->ifp_notifier); nhrp_vc_notify_del(p->vc, &p->vc_notifier); @@ -53,7 +53,7 @@ static void nhrp_peer_check_delete(struct nhrp_peer *p) static void nhrp_peer_notify_up(struct event *t) { - struct nhrp_peer *p = THREAD_ARG(t); + struct nhrp_peer *p = EVENT_ARG(t); struct nhrp_vc *vc = p->vc; struct interface *ifp = p->ifp; struct nhrp_interface *nifp = ifp->info; @@ -76,7 +76,7 @@ static void __nhrp_peer_check(struct nhrp_peer *p) online = nifp->enabled && (!nifp->ipsec_profile || vc->ipsec); if (p->online != online) { - THREAD_OFF(p->t_fallback); + EVENT_OFF(p->t_fallback); if (online && notifier_active(&p->notifier_list)) { /* If we requested the IPsec connection, delay * the up notification a bit to allow things @@ -250,7 +250,7 @@ void nhrp_peer_unref(struct nhrp_peer *p) static void nhrp_peer_request_timeout(struct event *t) { - struct nhrp_peer *p = THREAD_ARG(t); + struct nhrp_peer *p = EVENT_ARG(t); struct nhrp_vc *vc = p->vc; struct interface *ifp = p->ifp; struct nhrp_interface *nifp = ifp->info; @@ -273,12 +273,12 @@ static void nhrp_peer_request_timeout(struct event *t) static void nhrp_peer_defer_vici_request(struct event *t) { - struct nhrp_peer *p = THREAD_ARG(t); + struct nhrp_peer *p = EVENT_ARG(t); struct nhrp_vc *vc = p->vc; struct interface *ifp = p->ifp; struct nhrp_interface *nifp = ifp->info; - THREAD_OFF(p->t_timer); + EVENT_OFF(p->t_timer); if (p->online) { debugf(NHRP_DEBUG_COMMON, diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c index 838fac752..5a141022d 100644 --- a/nhrpd/nhrp_shortcut.c +++ b/nhrpd/nhrp_shortcut.c @@ -33,7 +33,7 @@ static void nhrp_shortcut_check_use(struct nhrp_shortcut *s) static void nhrp_shortcut_do_expire(struct event *t) { - struct nhrp_shortcut *s = THREAD_ARG(t); + struct nhrp_shortcut *s = EVENT_ARG(t); event_add_timer(master, nhrp_shortcut_do_purge, s, s->holding_time / 3, &s->t_timer); @@ -123,7 +123,7 @@ static void nhrp_shortcut_update_binding(struct nhrp_shortcut *s, s->route_installed = 0; } - THREAD_OFF(s->t_timer); + EVENT_OFF(s->t_timer); if (holding_time) { s->expiring = 0; s->holding_time = holding_time; @@ -137,7 +137,7 @@ static void nhrp_shortcut_delete(struct nhrp_shortcut *s) struct route_node *rn; afi_t afi = family2afi(PREFIX_FAMILY(s->p)); - THREAD_OFF(s->t_timer); + EVENT_OFF(s->t_timer); nhrp_reqid_free(&nhrp_packet_reqid, &s->reqid); debugf(NHRP_DEBUG_ROUTE, "Shortcut %pFX purged", s->p); @@ -156,7 +156,7 @@ static void nhrp_shortcut_delete(struct nhrp_shortcut *s) static void nhrp_shortcut_do_purge(struct event *t) { - struct nhrp_shortcut *s = THREAD_ARG(t); + struct nhrp_shortcut *s = EVENT_ARG(t); s->t_timer = NULL; nhrp_shortcut_delete(s); } @@ -204,7 +204,7 @@ static void nhrp_shortcut_recv_resolution_rep(struct nhrp_reqid *reqid, int holding_time = pp->if_ad->holdtime; nhrp_reqid_free(&nhrp_packet_reqid, &s->reqid); - THREAD_OFF(s->t_timer); + EVENT_OFF(s->t_timer); event_add_timer(master, nhrp_shortcut_do_purge, s, 1, &s->t_timer); if (pp->hdr->type != NHRP_PACKET_RESOLUTION_REPLY) { @@ -454,7 +454,7 @@ void nhrp_shortcut_initiate(union sockunion *addr) s = nhrp_shortcut_get(&p); if (s && s->type != NHRP_CACHE_INCOMPLETE) { s->addr = *addr; - THREAD_OFF(s->t_timer); + EVENT_OFF(s->t_timer); event_add_timer(master, nhrp_shortcut_do_purge, s, 30, &s->t_timer); nhrp_shortcut_send_resolution_req(s); @@ -499,7 +499,7 @@ struct purge_ctx { void nhrp_shortcut_purge(struct nhrp_shortcut *s, int force) { - THREAD_OFF(s->t_timer); + EVENT_OFF(s->t_timer); nhrp_reqid_free(&nhrp_packet_reqid, &s->reqid); if (force) { diff --git a/nhrpd/vici.c b/nhrpd/vici.c index 67a7877b6..c72f3a86f 100644 --- a/nhrpd/vici.c +++ b/nhrpd/vici.c @@ -70,8 +70,8 @@ static void vici_connection_error(struct vici_conn *vici) { nhrp_vc_reset(); - THREAD_OFF(vici->t_read); - THREAD_OFF(vici->t_write); + EVENT_OFF(vici->t_read); + EVENT_OFF(vici->t_write); zbuf_reset(&vici->ibuf); zbufq_reset(&vici->obuf); @@ -359,7 +359,7 @@ static void vici_recv_message(struct vici_conn *vici, struct zbuf *msg) static void vici_read(struct event *t) { - struct vici_conn *vici = THREAD_ARG(t); + struct vici_conn *vici = EVENT_ARG(t); struct zbuf *ibuf = &vici->ibuf; struct zbuf pktbuf; @@ -389,7 +389,7 @@ static void vici_read(struct event *t) static void vici_write(struct event *t) { - struct vici_conn *vici = THREAD_ARG(t); + struct vici_conn *vici = EVENT_ARG(t); int r; r = zbufq_write(&vici->obuf, vici->fd); @@ -502,7 +502,7 @@ static char *vici_get_charon_filepath(void) static void vici_reconnect(struct event *t) { - struct vici_conn *vici = THREAD_ARG(t); + struct vici_conn *vici = EVENT_ARG(t); int fd; char *file_path; diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index e7fefb72a..0a4d3e957 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -421,8 +421,8 @@ void ospf6_area_disable(struct ospf6_area *oa) ospf6_spf_table_finish(oa->spf_table); ospf6_route_remove_all(oa->route_table); - THREAD_OFF(oa->thread_router_lsa); - THREAD_OFF(oa->thread_intra_prefix_lsa); + EVENT_OFF(oa->thread_router_lsa); + EVENT_OFF(oa->thread_intra_prefix_lsa); } diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 81b393f20..57b5fafa9 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -186,7 +186,7 @@ void ospf6_orig_as_external_lsa(struct event *thread) struct ospf6_lsa *lsa; uint32_t type, adv_router; - oi = (struct ospf6_interface *)THREAD_ARG(thread); + oi = (struct ospf6_interface *)EVENT_ARG(thread); if (oi->state == OSPF6_INTERFACE_DOWN) return; @@ -1067,7 +1067,7 @@ static void ospf6_asbr_routemap_unset(struct ospf6_redist *red) static void ospf6_asbr_routemap_update_timer(struct event *thread) { - struct ospf6 *ospf6 = THREAD_ARG(thread); + struct ospf6 *ospf6 = EVENT_ARG(thread); struct ospf6_redist *red; int type; @@ -3022,7 +3022,7 @@ static void ospf6_aggr_handle_external_info(void *data) if (IS_OSPF6_DEBUG_AGGR) zlog_debug("%s: LSA found, refresh it", __func__); - THREAD_OFF(lsa->refresh); + EVENT_OFF(lsa->refresh); event_add_event(master, ospf6_lsa_refresh, lsa, 0, &lsa->refresh); return; @@ -3225,7 +3225,7 @@ static void ospf6_handle_exnl_rt_after_aggr_del(struct ospf6 *ospf6, lsa = ospf6_find_external_lsa(ospf6, &rt->prefix); if (lsa) { - THREAD_OFF(lsa->refresh); + EVENT_OFF(lsa->refresh); event_add_event(master, ospf6_lsa_refresh, lsa, 0, &lsa->refresh); } else { @@ -3333,7 +3333,7 @@ ospf6_handle_external_aggr_add(struct ospf6 *ospf6) static void ospf6_asbr_summary_process(struct event *thread) { - struct ospf6 *ospf6 = THREAD_ARG(thread); + struct ospf6 *ospf6 = EVENT_ARG(thread); int operation = 0; operation = ospf6->aggr_action; @@ -3376,7 +3376,7 @@ ospf6_start_asbr_summary_delay_timer(struct ospf6 *ospf6, if (IS_OSPF6_DEBUG_AGGR) zlog_debug("%s, Restarting Aggregator delay timer.", __func__); - THREAD_OFF(ospf6->t_external_aggr); + EVENT_OFF(ospf6->t_external_aggr); } } diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index bbe3fcd03..1f3c4be4d 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -105,7 +105,7 @@ static void ospf6_bfd_callback(struct bfd_session_params *bsp, if (bss->state == BFD_STATUS_DOWN && bss->previous_state == BFD_STATUS_UP) { - THREAD_OFF(on->inactivity_timer); + EVENT_OFF(on->inactivity_timer); event_add_event(master, inactivity_timer, on, 0, NULL); } } diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c index ddf775d72..9e482e751 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -103,7 +103,7 @@ void ospf6_lsa_originate(struct ospf6 *ospf6, struct ospf6_lsa *lsa) lsdb_self = ospf6_get_scoped_lsdb_self(lsa); ospf6_lsdb_add(ospf6_lsa_copy(lsa), lsdb_self); - THREAD_OFF(lsa->refresh); + EVENT_OFF(lsa->refresh); event_add_timer(master, ospf6_lsa_refresh, lsa, OSPF_LS_REFRESH_TIME, &lsa->refresh); @@ -168,8 +168,8 @@ void ospf6_lsa_purge(struct ospf6_lsa *lsa) self = ospf6_lsdb_lookup(lsa->header->type, lsa->header->id, lsa->header->adv_router, lsdb_self); if (self) { - THREAD_OFF(self->expire); - THREAD_OFF(self->refresh); + EVENT_OFF(self->expire); + EVENT_OFF(self->refresh); ospf6_lsdb_remove(self, lsdb_self); } @@ -250,8 +250,8 @@ void ospf6_install_lsa(struct ospf6_lsa *lsa) lsa->name); lsa->external_lsa_id = old->external_lsa_id; } - THREAD_OFF(old->expire); - THREAD_OFF(old->refresh); + EVENT_OFF(old->expire); + EVENT_OFF(old->refresh); ospf6_flood_clear(old); } @@ -525,7 +525,7 @@ void ospf6_flood_interface(struct ospf6_neighbor *from, struct ospf6_lsa *lsa, } else { /* reschedule retransmissions to all neighbors */ for (ALL_LIST_ELEMENTS(oi->neighbor_list, node, nnode, on)) { - THREAD_OFF(on->thread_send_lsupdate); + EVENT_OFF(on->thread_send_lsupdate); event_add_event(master, ospf6_lsupdate_send_neighbor, on, 0, &on->thread_send_lsupdate); } diff --git a/ospf6d/ospf6_gr.c b/ospf6d/ospf6_gr.c index c79f3de9c..976eb529d 100644 --- a/ospf6d/ospf6_gr.c +++ b/ospf6d/ospf6_gr.c @@ -134,7 +134,7 @@ static void ospf6_gr_restart_exit(struct ospf6 *ospf6, const char *reason) ospf6->gr_info.restart_in_progress = false; ospf6->gr_info.finishing_restart = true; - THREAD_OFF(ospf6->gr_info.t_grace_period); + EVENT_OFF(ospf6->gr_info.t_grace_period); /* Record in non-volatile memory that the restart is complete. */ ospf6_gr_nvm_delete(ospf6); @@ -461,7 +461,7 @@ static bool ospf6_gr_check_adjs(struct ospf6 *ospf6) /* Handling of grace period expiry. */ static void ospf6_gr_grace_period_expired(struct event *thread) { - struct ospf6 *ospf6 = THREAD_ARG(thread); + struct ospf6 *ospf6 = EVENT_ARG(thread); ospf6_gr_restart_exit(ospf6, "grace period has expired"); } diff --git a/ospf6d/ospf6_gr_helper.c b/ospf6d/ospf6_gr_helper.c index 89f6b282b..d313510cf 100644 --- a/ospf6d/ospf6_gr_helper.c +++ b/ospf6d/ospf6_gr_helper.c @@ -197,7 +197,7 @@ static int ospf6_extract_grace_lsa_fields(struct ospf6_lsa *lsa, */ static void ospf6_handle_grace_timer_expiry(struct event *thread) { - struct ospf6_neighbor *nbr = THREAD_ARG(thread); + struct ospf6_neighbor *nbr = EVENT_ARG(thread); ospf6_gr_helper_exit(nbr, OSPF6_GR_HELPER_GRACE_TIMEOUT); } @@ -382,7 +382,7 @@ int ospf6_process_grace_lsa(struct ospf6 *ospf6, struct ospf6_lsa *lsa, } if (OSPF6_GR_IS_ACTIVE_HELPER(restarter)) { - THREAD_OFF(restarter->gr_helper_info.t_grace_timer); + EVENT_OFF(restarter->gr_helper_info.t_grace_timer); if (ospf6->ospf6_helper_cfg.active_restarter_cnt > 0) ospf6->ospf6_helper_cfg.active_restarter_cnt--; @@ -470,7 +470,7 @@ void ospf6_gr_helper_exit(struct ospf6_neighbor *nbr, * expiry, stop the grace timer. */ if (reason != OSPF6_GR_HELPER_GRACE_TIMEOUT) - THREAD_OFF(nbr->gr_helper_info.t_grace_timer); + EVENT_OFF(nbr->gr_helper_info.t_grace_timer); if (ospf6->ospf6_helper_cfg.active_restarter_cnt <= 0) { zlog_err( diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index f195b1710..617a4a235 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -260,11 +260,11 @@ void ospf6_interface_delete(struct ospf6_interface *oi) list_delete(&oi->neighbor_list); - THREAD_OFF(oi->thread_send_hello); - THREAD_OFF(oi->thread_send_lsupdate); - THREAD_OFF(oi->thread_send_lsack); - THREAD_OFF(oi->thread_sso); - THREAD_OFF(oi->thread_wait_timer); + EVENT_OFF(oi->thread_send_hello); + EVENT_OFF(oi->thread_send_lsupdate); + EVENT_OFF(oi->thread_send_lsack); + EVENT_OFF(oi->thread_sso); + EVENT_OFF(oi->thread_wait_timer); ospf6_lsdb_remove_all(oi->lsdb); ospf6_lsdb_remove_all(oi->lsupdate_list); @@ -314,16 +314,16 @@ void ospf6_interface_disable(struct ospf6_interface *oi) ospf6_lsdb_remove_all(oi->lsupdate_list); ospf6_lsdb_remove_all(oi->lsack_list); - THREAD_OFF(oi->thread_send_hello); - THREAD_OFF(oi->thread_send_lsupdate); - THREAD_OFF(oi->thread_send_lsack); - THREAD_OFF(oi->thread_sso); + EVENT_OFF(oi->thread_send_hello); + EVENT_OFF(oi->thread_send_lsupdate); + EVENT_OFF(oi->thread_send_lsack); + EVENT_OFF(oi->thread_sso); - THREAD_OFF(oi->thread_network_lsa); - THREAD_OFF(oi->thread_link_lsa); - THREAD_OFF(oi->thread_intra_prefix_lsa); - THREAD_OFF(oi->thread_as_extern_lsa); - THREAD_OFF(oi->thread_wait_timer); + EVENT_OFF(oi->thread_network_lsa); + EVENT_OFF(oi->thread_link_lsa); + EVENT_OFF(oi->thread_intra_prefix_lsa); + EVENT_OFF(oi->thread_as_extern_lsa); + EVENT_OFF(oi->thread_wait_timer); } static struct in6_addr * @@ -725,7 +725,7 @@ void interface_up(struct event *thread) struct ospf6_interface *oi; struct ospf6 *ospf6; - oi = (struct ospf6_interface *)THREAD_ARG(thread); + oi = (struct ospf6_interface *)EVENT_ARG(thread); assert(oi && oi->interface); if (!oi->type_cfg) @@ -837,7 +837,7 @@ void wait_timer(struct event *thread) { struct ospf6_interface *oi; - oi = (struct ospf6_interface *)THREAD_ARG(thread); + oi = (struct ospf6_interface *)EVENT_ARG(thread); assert(oi && oi->interface); if (IS_OSPF6_DEBUG_INTERFACE) @@ -852,7 +852,7 @@ void backup_seen(struct event *thread) { struct ospf6_interface *oi; - oi = (struct ospf6_interface *)THREAD_ARG(thread); + oi = (struct ospf6_interface *)EVENT_ARG(thread); assert(oi && oi->interface); if (IS_OSPF6_DEBUG_INTERFACE) @@ -867,7 +867,7 @@ void neighbor_change(struct event *thread) { struct ospf6_interface *oi; - oi = (struct ospf6_interface *)THREAD_ARG(thread); + oi = (struct ospf6_interface *)EVENT_ARG(thread); assert(oi && oi->interface); if (IS_OSPF6_DEBUG_INTERFACE) @@ -887,7 +887,7 @@ void interface_down(struct event *thread) struct ospf6_neighbor *on; struct ospf6 *ospf6; - oi = (struct ospf6_interface *)THREAD_ARG(thread); + oi = (struct ospf6_interface *)EVENT_ARG(thread); assert(oi && oi->interface); if (IS_OSPF6_DEBUG_INTERFACE) @@ -895,10 +895,10 @@ void interface_down(struct event *thread) oi->interface->name); /* Stop Hellos */ - THREAD_OFF(oi->thread_send_hello); + EVENT_OFF(oi->thread_send_hello); /* Stop trying to set socket options. */ - THREAD_OFF(oi->thread_sso); + EVENT_OFF(oi->thread_sso); /* Cease the HELPER role for all the neighbours * of this interface. @@ -1876,7 +1876,7 @@ DEFUN (ipv6_ospf6_ifmtu, /* re-establish adjacencies */ for (ALL_LIST_ELEMENTS(oi->neighbor_list, node, nnode, on)) { - THREAD_OFF(on->inactivity_timer); + EVENT_OFF(on->inactivity_timer); event_add_event(master, inactivity_timer, on, 0, NULL); } @@ -1922,7 +1922,7 @@ DEFUN (no_ipv6_ospf6_ifmtu, /* re-establish adjacencies */ for (ALL_LIST_ELEMENTS(oi->neighbor_list, node, nnode, on)) { - THREAD_OFF(on->inactivity_timer); + EVENT_OFF(on->inactivity_timer); event_add_event(master, inactivity_timer, on, 0, NULL); } @@ -2106,7 +2106,7 @@ DEFUN (ipv6_ospf6_hellointerval, * If the thread is scheduled, send the new hello now. */ if (event_is_scheduled(oi->thread_send_hello)) { - THREAD_OFF(oi->thread_send_hello); + EVENT_OFF(oi->thread_send_hello); event_add_timer(master, ospf6_hello_send, oi, 0, &oi->thread_send_hello); @@ -2322,11 +2322,11 @@ DEFUN (ipv6_ospf6_passive, assert(oi); SET_FLAG(oi->flag, OSPF6_INTERFACE_PASSIVE); - THREAD_OFF(oi->thread_send_hello); - THREAD_OFF(oi->thread_sso); + EVENT_OFF(oi->thread_send_hello); + EVENT_OFF(oi->thread_sso); for (ALL_LIST_ELEMENTS(oi->neighbor_list, node, nnode, on)) { - THREAD_OFF(on->inactivity_timer); + EVENT_OFF(on->inactivity_timer); event_add_event(master, inactivity_timer, on, 0, NULL); } @@ -2352,8 +2352,8 @@ DEFUN (no_ipv6_ospf6_passive, assert(oi); UNSET_FLAG(oi->flag, OSPF6_INTERFACE_PASSIVE); - THREAD_OFF(oi->thread_send_hello); - THREAD_OFF(oi->thread_sso); + EVENT_OFF(oi->thread_send_hello); + EVENT_OFF(oi->thread_sso); /* don't send hellos over loopback interface */ if (!if_is_loopback(oi->interface)) diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 821ace89e..a8c12f8a5 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -228,7 +228,7 @@ void ospf6_router_lsa_originate(struct event *thread) uint32_t router; int count; - oa = (struct ospf6_area *)THREAD_ARG(thread); + oa = (struct ospf6_area *)EVENT_ARG(thread); if (oa->ospf6->gr_info.restart_in_progress) { if (IS_DEBUG_OSPF6_GR) @@ -510,7 +510,7 @@ void ospf6_network_lsa_originate(struct event *thread) struct listnode *i; uint16_t type; - oi = (struct ospf6_interface *)THREAD_ARG(thread); + oi = (struct ospf6_interface *)EVENT_ARG(thread); /* The interface must be enabled until here. A Network-LSA of a disabled interface (but was once enabled) should be flushed @@ -758,7 +758,7 @@ void ospf6_link_lsa_originate(struct event *thread) struct ospf6_route *route; struct ospf6_prefix *op; - oi = (struct ospf6_interface *)THREAD_ARG(thread); + oi = (struct ospf6_interface *)EVENT_ARG(thread); assert(oi->area); @@ -1001,7 +1001,7 @@ void ospf6_intra_prefix_lsa_originate_stub(struct event *thread) struct ospf6_route_table *route_advertise; int ls_id = 0; - oa = (struct ospf6_area *)THREAD_ARG(thread); + oa = (struct ospf6_area *)EVENT_ARG(thread); if (oa->ospf6->gr_info.restart_in_progress) { if (IS_DEBUG_OSPF6_GR) @@ -1237,7 +1237,7 @@ void ospf6_intra_prefix_lsa_originate_transit(struct event *thread) char *start, *end, *current; uint16_t type; - oi = (struct ospf6_interface *)THREAD_ARG(thread); + oi = (struct ospf6_interface *)EVENT_ARG(thread); assert(oi->area); diff --git a/ospf6d/ospf6_intra.h b/ospf6d/ospf6_intra.h index 62e877eb5..0f286f0ab 100644 --- a/ospf6d/ospf6_intra.h +++ b/ospf6d/ospf6_intra.h @@ -186,7 +186,7 @@ struct ospf6_intra_prefix_lsa { #define OSPF6_NETWORK_LSA_EXECUTE(oi) \ do { \ - THREAD_OFF((oi)->thread_network_lsa); \ + EVENT_OFF((oi)->thread_network_lsa); \ event_execute(master, ospf6_network_lsa_originate, oi, 0); \ } while (0) @@ -199,7 +199,7 @@ struct ospf6_intra_prefix_lsa { #define OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT(oi) \ do { \ - THREAD_OFF((oi)->thread_intra_prefix_lsa); \ + EVENT_OFF((oi)->thread_intra_prefix_lsa); \ event_execute(master, \ ospf6_intra_prefix_lsa_originate_transit, oi, \ 0); \ @@ -207,7 +207,7 @@ struct ospf6_intra_prefix_lsa { #define OSPF6_AS_EXTERN_LSA_EXECUTE(oi) \ do { \ - THREAD_OFF((oi)->thread_as_extern_lsa); \ + EVENT_OFF((oi)->thread_as_extern_lsa); \ event_execute(master, ospf6_orig_as_external_lsa, oi, 0); \ } while (0) diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index be0cc3442..708aaec89 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -302,8 +302,8 @@ void ospf6_lsa_premature_aging(struct ospf6_lsa *lsa) if (IS_OSPF6_DEBUG_LSA_TYPE(lsa->header->type)) zlog_debug("LSA: Premature aging: %s", lsa->name); - THREAD_OFF(lsa->expire); - THREAD_OFF(lsa->refresh); + EVENT_OFF(lsa->expire); + EVENT_OFF(lsa->refresh); /* * We clear the LSA from the neighbor retx lists now because it @@ -760,8 +760,8 @@ void ospf6_lsa_delete(struct ospf6_lsa *lsa) assert(lsa->lock == 0); /* cancel threads */ - THREAD_OFF(lsa->expire); - THREAD_OFF(lsa->refresh); + EVENT_OFF(lsa->expire); + EVENT_OFF(lsa->refresh); /* do free */ XFREE(MTYPE_OSPF6_LSA_HEADER, lsa->header); @@ -817,7 +817,7 @@ void ospf6_lsa_expire(struct event *thread) struct ospf6_lsa *lsa; struct ospf6 *ospf6; - lsa = (struct ospf6_lsa *)THREAD_ARG(thread); + lsa = (struct ospf6_lsa *)EVENT_ARG(thread); assert(lsa && lsa->header); assert(OSPF6_LSA_IS_MAXAGE(lsa)); @@ -850,7 +850,7 @@ void ospf6_lsa_refresh(struct event *thread) struct ospf6_lsa *old, *self, *new; struct ospf6_lsdb *lsdb_self; - old = (struct ospf6_lsa *)THREAD_ARG(thread); + old = (struct ospf6_lsa *)EVENT_ARG(thread); assert(old && old->header); old->refresh = (struct event *)NULL; diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c index 817949f01..7925a8b2f 100644 --- a/ospf6d/ospf6_lsdb.c +++ b/ospf6d/ospf6_lsdb.c @@ -395,7 +395,7 @@ int ospf6_lsdb_maxage_remover(struct ospf6_lsdb *lsdb) htonl(OSPF_MAX_SEQUENCE_NUMBER + 1); ospf6_lsa_checksum(lsa->header); - THREAD_OFF(lsa->refresh); + EVENT_OFF(lsa->refresh); event_execute(master, ospf6_lsa_refresh, lsa, 0); } else { zlog_debug("calling ospf6_lsdb_remove %s", lsa->name); diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 99c33facc..69ac2f3b6 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -790,7 +790,7 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh, event_add_event(master, ospf6_lsreq_send, on, 0, &on->thread_send_lsreq); - THREAD_OFF(on->thread_send_dbdesc); + EVENT_OFF(on->thread_send_dbdesc); /* More bit check */ if (!CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_MBIT) @@ -875,7 +875,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh, if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR)) zlog_debug( "Duplicated dbdesc causes retransmit"); - THREAD_OFF(on->thread_send_dbdesc); + EVENT_OFF(on->thread_send_dbdesc); event_add_event(master, ospf6_dbdesc_send, on, 0, &on->thread_send_dbdesc); return; @@ -928,7 +928,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh, if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR)) zlog_debug( "Duplicated dbdesc causes retransmit"); - THREAD_OFF(on->thread_send_dbdesc); + EVENT_OFF(on->thread_send_dbdesc); event_add_event(master, ospf6_dbdesc_send, on, 0, &on->thread_send_dbdesc); return; @@ -1002,7 +1002,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh, event_add_event(master, ospf6_lsreq_send, on, 0, &on->thread_send_lsreq); - THREAD_OFF(on->thread_send_dbdesc); + EVENT_OFF(on->thread_send_dbdesc); event_add_event(master, ospf6_dbdesc_send_newone, on, 0, &on->thread_send_dbdesc); @@ -1136,7 +1136,7 @@ static void ospf6_lsreq_recv(struct in6_addr *src, struct in6_addr *dst, assert(p == OSPF6_MESSAGE_END(oh)); /* schedule send lsupdate */ - THREAD_OFF(on->thread_send_lsupdate); + EVENT_OFF(on->thread_send_lsupdate); event_add_event(master, ospf6_lsupdate_send_neighbor, on, 0, &on->thread_send_lsupdate); } @@ -1914,8 +1914,8 @@ void ospf6_receive(struct event *thread) int count = 0; /* add next read thread */ - ospf6 = THREAD_ARG(thread); - sockfd = THREAD_FD(thread); + ospf6 = EVENT_ARG(thread); + sockfd = EVENT_FD(thread); event_add_read(master, ospf6_receive, ospf6, ospf6->fd, &ospf6->t_ospf6_receive); @@ -2084,7 +2084,7 @@ static uint16_t ospf6_make_hello(struct ospf6_interface *oi, struct stream *s) static void ospf6_write(struct event *thread) { - struct ospf6 *ospf6 = THREAD_ARG(thread); + struct ospf6 *ospf6 = EVENT_ARG(thread); struct ospf6_interface *oi; struct ospf6_header *oh; struct ospf6_packet *op; @@ -2242,7 +2242,7 @@ void ospf6_hello_send(struct event *thread) struct ospf6_packet *op; uint16_t length = OSPF6_HEADER_SIZE; - oi = (struct ospf6_interface *)THREAD_ARG(thread); + oi = (struct ospf6_interface *)EVENT_ARG(thread); if (oi->state <= OSPF6_INTERFACE_DOWN) { if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_HELLO, SEND_HDR)) @@ -2339,7 +2339,7 @@ void ospf6_dbdesc_send(struct event *thread) uint16_t length = OSPF6_HEADER_SIZE; struct ospf6_packet *op; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); if (on->state < OSPF6_NEIGHBOR_EXSTART) { if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_DBDESC, SEND)) @@ -2382,7 +2382,7 @@ void ospf6_dbdesc_send_newone(struct event *thread) struct ospf6_lsa *lsa, *lsanext; unsigned int size = 0; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); ospf6_lsdb_remove_all(on->dbdesc_list); /* move LSAs from summary_list to dbdesc_list (within neighbor @@ -2504,7 +2504,7 @@ void ospf6_lsreq_send(struct event *thread) struct ospf6_packet *op; uint16_t length = OSPF6_HEADER_SIZE; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); /* LSReq will be sent only in ExStart or Loading */ if (on->state != OSPF6_NEIGHBOR_EXCHANGE @@ -2683,7 +2683,7 @@ void ospf6_lsupdate_send_neighbor(struct event *thread) uint16_t length = OSPF6_HEADER_SIZE; int lsa_cnt = 0; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE, SEND_HDR)) zlog_debug("LSUpdate to neighbor %s", on->name); @@ -2818,7 +2818,7 @@ void ospf6_lsupdate_send_interface(struct event *thread) uint16_t length = OSPF6_HEADER_SIZE; int lsa_cnt = 0; - oi = (struct ospf6_interface *)THREAD_ARG(thread); + oi = (struct ospf6_interface *)EVENT_ARG(thread); if (oi->state <= OSPF6_INTERFACE_WAITING) { if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSUPDATE, @@ -2858,7 +2858,7 @@ void ospf6_lsack_send_neighbor(struct event *thread) struct ospf6_packet *op; uint16_t length = OSPF6_HEADER_SIZE; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); if (on->state < OSPF6_NEIGHBOR_EXCHANGE) { if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSACK, SEND_HDR)) @@ -2909,7 +2909,7 @@ static uint16_t ospf6_make_lsack_interface(struct ospf6_interface *oi, > ospf6_packet_max(oi)) { /* if we run out of packet size/space here, better to try again soon. */ - THREAD_OFF(oi->thread_send_lsack); + EVENT_OFF(oi->thread_send_lsack); event_add_event(master, ospf6_lsack_send_interface, oi, 0, &oi->thread_send_lsack); @@ -2934,7 +2934,7 @@ void ospf6_lsack_send_interface(struct event *thread) struct ospf6_packet *op; uint16_t length = OSPF6_HEADER_SIZE; - oi = (struct ospf6_interface *)THREAD_ARG(thread); + oi = (struct ospf6_interface *)EVENT_ARG(thread); if (oi->state <= OSPF6_INTERFACE_WAITING) { if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_LSACK, SEND_HDR)) diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 5af69738c..00d3a8530 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -163,18 +163,18 @@ void ospf6_neighbor_delete(struct ospf6_neighbor *on) ospf6_lsdb_delete(on->lsupdate_list); ospf6_lsdb_delete(on->lsack_list); - THREAD_OFF(on->inactivity_timer); + EVENT_OFF(on->inactivity_timer); - THREAD_OFF(on->last_dbdesc_release_timer); + EVENT_OFF(on->last_dbdesc_release_timer); - THREAD_OFF(on->thread_send_dbdesc); - THREAD_OFF(on->thread_send_lsreq); - THREAD_OFF(on->thread_send_lsupdate); - THREAD_OFF(on->thread_send_lsack); - THREAD_OFF(on->thread_exchange_done); - THREAD_OFF(on->thread_adj_ok); + EVENT_OFF(on->thread_send_dbdesc); + EVENT_OFF(on->thread_send_lsreq); + EVENT_OFF(on->thread_send_lsupdate); + EVENT_OFF(on->thread_send_lsack); + EVENT_OFF(on->thread_exchange_done); + EVENT_OFF(on->thread_adj_ok); - THREAD_OFF(on->gr_helper_info.t_grace_timer); + EVENT_OFF(on->gr_helper_info.t_grace_timer); bfd_sess_free(&on->bfd_session); XFREE(MTYPE_OSPF6_NEIGHBOR, on); @@ -276,14 +276,14 @@ void hello_received(struct event *thread) { struct ospf6_neighbor *on; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); assert(on); if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) zlog_debug("Neighbor Event %s: *HelloReceived*", on->name); /* reset Inactivity Timer */ - THREAD_OFF(on->inactivity_timer); + EVENT_OFF(on->inactivity_timer); event_add_timer(master, inactivity_timer, on, on->ospf6_if->dead_interval, &on->inactivity_timer); @@ -296,7 +296,7 @@ void twoway_received(struct event *thread) { struct ospf6_neighbor *on; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); assert(on); if (on->state > OSPF6_NEIGHBOR_INIT) @@ -319,7 +319,7 @@ void twoway_received(struct event *thread) SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT); SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT); - THREAD_OFF(on->thread_send_dbdesc); + EVENT_OFF(on->thread_send_dbdesc); event_add_event(master, ospf6_dbdesc_send, on, 0, &on->thread_send_dbdesc); } @@ -329,7 +329,7 @@ void negotiation_done(struct event *thread) struct ospf6_neighbor *on; struct ospf6_lsa *lsa, *lsanext; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); assert(on); if (on->state != OSPF6_NEIGHBOR_EXSTART) @@ -375,7 +375,7 @@ void negotiation_done(struct event *thread) static void ospf6_neighbor_last_dbdesc_release(struct event *thread) { - struct ospf6_neighbor *on = THREAD_ARG(thread); + struct ospf6_neighbor *on = EVENT_ARG(thread); assert(on); memset(&on->dbdesc_last, 0, sizeof(struct ospf6_dbdesc)); @@ -385,7 +385,7 @@ void exchange_done(struct event *thread) { struct ospf6_neighbor *on; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); assert(on); if (on->state != OSPF6_NEIGHBOR_EXCHANGE) @@ -394,12 +394,12 @@ void exchange_done(struct event *thread) if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) zlog_debug("Neighbor Event %s: *ExchangeDone*", on->name); - THREAD_OFF(on->thread_send_dbdesc); + EVENT_OFF(on->thread_send_dbdesc); ospf6_lsdb_remove_all(on->dbdesc_list); /* RFC 2328 (10.8): Release the last dbdesc after dead_interval */ if (!CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT)) { - THREAD_OFF(on->last_dbdesc_release_timer); + EVENT_OFF(on->last_dbdesc_release_timer); event_add_timer(master, ospf6_neighbor_last_dbdesc_release, on, on->ospf6_if->dead_interval, &on->last_dbdesc_release_timer); @@ -430,7 +430,7 @@ void ospf6_check_nbr_loading(struct ospf6_neighbor *on) if (on->request_list->count == 0) event_add_event(master, loading_done, on, 0, NULL); else if (on->last_ls_req == NULL) { - THREAD_OFF(on->thread_send_lsreq); + EVENT_OFF(on->thread_send_lsreq); event_add_event(master, ospf6_lsreq_send, on, 0, &on->thread_send_lsreq); } @@ -441,7 +441,7 @@ void loading_done(struct event *thread) { struct ospf6_neighbor *on; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); assert(on); if (on->state != OSPF6_NEIGHBOR_LOADING) @@ -460,7 +460,7 @@ void adj_ok(struct event *thread) { struct ospf6_neighbor *on; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); assert(on); if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) @@ -473,7 +473,7 @@ void adj_ok(struct event *thread) SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT); SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT); - THREAD_OFF(on->thread_send_dbdesc); + EVENT_OFF(on->thread_send_dbdesc); event_add_event(master, ospf6_dbdesc_send, on, 0, &on->thread_send_dbdesc); @@ -488,7 +488,7 @@ void seqnumber_mismatch(struct event *thread) { struct ospf6_neighbor *on; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); assert(on); if (on->state < OSPF6_NEIGHBOR_EXCHANGE) @@ -505,7 +505,7 @@ void seqnumber_mismatch(struct event *thread) ospf6_neighbor_clear_ls_lists(on); - THREAD_OFF(on->thread_send_dbdesc); + EVENT_OFF(on->thread_send_dbdesc); on->dbdesc_seqnum++; /* Incr seqnum as per RFC2328, sec 10.3 */ event_add_event(master, ospf6_dbdesc_send, on, 0, @@ -516,7 +516,7 @@ void bad_lsreq(struct event *thread) { struct ospf6_neighbor *on; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); assert(on); if (on->state < OSPF6_NEIGHBOR_EXCHANGE) @@ -533,7 +533,7 @@ void bad_lsreq(struct event *thread) ospf6_neighbor_clear_ls_lists(on); - THREAD_OFF(on->thread_send_dbdesc); + EVENT_OFF(on->thread_send_dbdesc); on->dbdesc_seqnum++; /* Incr seqnum as per RFC2328, sec 10.3 */ event_add_event(master, ospf6_dbdesc_send, on, 0, @@ -544,7 +544,7 @@ void oneway_received(struct event *thread) { struct ospf6_neighbor *on; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); assert(on); if (on->state < OSPF6_NEIGHBOR_TWOWAY) @@ -559,19 +559,19 @@ void oneway_received(struct event *thread) ospf6_neighbor_clear_ls_lists(on); - THREAD_OFF(on->thread_send_dbdesc); - THREAD_OFF(on->thread_send_lsreq); - THREAD_OFF(on->thread_send_lsupdate); - THREAD_OFF(on->thread_send_lsack); - THREAD_OFF(on->thread_exchange_done); - THREAD_OFF(on->thread_adj_ok); + EVENT_OFF(on->thread_send_dbdesc); + EVENT_OFF(on->thread_send_lsreq); + EVENT_OFF(on->thread_send_lsupdate); + EVENT_OFF(on->thread_send_lsack); + EVENT_OFF(on->thread_exchange_done); + EVENT_OFF(on->thread_adj_ok); } void inactivity_timer(struct event *thread) { struct ospf6_neighbor *on; - on = (struct ospf6_neighbor *)THREAD_ARG(thread); + on = (struct ospf6_neighbor *)EVENT_ARG(thread); assert(on); if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) diff --git a/ospf6d/ospf6_nssa.c b/ospf6d/ospf6_nssa.c index 15fcab13f..7ff0a0932 100644 --- a/ospf6d/ospf6_nssa.c +++ b/ospf6d/ospf6_nssa.c @@ -978,7 +978,7 @@ int ospf6_redistribute_check(struct ospf6 *ospf6, struct ospf6_route *route, /* This function performs ABR related processing */ static void ospf6_abr_task_timer(struct event *thread) { - struct ospf6 *ospf6 = THREAD_ARG(thread); + struct ospf6 *ospf6 = EVENT_ARG(thread); if (IS_OSPF6_DEBUG_ABR) zlog_debug("Running ABR task on timer"); @@ -1089,7 +1089,7 @@ static void ospf6_ase_lsa_refresh(struct ospf6 *o) route->path.origin.id, o->router_id, o->lsdb); if (old) { - THREAD_OFF(old->refresh); + EVENT_OFF(old->refresh); event_add_event(master, ospf6_lsa_refresh, old, 0, &old->refresh); } else { @@ -1164,7 +1164,7 @@ void ospf6_area_nssa_update(struct ospf6_area *area) lsa)) { if (IS_OSPF6_DEBUG_NSSA) ospf6_lsa_header_print(lsa); - THREAD_OFF(lsa->refresh); + EVENT_OFF(lsa->refresh); event_add_event(master, ospf6_lsa_refresh, lsa, 0, &lsa->refresh); } diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index b8d5bfef6..885595511 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -599,7 +599,7 @@ static void ospf6_spf_calculation_thread(struct event *t) int areas_processed = 0; char rbuf[32]; - ospf6 = (struct ospf6 *)THREAD_ARG(t); + ospf6 = (struct ospf6 *)EVENT_ARG(t); /* execute SPF calculation */ monotime(&start); @@ -724,7 +724,7 @@ void ospf6_spf_schedule(struct ospf6 *ospf6, unsigned int reason) if (IS_OSPF6_DEBUG_SPF(PROCESS) || IS_OSPF6_DEBUG_SPF(TIME)) zlog_debug("SPF: Rescheduling in %ld msec", delay); - THREAD_OFF(ospf6->t_spf_calc); + EVENT_OFF(ospf6->t_spf_calc); event_add_timer_msec(master, ospf6_spf_calculation_thread, ospf6, delay, &ospf6->t_spf_calc); } @@ -1236,7 +1236,7 @@ static void ospf6_ase_calculate_timer(struct event *t) struct ospf6_area *area; uint16_t type; - ospf6 = THREAD_ARG(t); + ospf6 = EVENT_ARG(t); /* Calculate external route for each AS-external-LSA */ type = htons(OSPF6_LSTYPE_AS_EXTERNAL); diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 54f4d854d..5ad79711e 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -552,15 +552,15 @@ static void ospf6_disable(struct ospf6 *o) ospf6_route_remove_all(o->route_table); ospf6_route_remove_all(o->brouter_table); - THREAD_OFF(o->maxage_remover); - THREAD_OFF(o->t_spf_calc); - THREAD_OFF(o->t_ase_calc); - THREAD_OFF(o->t_distribute_update); - THREAD_OFF(o->t_ospf6_receive); - THREAD_OFF(o->t_external_aggr); - THREAD_OFF(o->gr_info.t_grace_period); - THREAD_OFF(o->t_write); - THREAD_OFF(o->t_abr_task); + EVENT_OFF(o->maxage_remover); + EVENT_OFF(o->t_spf_calc); + EVENT_OFF(o->t_ase_calc); + EVENT_OFF(o->t_distribute_update); + EVENT_OFF(o->t_ospf6_receive); + EVENT_OFF(o->t_external_aggr); + EVENT_OFF(o->gr_info.t_grace_period); + EVENT_OFF(o->t_write); + EVENT_OFF(o->t_abr_task); } } @@ -575,7 +575,7 @@ void ospf6_master_init(struct event_master *master) static void ospf6_maxage_remover(struct event *thread) { - struct ospf6 *o = (struct ospf6 *)THREAD_ARG(thread); + struct ospf6 *o = (struct ospf6 *)EVENT_ARG(thread); struct ospf6_area *oa; struct ospf6_interface *oi; struct ospf6_neighbor *on; diff --git a/ospfclient/ospfclient.c b/ospfclient/ospfclient.c index e9f5b82d1..d3ba642d7 100644 --- a/ospfclient/ospfclient.c +++ b/ospfclient/ospfclient.c @@ -75,7 +75,7 @@ static void lsa_delete(struct event *t) struct in_addr area_id; int rc; - oclient = THREAD_ARG(t); + oclient = EVENT_ARG(t); rc = inet_aton(args[6], &area_id); if (rc <= 0) { @@ -106,7 +106,7 @@ static void lsa_inject(struct event *t) static uint32_t counter = 1; /* Incremented each time invoked */ int rc; - cl = THREAD_ARG(t); + cl = EVENT_ARG(t); rc = inet_aton(args[5], &ifaddr); if (rc <= 0) { @@ -146,8 +146,8 @@ static void lsa_read(struct event *thread) printf("lsa_read called\n"); - oclient = THREAD_ARG(thread); - fd = THREAD_FD(thread); + oclient = EVENT_ARG(thread); + fd = EVENT_FD(thread); /* Handle asynchronous message */ ret = ospf_apiclient_handle_async(oclient); diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index a00e58b2f..3cb65961d 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -1731,9 +1731,9 @@ static void ospf_abr_announce_non_dna_routers(struct event *thread) { struct ospf_area *area; struct listnode *node; - struct ospf *ospf = THREAD_ARG(thread); + struct ospf *ospf = EVENT_ARG(thread); - THREAD_OFF(ospf->t_abr_fr); + EVENT_OFF(ospf->t_abr_fr); if (!IS_OSPF_ABR(ospf)) return; @@ -2058,7 +2058,7 @@ void ospf_abr_task(struct ospf *ospf) static void ospf_abr_task_timer(struct event *thread) { - struct ospf *ospf = THREAD_ARG(thread); + struct ospf *ospf = EVENT_ARG(thread); ospf->t_abr_task = 0; diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c index 7051acc32..2c154e8d0 100644 --- a/ospfd/ospf_apiserver.c +++ b/ospfd/ospf_apiserver.c @@ -312,12 +312,12 @@ void ospf_apiserver_free(struct ospf_apiserver *apiserv) struct listnode *node; /* Cancel read and write threads. */ - THREAD_OFF(apiserv->t_sync_read); + EVENT_OFF(apiserv->t_sync_read); #ifdef USE_ASYNC_READ - THREAD_OFF(apiserv->t_async_read); + EVENT_OFF(apiserv->t_async_read); #endif /* USE_ASYNC_READ */ - THREAD_OFF(apiserv->t_sync_write); - THREAD_OFF(apiserv->t_async_write); + EVENT_OFF(apiserv->t_sync_write); + EVENT_OFF(apiserv->t_async_write); /* Unregister all opaque types that application registered and flush opaque LSAs if still in LSDB. */ @@ -367,8 +367,8 @@ void ospf_apiserver_read(struct event *thread) int fd; enum ospf_apiserver_event event; - apiserv = THREAD_ARG(thread); - fd = THREAD_FD(thread); + apiserv = EVENT_ARG(thread); + fd = EVENT_FD(thread); if (fd == apiserv->fd_sync) { event = OSPF_APISERVER_SYNC_READ; @@ -426,9 +426,9 @@ void ospf_apiserver_sync_write(struct event *thread) int fd; int rc = -1; - apiserv = THREAD_ARG(thread); + apiserv = EVENT_ARG(thread); assert(apiserv); - fd = THREAD_FD(thread); + fd = EVENT_FD(thread); apiserv->t_sync_write = NULL; @@ -486,9 +486,9 @@ void ospf_apiserver_async_write(struct event *thread) int fd; int rc = -1; - apiserv = THREAD_ARG(thread); + apiserv = EVENT_ARG(thread); assert(apiserv); - fd = THREAD_FD(thread); + fd = EVENT_FD(thread); apiserv->t_async_write = NULL; @@ -589,8 +589,8 @@ void ospf_apiserver_accept(struct event *thread) unsigned int peerlen; int ret; - /* THREAD_ARG (thread) is NULL */ - accept_sock = THREAD_FD(thread); + /* EVENT_ARG (thread) is NULL */ + accept_sock = EVENT_FD(thread); /* Keep hearing on socket for further connections. */ ospf_apiserver_event(OSPF_APISERVER_ACCEPT, accept_sock, NULL); diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c index c9228c4eb..a7e2f7319 100644 --- a/ospfd/ospf_asbr.c +++ b/ospfd/ospf_asbr.c @@ -266,7 +266,7 @@ void ospf_asbr_status_update(struct ospf *ospf, uint8_t status) */ static void ospf_asbr_nssa_redist_update_timer(struct event *thread) { - struct ospf *ospf = THREAD_ARG(thread); + struct ospf *ospf = EVENT_ARG(thread); int type; ospf->t_asbr_nssa_redist_update = NULL; @@ -1042,7 +1042,7 @@ static void ospf_handle_external_aggr_update(struct ospf *ospf) static void ospf_asbr_external_aggr_process(struct event *thread) { - struct ospf *ospf = THREAD_ARG(thread); + struct ospf *ospf = EVENT_ARG(thread); int operation = 0; ospf->t_external_aggr = NULL; @@ -1084,7 +1084,7 @@ static void ospf_external_aggr_timer(struct ospf *ospf, zlog_debug( "%s, Restarting Aggregator delay timer.", __func__); - THREAD_OFF(ospf->t_external_aggr); + EVENT_OFF(ospf->t_external_aggr); } } diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c index 9ad3d276d..ea2388a3a 100644 --- a/ospfd/ospf_ase.c +++ b/ospfd/ospf_ase.c @@ -558,7 +558,7 @@ static void ospf_ase_calculate_timer(struct event *t) struct ospf_area *area; struct timeval start_time, stop_time; - ospf = THREAD_ARG(t); + ospf = EVENT_ARG(t); ospf->t_ase_calc = NULL; if (ospf->ase_calc) { diff --git a/ospfd/ospf_gr.c b/ospfd/ospf_gr.c index 087069901..f60f0e863 100644 --- a/ospfd/ospf_gr.c +++ b/ospfd/ospf_gr.c @@ -201,7 +201,7 @@ static void ospf_gr_restart_exit(struct ospf *ospf, const char *reason) zlog_debug("GR: exiting graceful restart: %s", reason); ospf->gr_info.restart_in_progress = false; - THREAD_OFF(ospf->gr_info.t_grace_period); + EVENT_OFF(ospf->gr_info.t_grace_period); /* Record in non-volatile memory that the restart is complete. */ ospf_gr_nvm_delete(ospf); @@ -497,7 +497,7 @@ void ospf_gr_check_adjs(struct ospf *ospf) /* Handling of grace period expiry. */ static void ospf_gr_grace_period_expired(struct event *thread) { - struct ospf *ospf = THREAD_ARG(thread); + struct ospf *ospf = EVENT_ARG(thread); ospf->gr_info.t_grace_period = NULL; ospf_gr_restart_exit(ospf, "grace period has expired"); diff --git a/ospfd/ospf_gr_helper.c b/ospfd/ospf_gr_helper.c index 13ae3d9df..33b351d82 100644 --- a/ospfd/ospf_gr_helper.c +++ b/ospfd/ospf_gr_helper.c @@ -331,7 +331,7 @@ static int ospf_extract_grace_lsa_fields(struct ospf_lsa *lsa, */ static void ospf_handle_grace_timer_expiry(struct event *thread) { - struct ospf_neighbor *nbr = THREAD_ARG(thread); + struct ospf_neighbor *nbr = EVENT_ARG(thread); nbr->gr_helper_info.t_grace_timer = NULL; @@ -500,7 +500,7 @@ int ospf_process_grace_lsa(struct ospf *ospf, struct ospf_lsa *lsa, if (OSPF_GR_IS_ACTIVE_HELPER(restarter)) { if (restarter->gr_helper_info.t_grace_timer) - THREAD_OFF(restarter->gr_helper_info.t_grace_timer); + EVENT_OFF(restarter->gr_helper_info.t_grace_timer); if (ospf->active_restarter_cnt > 0) ospf->active_restarter_cnt--; @@ -699,7 +699,7 @@ void ospf_gr_helper_exit(struct ospf_neighbor *nbr, * expiry, stop the grace timer. */ if (reason != OSPF_GR_HELPER_GRACE_TIMEOUT) - THREAD_OFF(nbr->gr_helper_info.t_grace_timer); + EVENT_OFF(nbr->gr_helper_info.t_grace_timer); /* check exit triggered due to successful completion * of graceful restart. diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index 170aca3d5..78d5bb25b 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -289,7 +289,7 @@ void ospf_if_cleanup(struct ospf_interface *oi) /* oi->nbrs and oi->nbr_nbma should be deleted on InterfaceDown event */ /* delete all static neighbors attached to this interface */ for (ALL_LIST_ELEMENTS(oi->nbr_nbma, node, nnode, nbr_nbma)) { - THREAD_OFF(nbr_nbma->t_poll); + EVENT_OFF(nbr_nbma->t_poll); if (nbr_nbma->nbr) { nbr_nbma->nbr->nbr_nbma = NULL; @@ -492,7 +492,7 @@ void ospf_interface_fifo_flush(struct ospf_interface *oi) if (oi->on_write_q) { listnode_delete(ospf->oi_write_q, oi); if (list_isempty(ospf->oi_write_q)) - THREAD_OFF(ospf->t_write); + EVENT_OFF(ospf->t_write); oi->on_write_q = 0; } } @@ -1471,7 +1471,7 @@ void ospf_reset_hello_timer(struct interface *ifp, struct in_addr addr, ospf_hello_send(oi); /* Restart hello timer for this interface */ - THREAD_OFF(oi->t_hello); + EVENT_OFF(oi->t_hello); OSPF_HELLO_TIMER_ON(oi); } @@ -1495,7 +1495,7 @@ void ospf_reset_hello_timer(struct interface *ifp, struct in_addr addr, ospf_hello_send(oi); /* Restart the hello timer. */ - THREAD_OFF(oi->t_hello); + EVENT_OFF(oi->t_hello); OSPF_HELLO_TIMER_ON(oi); } } diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c index 74c77439a..352fa83ec 100644 --- a/ospfd/ospf_ism.c +++ b/ospfd/ospf_ism.c @@ -241,7 +241,7 @@ void ospf_hello_timer(struct event *thread) { struct ospf_interface *oi; - oi = THREAD_ARG(thread); + oi = EVENT_ARG(thread); oi->t_hello = NULL; if (IS_DEBUG_OSPF(ism, ISM_TIMERS)) @@ -258,7 +258,7 @@ static void ospf_wait_timer(struct event *thread) { struct ospf_interface *oi; - oi = THREAD_ARG(thread); + oi = EVENT_ARG(thread); oi->t_wait = NULL; if (IS_DEBUG_OSPF(ism, ISM_TIMERS)) @@ -279,16 +279,16 @@ static void ism_timer_set(struct ospf_interface *oi) interface parameters must be set to initial values, and timers are reset also. */ - THREAD_OFF(oi->t_hello); - THREAD_OFF(oi->t_wait); - THREAD_OFF(oi->t_ls_ack); + EVENT_OFF(oi->t_hello); + EVENT_OFF(oi->t_wait); + EVENT_OFF(oi->t_ls_ack); break; case ISM_Loopback: /* In this state, the interface may be looped back and will be unavailable for regular data traffic. */ - THREAD_OFF(oi->t_hello); - THREAD_OFF(oi->t_wait); - THREAD_OFF(oi->t_ls_ack); + EVENT_OFF(oi->t_hello); + EVENT_OFF(oi->t_wait); + EVENT_OFF(oi->t_ls_ack); break; case ISM_Waiting: /* The router is trying to determine the identity of DRouter and @@ -298,7 +298,7 @@ static void ism_timer_set(struct ospf_interface *oi) OSPF_ISM_TIMER_MSEC_ON(oi->t_hello, ospf_hello_timer, 1); OSPF_ISM_TIMER_ON(oi->t_wait, ospf_wait_timer, OSPF_IF_PARAM(oi, v_wait)); - THREAD_OFF(oi->t_ls_ack); + EVENT_OFF(oi->t_ls_ack); break; case ISM_PointToPoint: /* The interface connects to a physical Point-to-point network @@ -307,7 +307,7 @@ static void ism_timer_set(struct ospf_interface *oi) neighboring router. Hello packets are also sent. */ /* send first hello immediately */ OSPF_ISM_TIMER_MSEC_ON(oi->t_hello, ospf_hello_timer, 1); - THREAD_OFF(oi->t_wait); + EVENT_OFF(oi->t_wait); OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack); break; @@ -317,7 +317,7 @@ static void ism_timer_set(struct ospf_interface *oi) and the router itself is neither Designated Router nor Backup Designated Router. */ OSPF_HELLO_TIMER_ON(oi); - THREAD_OFF(oi->t_wait); + EVENT_OFF(oi->t_wait); OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack); break; @@ -326,7 +326,7 @@ static void ism_timer_set(struct ospf_interface *oi) network, and the router is Backup Designated Router. */ OSPF_HELLO_TIMER_ON(oi); - THREAD_OFF(oi->t_wait); + EVENT_OFF(oi->t_wait); OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack); break; @@ -335,7 +335,7 @@ static void ism_timer_set(struct ospf_interface *oi) network, and the router is Designated Router. */ OSPF_HELLO_TIMER_ON(oi); - THREAD_OFF(oi->t_wait); + EVENT_OFF(oi->t_wait); OSPF_ISM_TIMER_ON(oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack); break; @@ -566,8 +566,8 @@ void ospf_ism_event(struct event *thread) int next_state; struct ospf_interface *oi; - oi = THREAD_ARG(thread); - event = THREAD_VAL(thread); + oi = EVENT_ARG(thread); + event = EVENT_VAL(thread); /* Call function. */ next_state = (*(ISM[oi->state][event].func))(oi); diff --git a/ospfd/ospf_ldp_sync.c b/ospfd/ospf_ldp_sync.c index c8ee9faf6..0ea21e540 100644 --- a/ospfd/ospf_ldp_sync.c +++ b/ospfd/ospf_ldp_sync.c @@ -190,7 +190,7 @@ void ospf_ldp_sync_if_complete(struct interface *ifp) if (ldp_sync_info && ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED) { if (ldp_sync_info->state == LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP) ldp_sync_info->state = LDP_IGP_SYNC_STATE_REQUIRED_UP; - THREAD_OFF(ldp_sync_info->t_holddown); + EVENT_OFF(ldp_sync_info->t_holddown); ospf_if_recalculate_output_cost(ifp); } } @@ -241,7 +241,7 @@ void ospf_ldp_sync_ldp_fail(struct interface *ifp) if (ldp_sync_info && ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED && ldp_sync_info->state != LDP_IGP_SYNC_STATE_NOT_REQUIRED) { - THREAD_OFF(ldp_sync_info->t_holddown); + EVENT_OFF(ldp_sync_info->t_holddown); ldp_sync_info->state = LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP; ospf_if_recalculate_output_cost(ifp); } @@ -305,7 +305,7 @@ void ospf_ldp_sync_if_remove(struct interface *ifp, bool remove) */ ols_debug("%s: Removed from if %s", __func__, ifp->name); - THREAD_OFF(ldp_sync_info->t_holddown); + EVENT_OFF(ldp_sync_info->t_holddown); ldp_sync_info->state = LDP_IGP_SYNC_STATE_NOT_REQUIRED; ospf_if_recalculate_output_cost(ifp); @@ -349,7 +349,7 @@ static void ospf_ldp_sync_holddown_timer(struct event *thread) * didn't receive msg from LDP indicating sync-complete * restore interface cost to original value */ - ifp = THREAD_ARG(thread); + ifp = EVENT_ARG(thread); params = IF_DEF_PARAMS(ifp); if (params->ldp_sync_info) { ldp_sync_info = params->ldp_sync_info; @@ -898,7 +898,7 @@ DEFPY (no_mpls_ldp_sync, SET_FLAG(ldp_sync_info->flags, LDP_SYNC_FLAG_IF_CONFIG); ldp_sync_info->enabled = LDP_IGP_SYNC_DEFAULT; ldp_sync_info->state = LDP_IGP_SYNC_STATE_NOT_REQUIRED; - THREAD_OFF(ldp_sync_info->t_holddown); + EVENT_OFF(ldp_sync_info->t_holddown); ospf_if_recalculate_output_cost(ifp); return CMD_SUCCESS; diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 1c5d1bddf..2e206258a 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -744,7 +744,7 @@ void ospf_router_lsa_body_set(struct stream **s, struct ospf_area *area) static void ospf_stub_router_timer(struct event *t) { - struct ospf_area *area = THREAD_ARG(t); + struct ospf_area *area = EVENT_ARG(t); area->t_stub_router = NULL; @@ -3044,7 +3044,7 @@ int ospf_check_nbr_status(struct ospf *ospf) void ospf_maxage_lsa_remover(struct event *thread) { - struct ospf *ospf = THREAD_ARG(thread); + struct ospf *ospf = EVENT_ARG(thread); struct ospf_lsa *lsa, *old; struct route_node *rn; int reschedule = 0; @@ -3292,7 +3292,7 @@ static int ospf_lsa_maxage_walker_remover(struct ospf *ospf, /* Periodical check of MaxAge LSA. */ void ospf_lsa_maxage_walker(struct event *thread) { - struct ospf *ospf = THREAD_ARG(thread); + struct ospf *ospf = EVENT_ARG(thread); struct route_node *rn; struct ospf_lsa *lsa; struct ospf_area *area; @@ -3652,7 +3652,7 @@ void ospf_flush_self_originated_lsas_now(struct ospf *ospf) * without conflicting to other threads. */ if (ospf->t_maxage != NULL) { - THREAD_OFF(ospf->t_maxage); + EVENT_OFF(ospf->t_maxage); event_execute(master, ospf_maxage_lsa_remover, ospf, 0); } @@ -3842,7 +3842,7 @@ static void ospf_lsa_action(struct event *t) { struct lsa_action *data; - data = THREAD_ARG(t); + data = EVENT_ARG(t); if (IS_DEBUG_OSPF(lsa, LSA) == OSPF_DEBUG_LSA) zlog_debug("LSA[Action]: Performing scheduled LSA action: %d", @@ -4033,7 +4033,7 @@ void ospf_lsa_refresh_walker(struct event *t) { struct list *refresh_list; struct listnode *node, *nnode; - struct ospf *ospf = THREAD_ARG(t); + struct ospf *ospf = EVENT_ARG(t); struct ospf_lsa *lsa; int i; struct list *lsa_to_refresh = list_new(); diff --git a/ospfd/ospf_neighbor.c b/ospfd/ospf_neighbor.c index 2bbf276db..c490695ac 100644 --- a/ospfd/ospf_neighbor.c +++ b/ospfd/ospf_neighbor.c @@ -125,17 +125,17 @@ void ospf_nbr_free(struct ospf_neighbor *nbr) } /* Cancel all timers. */ - THREAD_OFF(nbr->t_inactivity); - THREAD_OFF(nbr->t_db_desc); - THREAD_OFF(nbr->t_ls_req); - THREAD_OFF(nbr->t_ls_upd); + EVENT_OFF(nbr->t_inactivity); + EVENT_OFF(nbr->t_db_desc); + EVENT_OFF(nbr->t_ls_req); + EVENT_OFF(nbr->t_ls_upd); /* Cancel all events. */ /* Thread lookup cost would be negligible. */ event_cancel_event(master, nbr); bfd_sess_free(&nbr->bfd_session); - THREAD_OFF(nbr->gr_helper_info.t_grace_timer); + EVENT_OFF(nbr->gr_helper_info.t_grace_timer); nbr->oi = NULL; XFREE(MTYPE_OSPF_NEIGHBOR, nbr); @@ -441,7 +441,7 @@ static struct ospf_neighbor *ospf_nbr_add(struct ospf_interface *oi, nbr->nbr_nbma = nbr_nbma; if (nbr_nbma->t_poll) - THREAD_OFF(nbr_nbma->t_poll); + EVENT_OFF(nbr_nbma->t_poll); nbr->state_change = nbr_nbma->state_change + 1; } diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c index 71aeaa72a..5eac6166a 100644 --- a/ospfd/ospf_nsm.c +++ b/ospfd/ospf_nsm.c @@ -48,7 +48,7 @@ static void ospf_inactivity_timer(struct event *thread) { struct ospf_neighbor *nbr; - nbr = THREAD_ARG(thread); + nbr = EVENT_ARG(thread); nbr->t_inactivity = NULL; if (IS_DEBUG_OSPF(nsm, NSM_TIMERS)) @@ -75,7 +75,7 @@ static void ospf_db_desc_timer(struct event *thread) { struct ospf_neighbor *nbr; - nbr = THREAD_ARG(thread); + nbr = EVENT_ARG(thread); nbr->t_db_desc = NULL; if (IS_DEBUG_OSPF(nsm, NSM_TIMERS)) @@ -105,32 +105,32 @@ static void nsm_timer_set(struct ospf_neighbor *nbr) switch (nbr->state) { case NSM_Deleted: case NSM_Down: - THREAD_OFF(nbr->t_inactivity); - THREAD_OFF(nbr->t_hello_reply); + EVENT_OFF(nbr->t_inactivity); + EVENT_OFF(nbr->t_hello_reply); /* fallthru */ case NSM_Attempt: case NSM_Init: case NSM_TwoWay: - THREAD_OFF(nbr->t_db_desc); - THREAD_OFF(nbr->t_ls_upd); - THREAD_OFF(nbr->t_ls_req); + EVENT_OFF(nbr->t_db_desc); + EVENT_OFF(nbr->t_ls_upd); + EVENT_OFF(nbr->t_ls_req); break; case NSM_ExStart: OSPF_NSM_TIMER_ON(nbr->t_db_desc, ospf_db_desc_timer, nbr->v_db_desc); - THREAD_OFF(nbr->t_ls_upd); - THREAD_OFF(nbr->t_ls_req); + EVENT_OFF(nbr->t_ls_upd); + EVENT_OFF(nbr->t_ls_req); break; case NSM_Exchange: OSPF_NSM_TIMER_ON(nbr->t_ls_upd, ospf_ls_upd_timer, nbr->v_ls_upd); if (!IS_SET_DD_MS(nbr->dd_flags)) - THREAD_OFF(nbr->t_db_desc); + EVENT_OFF(nbr->t_db_desc); break; case NSM_Loading: case NSM_Full: default: - THREAD_OFF(nbr->t_db_desc); + EVENT_OFF(nbr->t_db_desc); break; } } @@ -161,13 +161,13 @@ int nsm_should_adj(struct ospf_neighbor *nbr) static int nsm_hello_received(struct ospf_neighbor *nbr) { /* Start or Restart Inactivity Timer. */ - THREAD_OFF(nbr->t_inactivity); + EVENT_OFF(nbr->t_inactivity); OSPF_NSM_TIMER_ON(nbr->t_inactivity, ospf_inactivity_timer, nbr->v_inactivity); if (nbr->oi->type == OSPF_IFTYPE_NBMA && nbr->nbr_nbma) - THREAD_OFF(nbr->nbr_nbma->t_poll); + EVENT_OFF(nbr->nbr_nbma->t_poll); /* Send proactive ARP requests */ if (nbr->state < NSM_Exchange) @@ -179,9 +179,9 @@ static int nsm_hello_received(struct ospf_neighbor *nbr) static int nsm_start(struct ospf_neighbor *nbr) { if (nbr->nbr_nbma) - THREAD_OFF(nbr->nbr_nbma->t_poll); + EVENT_OFF(nbr->nbr_nbma->t_poll); - THREAD_OFF(nbr->t_inactivity); + EVENT_OFF(nbr->t_inactivity); OSPF_NSM_TIMER_ON(nbr->t_inactivity, ospf_inactivity_timer, nbr->v_inactivity); @@ -797,8 +797,8 @@ void ospf_nsm_event(struct event *thread) int next_state; struct ospf_neighbor *nbr; - nbr = THREAD_ARG(thread); - event = THREAD_VAL(thread); + nbr = EVENT_ARG(thread); + event = EVENT_VAL(thread); if (IS_DEBUG_OSPF(nsm, NSM_EVENTS)) zlog_debug("NSM[%s:%pI4:%s]: %s (%s)", IF_NAME(nbr->oi), diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index 6cd26dd82..ee57e975a 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -137,7 +137,7 @@ int ospf_opaque_type9_lsa_init(struct ospf_interface *oi) void ospf_opaque_type9_lsa_term(struct ospf_interface *oi) { - THREAD_OFF(oi->t_opaque_lsa_self); + EVENT_OFF(oi->t_opaque_lsa_self); if (oi->opaque_lsa_self != NULL) list_delete(&oi->opaque_lsa_self); oi->opaque_lsa_self = NULL; @@ -166,7 +166,7 @@ void ospf_opaque_type10_lsa_term(struct ospf_area *area) area->lsdb->new_lsa_hook = area->lsdb->del_lsa_hook = NULL; #endif /* MONITOR_LSDB_CHANGE */ - THREAD_OFF(area->t_opaque_lsa_self); + EVENT_OFF(area->t_opaque_lsa_self); if (area->opaque_lsa_self != NULL) list_delete(&area->opaque_lsa_self); return; @@ -194,7 +194,7 @@ void ospf_opaque_type11_lsa_term(struct ospf *top) top->lsdb->new_lsa_hook = top->lsdb->del_lsa_hook = NULL; #endif /* MONITOR_LSDB_CHANGE */ - THREAD_OFF(top->t_opaque_lsa_self); + EVENT_OFF(top->t_opaque_lsa_self); if (top->opaque_lsa_self != NULL) list_delete(&top->opaque_lsa_self); return; @@ -590,7 +590,7 @@ static void free_opaque_info_per_type(struct opaque_info_per_type *oipt, ospf_opaque_lsa_flush_schedule(lsa); } - THREAD_OFF(oipt->t_opaque_lsa_self); + EVENT_OFF(oipt->t_opaque_lsa_self); list_delete(&oipt->id_list); if (cleanup_owner) { /* Remove from its owner's self-originated LSA list. */ @@ -697,7 +697,7 @@ static void free_opaque_info_per_id(void *val) { struct opaque_info_per_id *oipi = (struct opaque_info_per_id *)val; - THREAD_OFF(oipi->t_opaque_lsa_self); + EVENT_OFF(oipi->t_opaque_lsa_self); if (oipi->lsa != NULL) ospf_lsa_unlock(&oipi->lsa); XFREE(MTYPE_OPAQUE_INFO_PER_ID, oipi); @@ -1460,7 +1460,7 @@ static void ospf_opaque_type9_lsa_originate(struct event *t) { struct ospf_interface *oi; - oi = THREAD_ARG(t); + oi = EVENT_ARG(t); oi->t_opaque_lsa_self = NULL; if (IS_DEBUG_OSPF_EVENT) @@ -1474,7 +1474,7 @@ static void ospf_opaque_type10_lsa_originate(struct event *t) { struct ospf_area *area; - area = THREAD_ARG(t); + area = EVENT_ARG(t); area->t_opaque_lsa_self = NULL; if (IS_DEBUG_OSPF_EVENT) @@ -1489,7 +1489,7 @@ static void ospf_opaque_type11_lsa_originate(struct event *t) { struct ospf *top; - top = THREAD_ARG(t); + top = EVENT_ARG(t); top->t_opaque_lsa_self = NULL; if (IS_DEBUG_OSPF_EVENT) @@ -1830,7 +1830,7 @@ static void ospf_opaque_type9_lsa_reoriginate_timer(struct event *t) struct ospf *top; struct ospf_interface *oi; - oipt = THREAD_ARG(t); + oipt = EVENT_ARG(t); if ((functab = oipt->functab) == NULL || functab->lsa_originator == NULL) { @@ -1874,7 +1874,7 @@ static void ospf_opaque_type10_lsa_reoriginate_timer(struct event *t) struct ospf_interface *oi; int n; - oipt = THREAD_ARG(t); + oipt = EVENT_ARG(t); if ((functab = oipt->functab) == NULL || functab->lsa_originator == NULL) { @@ -1919,7 +1919,7 @@ static void ospf_opaque_type11_lsa_reoriginate_timer(struct event *t) struct ospf_opaque_functab *functab; struct ospf *top; - oipt = THREAD_ARG(t); + oipt = EVENT_ARG(t); if ((functab = oipt->functab) == NULL || functab->lsa_originator == NULL) { @@ -2022,7 +2022,7 @@ static void ospf_opaque_lsa_refresh_timer(struct event *t) if (IS_DEBUG_OSPF_EVENT) zlog_debug("Timer[Opaque-LSA]: (Opaque-LSA Refresh expire)"); - oipi = THREAD_ARG(t); + oipi = EVENT_ARG(t); if ((lsa = oipi->lsa) != NULL) if ((functab = oipi->opqctl_type->functab) != NULL) diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index d53f65e94..a0cc9b0bd 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -443,7 +443,7 @@ static void ospf_ls_req_timer(struct event *thread) { struct ospf_neighbor *nbr; - nbr = THREAD_ARG(thread); + nbr = EVENT_ARG(thread); nbr->t_ls_req = NULL; /* Send Link State Request. */ @@ -456,7 +456,7 @@ static void ospf_ls_req_timer(struct event *thread) void ospf_ls_req_event(struct ospf_neighbor *nbr) { - THREAD_OFF(nbr->t_ls_req); + EVENT_OFF(nbr->t_ls_req); event_add_event(master, ospf_ls_req_timer, nbr, 0, &nbr->t_ls_req); } @@ -466,7 +466,7 @@ void ospf_ls_upd_timer(struct event *thread) { struct ospf_neighbor *nbr; - nbr = THREAD_ARG(thread); + nbr = EVENT_ARG(thread); nbr->t_ls_upd = NULL; /* Send Link State Update. */ @@ -524,7 +524,7 @@ void ospf_ls_ack_timer(struct event *thread) { struct ospf_interface *oi; - oi = THREAD_ARG(thread); + oi = EVENT_ARG(thread); oi->t_ls_ack = NULL; /* Send Link State Acknowledgment. */ @@ -610,7 +610,7 @@ static void ospf_write_frags(int fd, struct ospf_packet *op, struct ip *iph, static void ospf_write(struct event *thread) { - struct ospf *ospf = THREAD_ARG(thread); + struct ospf *ospf = EVENT_ARG(thread); struct ospf_interface *oi; struct ospf_packet *op; struct sockaddr_in sa_dst; @@ -3210,7 +3210,7 @@ void ospf_read(struct event *thread) enum ospf_read_return_enum ret; /* first of all get interface pointer. */ - ospf = THREAD_ARG(thread); + ospf = EVENT_ARG(thread); /* prepare for next packet. */ event_add_read(master, ospf_read, ospf, ospf->fd, &ospf->t_read); @@ -3742,7 +3742,7 @@ void ospf_poll_timer(struct event *thread) { struct ospf_nbr_nbma *nbr_nbma; - nbr_nbma = THREAD_ARG(thread); + nbr_nbma = EVENT_ARG(thread); nbr_nbma->t_poll = NULL; if (IS_DEBUG_OSPF(nsm, NSM_TIMERS)) @@ -3761,7 +3761,7 @@ void ospf_hello_reply_timer(struct event *thread) { struct ospf_neighbor *nbr; - nbr = THREAD_ARG(thread); + nbr = EVENT_ARG(thread); nbr->t_hello_reply = NULL; if (IS_DEBUG_OSPF(nsm, NSM_TIMERS)) @@ -4096,7 +4096,7 @@ static void ospf_ls_upd_queue_send(struct ospf_interface *oi, * is actually turned off. */ if (list_isempty(oi->ospf->oi_write_q)) - THREAD_OFF(oi->ospf->t_write); + EVENT_OFF(oi->ospf->t_write); } else { /* Hook thread to write packet. */ OSPF_ISM_WRITE_ON(oi->ospf); @@ -4105,7 +4105,7 @@ static void ospf_ls_upd_queue_send(struct ospf_interface *oi, static void ospf_ls_upd_send_queue_event(struct event *thread) { - struct ospf_interface *oi = THREAD_ARG(thread); + struct ospf_interface *oi = EVENT_ARG(thread); struct route_node *rn; struct route_node *rnext; struct list *update; @@ -4252,7 +4252,7 @@ static void ospf_ls_ack_send_list(struct ospf_interface *oi, struct list *ack, static void ospf_ls_ack_send_event(struct event *thread) { - struct ospf_interface *oi = THREAD_ARG(thread); + struct ospf_interface *oi = EVENT_ARG(thread); oi->t_ls_ack_direct = NULL; diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index 39497291d..c6e862011 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -1844,7 +1844,7 @@ void ospf_spf_calculate_areas(struct ospf *ospf, struct route_table *new_table, /* Worker for SPF calculation scheduler. */ static void ospf_spf_calculate_schedule_worker(struct event *thread) { - struct ospf *ospf = THREAD_ARG(thread); + struct ospf *ospf = EVENT_ARG(thread); struct route_table *new_table, *new_rtrs; struct route_table *all_rtrs = NULL; struct timeval start_time, spf_start_time; diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c index efe4f4ecc..8eca038a9 100644 --- a/ospfd/ospf_sr.c +++ b/ospfd/ospf_sr.c @@ -461,7 +461,7 @@ static void sr_start_label_manager(struct event *start) { struct ospf *ospf; - ospf = THREAD_ARG(start); + ospf = EVENT_ARG(start); /* re-attempt to start SR & Label Manager connection */ ospf_sr_start(ospf); @@ -565,7 +565,7 @@ static void ospf_sr_stop(void) osr_debug("SR (%s): Stop Segment Routing", __func__); /* Disable any re-attempt to connect to Label Manager */ - THREAD_OFF(OspfSR.t_start_lm); + EVENT_OFF(OspfSR.t_start_lm); /* Release SRGB if active */ sr_global_block_delete(); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index c53788dd7..024bb532a 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -9639,7 +9639,7 @@ DEFUN (no_ospf_max_metric_router_lsa_startup, for (ALL_LIST_ELEMENTS_RO(ospf->areas, ln, area)) { SET_FLAG(area->stub_router_state, OSPF_AREA_WAS_START_STUB_ROUTED); - THREAD_OFF(area->t_stub_router); + EVENT_OFF(area->t_stub_router); /* Don't trample on admin stub routed */ if (!CHECK_FLAG(area->stub_router_state, @@ -12802,7 +12802,7 @@ DEFPY_HIDDEN(ospf_maxage_delay_timer, ospf_maxage_delay_timer_cmd, else ospf->maxage_delay = value; - THREAD_OFF(ospf->t_maxage); + EVENT_OFF(ospf->t_maxage); OSPF_TIMER_ON(ospf->t_maxage, ospf_maxage_lsa_remover, ospf->maxage_delay); diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 5f2a2e295..232059add 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -512,7 +512,7 @@ bool ospf_external_default_routemap_apply_walk(struct ospf *ospf, static void ospf_external_lsa_default_routemap_timer(struct event *thread) { struct list *ext_list; - struct ospf *ospf = THREAD_ARG(thread); + struct ospf *ospf = EVENT_ARG(thread); struct prefix_ipv4 p; int type; int ret = 0; @@ -1517,7 +1517,7 @@ static void ospf_distribute_list_update_timer(struct event *thread) struct route_table *rt; struct ospf_lsa *lsa; int type, default_refresh = 0; - struct ospf *ospf = THREAD_ARG(thread); + struct ospf *ospf = EVENT_ARG(thread); if (ospf == NULL) return; diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index fab420a14..37d6c211c 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -579,7 +579,7 @@ static struct ospf *ospf_lookup_by_name(const char *vrf_name) static void ospf_deferred_shutdown_finish(struct ospf *ospf) { ospf->stub_router_shutdown_time = OSPF_STUB_ROUTER_UNCONFIGURED; - THREAD_OFF(ospf->t_deferred_shutdown); + EVENT_OFF(ospf->t_deferred_shutdown); ospf_finish_final(ospf); @@ -598,7 +598,7 @@ static void ospf_deferred_shutdown_finish(struct ospf *ospf) /* Timer thread for G-R */ static void ospf_deferred_shutdown_timer(struct event *t) { - struct ospf *ospf = THREAD_ARG(t); + struct ospf *ospf = EVENT_ARG(t); ospf_deferred_shutdown_finish(ospf); } @@ -761,7 +761,7 @@ static void ospf_finish_final(struct ospf *ospf) /* Clear static neighbors */ for (rn = route_top(ospf->nbr_nbma); rn; rn = route_next(rn)) if ((nbr_nbma = rn->info)) { - THREAD_OFF(nbr_nbma->t_poll); + EVENT_OFF(nbr_nbma->t_poll); if (nbr_nbma->nbr) { nbr_nbma->nbr->nbr_nbma = NULL; @@ -797,23 +797,23 @@ static void ospf_finish_final(struct ospf *ospf) } /* Cancel all timers. */ - THREAD_OFF(ospf->t_read); - THREAD_OFF(ospf->t_write); - THREAD_OFF(ospf->t_spf_calc); - THREAD_OFF(ospf->t_ase_calc); - THREAD_OFF(ospf->t_maxage); - THREAD_OFF(ospf->t_maxage_walker); - THREAD_OFF(ospf->t_abr_task); - THREAD_OFF(ospf->t_abr_fr); - THREAD_OFF(ospf->t_asbr_check); - THREAD_OFF(ospf->t_asbr_nssa_redist_update); - THREAD_OFF(ospf->t_distribute_update); - THREAD_OFF(ospf->t_lsa_refresher); - THREAD_OFF(ospf->t_opaque_lsa_self); - THREAD_OFF(ospf->t_sr_update); - THREAD_OFF(ospf->t_default_routemap_timer); - THREAD_OFF(ospf->t_external_aggr); - THREAD_OFF(ospf->gr_info.t_grace_period); + EVENT_OFF(ospf->t_read); + EVENT_OFF(ospf->t_write); + EVENT_OFF(ospf->t_spf_calc); + EVENT_OFF(ospf->t_ase_calc); + EVENT_OFF(ospf->t_maxage); + EVENT_OFF(ospf->t_maxage_walker); + EVENT_OFF(ospf->t_abr_task); + EVENT_OFF(ospf->t_abr_fr); + EVENT_OFF(ospf->t_asbr_check); + EVENT_OFF(ospf->t_asbr_nssa_redist_update); + EVENT_OFF(ospf->t_distribute_update); + EVENT_OFF(ospf->t_lsa_refresher); + EVENT_OFF(ospf->t_opaque_lsa_self); + EVENT_OFF(ospf->t_sr_update); + EVENT_OFF(ospf->t_default_routemap_timer); + EVENT_OFF(ospf->t_external_aggr); + EVENT_OFF(ospf->gr_info.t_grace_period); LSDB_LOOP (OPAQUE_AS_LSDB(ospf), rn, lsa) ospf_discard_from_db(ospf, ospf->lsdb, lsa); @@ -1015,8 +1015,8 @@ static void ospf_area_free(struct ospf_area *area) free(IMPORT_NAME(area)); /* Cancel timer. */ - THREAD_OFF(area->t_stub_router); - THREAD_OFF(area->t_opaque_lsa_self); + EVENT_OFF(area->t_stub_router); + EVENT_OFF(area->t_opaque_lsa_self); if (OSPF_IS_AREA_BACKBONE(area)) area->ospf->backbone = NULL; @@ -1451,7 +1451,7 @@ void ospf_ls_upd_queue_empty(struct ospf_interface *oi) } /* remove update event */ - THREAD_OFF(oi->t_ls_upd_event); + EVENT_OFF(oi->t_ls_upd_event); } void ospf_if_update(struct ospf *ospf, struct interface *ifp) @@ -1859,7 +1859,7 @@ int ospf_timers_refresh_set(struct ospf *ospf, int interval) - (monotime(NULL) - ospf->lsa_refresher_started); if (time_left > interval) { - THREAD_OFF(ospf->t_lsa_refresher); + EVENT_OFF(ospf->t_lsa_refresher); event_add_timer(master, ospf_lsa_refresh_walker, ospf, interval, &ospf->t_lsa_refresher); } @@ -1876,7 +1876,7 @@ int ospf_timers_refresh_unset(struct ospf *ospf) - (monotime(NULL) - ospf->lsa_refresher_started); if (time_left > OSPF_LSA_REFRESH_INTERVAL_DEFAULT) { - THREAD_OFF(ospf->t_lsa_refresher); + EVENT_OFF(ospf->t_lsa_refresher); ospf->t_lsa_refresher = NULL; event_add_timer(master, ospf_lsa_refresh_walker, ospf, OSPF_LSA_REFRESH_INTERVAL_DEFAULT, @@ -1928,7 +1928,7 @@ static void ospf_nbr_nbma_delete(struct ospf *ospf, static void ospf_nbr_nbma_down(struct ospf_nbr_nbma *nbr_nbma) { - THREAD_OFF(nbr_nbma->t_poll); + EVENT_OFF(nbr_nbma->t_poll); if (nbr_nbma->nbr) { nbr_nbma->nbr->nbr_nbma = NULL; @@ -2117,7 +2117,7 @@ int ospf_nbr_nbma_poll_interval_set(struct ospf *ospf, struct in_addr nbr_addr, if (nbr_nbma->v_poll != interval) { nbr_nbma->v_poll = interval; if (nbr_nbma->oi && ospf_if_is_up(nbr_nbma->oi)) { - THREAD_OFF(nbr_nbma->t_poll); + EVENT_OFF(nbr_nbma->t_poll); OSPF_POLL_TIMER_ON(nbr_nbma->t_poll, ospf_poll_timer, nbr_nbma->v_poll); } @@ -2286,7 +2286,7 @@ static int ospf_vrf_disable(struct vrf *vrf) if (IS_DEBUG_OSPF_EVENT) zlog_debug("%s: ospf old_vrf_id %d unlinked", __func__, old_vrf_id); - THREAD_OFF(ospf->t_read); + EVENT_OFF(ospf->t_read); close(ospf->fd); ospf->fd = -1; } diff --git a/pathd/path_pcep_controller.c b/pathd/path_pcep_controller.c index 4f03dbde2..a8897fc33 100644 --- a/pathd/path_pcep_controller.c +++ b/pathd/path_pcep_controller.c @@ -328,7 +328,7 @@ int pcep_ctrl_halt_cb(struct frr_pthread *fpt, void **res) void pcep_refine_path_event_cb(struct event *thread) { - struct pcep_refine_path_event_data *data = THREAD_ARG(thread); + struct pcep_refine_path_event_data *data = EVENT_ARG(thread); assert(data != NULL); struct ctrl_state *ctrl_state = data->ctrl_state; struct path *path = data->path; @@ -390,7 +390,7 @@ void pcep_thread_cancel_timer(struct event **thread) return; } - struct pcep_ctrl_timer_data *data = THREAD_ARG(*thread); + struct pcep_ctrl_timer_data *data = EVENT_ARG(*thread); PCEP_DEBUG("Timer %s / %s canceled", timer_type_name(data->timer_type), timeout_type_name(data->timeout_type)); if (data != NULL) { @@ -496,7 +496,7 @@ void pcep_thread_path_refined_event(struct ctrl_state *ctrl_state, void pcep_thread_finish_event_handler(struct event *thread) { int i; - struct frr_pthread *fpt = THREAD_ARG(thread); + struct frr_pthread *fpt = EVENT_ARG(thread); struct ctrl_state *ctrl_state = fpt->data; assert(ctrl_state != NULL); @@ -554,7 +554,7 @@ int schedule_thread_timer(struct ctrl_state *ctrl_state, int pcc_id, void pcep_thread_timer_handler(struct event *thread) { /* data unpacking */ - struct pcep_ctrl_timer_data *data = THREAD_ARG(thread); + struct pcep_ctrl_timer_data *data = EVENT_ARG(thread); assert(data != NULL); struct ctrl_state *ctrl_state = data->ctrl_state; assert(ctrl_state != NULL); @@ -600,7 +600,7 @@ void pcep_thread_timer_handler(struct event *thread) void pcep_thread_pcep_event(struct event *thread) { - struct pcep_ctrl_event_data *data = THREAD_ARG(thread); + struct pcep_ctrl_event_data *data = EVENT_ARG(thread); assert(data != NULL); struct ctrl_state *ctrl_state = data->ctrl_state; pcep_event *event = data->payload; @@ -710,7 +710,7 @@ int send_to_thread_with_cb(struct ctrl_state *ctrl_state, int pcc_id, void pcep_thread_event_handler(struct event *thread) { /* data unpacking */ - struct pcep_ctrl_event_data *data = THREAD_ARG(thread); + struct pcep_ctrl_event_data *data = EVENT_ARG(thread); assert(data != NULL); struct ctrl_state *ctrl_state = data->ctrl_state; assert(ctrl_state != NULL); @@ -972,7 +972,7 @@ int send_to_main(struct ctrl_state *ctrl_state, int pcc_id, void pcep_main_event_handler(struct event *thread) { /* data unpacking */ - struct pcep_main_event_data *data = THREAD_ARG(thread); + struct pcep_main_event_data *data = EVENT_ARG(thread); assert(data != NULL); pcep_main_event_handler_t handler = data->handler; enum pcep_main_event_type type = data->type; diff --git a/pathd/path_pcep_lib.c b/pathd/path_pcep_lib.c index dcf4921d7..d43fdb083 100644 --- a/pathd/path_pcep_lib.c +++ b/pathd/path_pcep_lib.c @@ -231,7 +231,7 @@ int pcep_lib_pceplib_socket_read_cb(void *fpt, void **thread, int fd, void pcep_lib_socket_write_ready(struct event *thread) { - struct pcep_ctrl_socket_data *data = THREAD_ARG(thread); + struct pcep_ctrl_socket_data *data = EVENT_ARG(thread); assert(data != NULL); pceplib_external_socket_write(data->fd, data->payload); @@ -240,7 +240,7 @@ void pcep_lib_socket_write_ready(struct event *thread) void pcep_lib_socket_read_ready(struct event *thread) { - struct pcep_ctrl_socket_data *data = THREAD_ARG(thread); + struct pcep_ctrl_socket_data *data = EVENT_ARG(thread); assert(data != NULL); pceplib_external_socket_read(data->fd, data->payload); diff --git a/pathd/path_ted.c b/pathd/path_ted.c index c13b0188f..f471a8949 100644 --- a/pathd/path_ted.c +++ b/pathd/path_ted.c @@ -600,7 +600,7 @@ enum zclient_send_status path_ted_link_state_sync(void) void path_ted_timer_handler_sync(struct event *thread) { /* data unpacking */ - struct ted_state *data = THREAD_ARG(thread); + struct ted_state *data = EVENT_ARG(thread); assert(data != NULL); /* Retry the sync */ @@ -640,7 +640,7 @@ void path_ted_timer_handler_refresh(struct event *thread) PATH_TED_DEBUG("%s: PATHD-TED: Refresh sid from current TED", __func__); /* data unpacking */ - struct ted_state *data = THREAD_ARG(thread); + struct ted_state *data = EVENT_ARG(thread); assert(data != NULL); diff --git a/pathd/pathd.c b/pathd/pathd.c index d1c0c82d9..6c13503c7 100644 --- a/pathd/pathd.c +++ b/pathd/pathd.c @@ -1299,7 +1299,7 @@ void trigger_pathd_candidate_created(struct srte_candidate *candidate) void trigger_pathd_candidate_created_timer(struct event *thread) { - struct srte_candidate *candidate = THREAD_ARG(thread); + struct srte_candidate *candidate = EVENT_ARG(thread); candidate->hook_timer = NULL; hook_call(pathd_candidate_created, candidate); } @@ -1319,7 +1319,7 @@ void trigger_pathd_candidate_updated(struct srte_candidate *candidate) void trigger_pathd_candidate_updated_timer(struct event *thread) { - struct srte_candidate *candidate = THREAD_ARG(thread); + struct srte_candidate *candidate = EVENT_ARG(thread); candidate->hook_timer = NULL; hook_call(pathd_candidate_updated, candidate); } diff --git a/pimd/pim6_mld.c b/pimd/pim6_mld.c index 5a33fdb26..7d3b084f3 100644 --- a/pimd/pim6_mld.c +++ b/pimd/pim6_mld.c @@ -329,7 +329,7 @@ static void gm_expiry_calc(struct gm_query_timers *timers) static void gm_sg_free(struct gm_sg *sg) { /* t_sg_expiry is handled before this is reached */ - THREAD_OFF(sg->t_sg_query); + EVENT_OFF(sg->t_sg_query); gm_packet_sg_subs_fini(sg->subs_negative); gm_packet_sg_subs_fini(sg->subs_positive); XFREE(MTYPE_GM_SG, sg); @@ -404,7 +404,7 @@ static void gm_sg_update(struct gm_sg *sg, bool has_expired) gm_expiry_calc(&timers); gm_sg_timer_start(gm_ifp, sg, timers.expire_wait); - THREAD_OFF(sg->t_sg_query); + EVENT_OFF(sg->t_sg_query); sg->n_query = gm_ifp->cur_lmqc; sg->query_sbit = false; gm_trigger_specific(sg); @@ -443,7 +443,7 @@ static void gm_sg_update(struct gm_sg *sg, bool has_expired) * another path. */ if (has_expired) - THREAD_OFF(sg->t_sg_expire); + EVENT_OFF(sg->t_sg_expire); assertf((!sg->t_sg_expire && !gm_packet_sg_subs_count(sg->subs_positive) && @@ -582,7 +582,7 @@ static void gm_sg_expiry_cancel(struct gm_sg *sg) { if (sg->t_sg_expire && PIM_DEBUG_GM_TRACE) zlog_debug(log_sg(sg, "alive, cancelling expiry timer")); - THREAD_OFF(sg->t_sg_expire); + EVENT_OFF(sg->t_sg_expire); sg->query_sbit = true; } @@ -1031,7 +1031,7 @@ static void gm_handle_v1_leave(struct gm_if *gm_ifp, */ static void gm_t_expire(struct event *t) { - struct gm_if *gm_ifp = THREAD_ARG(t); + struct gm_if *gm_ifp = EVENT_ARG(t); struct gm_packet_state *pkt; zlog_info(log_ifp("general expiry timer")); @@ -1103,7 +1103,7 @@ static void gm_handle_q_general(struct gm_if *gm_ifp, gm_ifp->n_pending--; if (!gm_ifp->n_pending) - THREAD_OFF(gm_ifp->t_expire); + EVENT_OFF(gm_ifp->t_expire); } /* people might be messing with their configs or something */ @@ -1128,7 +1128,7 @@ static void gm_handle_q_general(struct gm_if *gm_ifp, static void gm_t_sg_expire(struct event *t) { - struct gm_sg *sg = THREAD_ARG(t); + struct gm_sg *sg = EVENT_ARG(t); struct gm_if *gm_ifp = sg->iface; struct gm_packet_sg *item; @@ -1212,7 +1212,7 @@ static void gm_sg_timer_start(struct gm_if *gm_ifp, struct gm_sg *sg, if (timercmp(&remain, &expire_wait, <=)) return; - THREAD_OFF(sg->t_sg_expire); + EVENT_OFF(sg->t_sg_expire); } event_add_timer_tv(router->master, gm_t_sg_expire, sg, &expire_wait, @@ -1240,7 +1240,7 @@ static void gm_t_grp_expire(struct event *t) * receive a report, so that work is left to gm_t_sg_expire and we * shouldn't worry about it here. */ - struct gm_grp_pending *pend = THREAD_ARG(t); + struct gm_grp_pending *pend = EVENT_ARG(t); struct gm_if *gm_ifp = pend->iface; struct gm_sg *sg, *sg_start, sg_ref = {}; @@ -1269,7 +1269,7 @@ static void gm_t_grp_expire(struct event *t) * parallel. But if we received nothing for the *,G query, * the S,G query is kinda irrelevant. */ - THREAD_OFF(sg->t_sg_expire); + EVENT_OFF(sg->t_sg_expire); frr_each_safe (gm_packet_sg_subs, sg->subs_positive, item) /* this will also drop the EXCLUDE S,G lists */ @@ -1320,7 +1320,7 @@ static void gm_handle_q_group(struct gm_if *gm_ifp, if (timercmp(&remain, &timers->expire_wait, <=)) return; - THREAD_OFF(pend->t_expire); + EVENT_OFF(pend->t_expire); } else { pend = XCALLOC(MTYPE_GM_GRP_PENDING, sizeof(*pend)); pend->grp = grp; @@ -1341,7 +1341,7 @@ static void gm_bump_querier(struct gm_if *gm_ifp) { struct pim_interface *pim_ifp = gm_ifp->ifp->info; - THREAD_OFF(gm_ifp->t_query); + EVENT_OFF(gm_ifp->t_query); if (pim_addr_is_any(pim_ifp->ll_lowest)) return; @@ -1355,7 +1355,7 @@ static void gm_bump_querier(struct gm_if *gm_ifp) static void gm_t_other_querier(struct event *t) { - struct gm_if *gm_ifp = THREAD_ARG(t); + struct gm_if *gm_ifp = EVENT_ARG(t); struct pim_interface *pim_ifp = gm_ifp->ifp->info; zlog_info(log_ifp("other querier timer expired")); @@ -1466,8 +1466,8 @@ static void gm_handle_query(struct gm_if *gm_ifp, if (IPV6_ADDR_CMP(&pkt_src->sin6_addr, &pim_ifp->ll_lowest) < 0) { unsigned int other_ms; - THREAD_OFF(gm_ifp->t_query); - THREAD_OFF(gm_ifp->t_other_querier); + EVENT_OFF(gm_ifp->t_query); + EVENT_OFF(gm_ifp->t_other_querier); other_ms = timers.qrv * timers.qqic_ms + timers.max_resp_ms / 2; event_add_timer_msec(router->master, gm_t_other_querier, gm_ifp, @@ -1587,7 +1587,7 @@ static bool ip6_check_hopopts_ra(uint8_t *hopopts, size_t hopopt_len, static void gm_t_recv(struct event *t) { - struct pim_instance *pim = THREAD_ARG(t); + struct pim_instance *pim = EVENT_ARG(t); union { char buf[CMSG_SPACE(sizeof(struct in6_pktinfo)) + CMSG_SPACE(256) /* hop options */ + @@ -1859,7 +1859,7 @@ static void gm_send_query(struct gm_if *gm_ifp, pim_addr grp, static void gm_t_query(struct event *t) { - struct gm_if *gm_ifp = THREAD_ARG(t); + struct gm_if *gm_ifp = EVENT_ARG(t); unsigned int timer_ms = gm_ifp->cur_query_intv; if (gm_ifp->n_startup) { @@ -1875,7 +1875,7 @@ static void gm_t_query(struct event *t) static void gm_t_sg_query(struct event *t) { - struct gm_sg *sg = THREAD_ARG(t); + struct gm_sg *sg = EVENT_ARG(t); gm_trigger_specific(sg); } @@ -1896,7 +1896,7 @@ static void gm_send_specific(struct gm_gsq_pending *pend_gsq) static void gm_t_gsq_pend(struct event *t) { - struct gm_gsq_pending *pend_gsq = THREAD_ARG(t); + struct gm_gsq_pending *pend_gsq = EVENT_ARG(t); gm_send_specific(pend_gsq); } @@ -1947,7 +1947,7 @@ static void gm_trigger_specific(struct gm_sg *sg) pend_gsq->n_src++; if (pend_gsq->n_src == array_size(pend_gsq->srcs)) { - THREAD_OFF(pend_gsq->t_send); + EVENT_OFF(pend_gsq->t_send); gm_send_specific(pend_gsq); pend_gsq = NULL; } @@ -2053,7 +2053,7 @@ static void gm_vrf_socket_decref(struct pim_instance *pim) if (--pim->gm_socket_if_count) return; - THREAD_OFF(pim->t_gm_recv); + EVENT_OFF(pim->t_gm_recv); close(pim->gm_socket); pim->gm_socket = -1; } @@ -2126,17 +2126,17 @@ void gm_group_delete(struct gm_if *gm_ifp) gm_packet_drop(pkt, false); while ((pend_grp = gm_grp_pends_pop(gm_ifp->grp_pends))) { - THREAD_OFF(pend_grp->t_expire); + EVENT_OFF(pend_grp->t_expire); XFREE(MTYPE_GM_GRP_PENDING, pend_grp); } while ((pend_gsq = gm_gsq_pends_pop(gm_ifp->gsq_pends))) { - THREAD_OFF(pend_gsq->t_send); + EVENT_OFF(pend_gsq->t_send); XFREE(MTYPE_GM_GSQ_PENDING, pend_gsq); } while ((sg = gm_sgs_pop(gm_ifp->sgs))) { - THREAD_OFF(sg->t_sg_expire); + EVENT_OFF(sg->t_sg_expire); assertf(!gm_packet_sg_subs_count(sg->subs_negative), "%pSG", &sg->sgaddr); assertf(!gm_packet_sg_subs_count(sg->subs_positive), "%pSG", @@ -2164,9 +2164,9 @@ void gm_ifp_teardown(struct interface *ifp) if (PIM_DEBUG_GM_EVENTS) zlog_debug(log_ifp("MLD stop")); - THREAD_OFF(gm_ifp->t_query); - THREAD_OFF(gm_ifp->t_other_querier); - THREAD_OFF(gm_ifp->t_expire); + EVENT_OFF(gm_ifp->t_query); + EVENT_OFF(gm_ifp->t_other_querier); + EVENT_OFF(gm_ifp->t_expire); frr_with_privs (&pimd_privs) { struct ipv6_mreq mreq; @@ -2209,7 +2209,7 @@ static void gm_update_ll(struct interface *ifp) gm_ifp->cur_ll_lowest = pim_ifp->ll_lowest; if (was_querier) gm_ifp->querier = pim_ifp->ll_lowest; - THREAD_OFF(gm_ifp->t_query); + EVENT_OFF(gm_ifp->t_query); if (pim_addr_is_any(gm_ifp->cur_ll_lowest)) { if (was_querier) diff --git a/pimd/pim_assert.c b/pimd/pim_assert.c index 6478d539a..86d9a745e 100644 --- a/pimd/pim_assert.c +++ b/pimd/pim_assert.c @@ -498,7 +498,7 @@ static void on_assert_timer(struct event *t) struct pim_ifchannel *ch; struct interface *ifp; - ch = THREAD_ARG(t); + ch = EVENT_ARG(t); ifp = ch->interface; @@ -535,7 +535,7 @@ static void assert_timer_off(struct pim_ifchannel *ch) __func__, ch->sg_str, ch->interface->name); } } - THREAD_OFF(ch->t_ifassert_timer); + EVENT_OFF(ch->t_ifassert_timer); } static void pim_assert_timer_set(struct pim_ifchannel *ch, int interval) diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c index ec2bfdcb2..b36e00631 100644 --- a/pimd/pim_bsm.c +++ b/pimd/pim_bsm.c @@ -54,7 +54,7 @@ void pim_bsm_write_config(struct vty *vty, struct interface *ifp) static void pim_bsm_rpinfo_free(struct bsm_rpinfo *bsrp_info) { - THREAD_OFF(bsrp_info->g2rp_timer); + EVENT_OFF(bsrp_info->g2rp_timer); XFREE(MTYPE_PIM_BSRP_INFO, bsrp_info); } @@ -147,8 +147,8 @@ static void pim_on_bs_timer(struct event *t) struct bsgrp_node *bsgrp_node; struct bsm_rpinfo *bsrp; - scope = THREAD_ARG(t); - THREAD_OFF(scope->bs_timer); + scope = EVENT_ARG(t); + EVENT_OFF(scope->bs_timer); if (PIM_DEBUG_BSM) zlog_debug("%s: Bootstrap Timer expired for scope: %d", @@ -189,7 +189,7 @@ static void pim_bs_timer_stop(struct bsm_scope *scope) if (PIM_DEBUG_BSM) zlog_debug("%s : BS timer being stopped of sz: %d", __func__, scope->sz_id); - THREAD_OFF(scope->bs_timer); + EVENT_OFF(scope->bs_timer); } static void pim_bs_timer_start(struct bsm_scope *scope, int bs_timeout) @@ -199,7 +199,7 @@ static void pim_bs_timer_start(struct bsm_scope *scope, int bs_timeout) zlog_debug("%s : Invalid scope(NULL).", __func__); return; } - THREAD_OFF(scope->bs_timer); + EVENT_OFF(scope->bs_timer); if (PIM_DEBUG_BSM) zlog_debug( "%s : starting bs timer for scope %d with timeout %d secs", @@ -268,8 +268,8 @@ static void pim_on_g2rp_timer(struct event *t) uint16_t elapse; pim_addr bsrp_addr; - bsrp = THREAD_ARG(t); - THREAD_OFF(bsrp->g2rp_timer); + bsrp = EVENT_ARG(t); + EVENT_OFF(bsrp->g2rp_timer); bsgrp_node = bsrp->bsgrp_node; /* elapse time is the hold time of expired node */ @@ -331,7 +331,7 @@ static void pim_g2rp_timer_start(struct bsm_rpinfo *bsrp, int hold_time) zlog_debug("%s : Invalid brsp(NULL).", __func__); return; } - THREAD_OFF(bsrp->g2rp_timer); + EVENT_OFF(bsrp->g2rp_timer); if (PIM_DEBUG_BSM) zlog_debug( "%s : starting g2rp timer for grp: %pFX - rp: %pPAs with timeout %d secs(Actual Hold time : %d secs)", @@ -358,7 +358,7 @@ static void pim_g2rp_timer_stop(struct bsm_rpinfo *bsrp) __func__, &bsrp->bsgrp_node->group, &bsrp->rp_address); - THREAD_OFF(bsrp->g2rp_timer); + EVENT_OFF(bsrp->g2rp_timer); } static bool is_hold_time_zero(void *data) diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index 41b093ab5..15c337901 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -193,9 +193,9 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch) ch->upstream = NULL; - THREAD_OFF(ch->t_ifjoin_expiry_timer); - THREAD_OFF(ch->t_ifjoin_prune_pending_timer); - THREAD_OFF(ch->t_ifassert_timer); + EVENT_OFF(ch->t_ifjoin_expiry_timer); + EVENT_OFF(ch->t_ifjoin_prune_pending_timer); + EVENT_OFF(ch->t_ifassert_timer); if (ch->parent) { listnode_delete(ch->parent->sources, ch); @@ -411,7 +411,7 @@ const char *pim_ifchannel_ifassert_name(enum pim_ifassert_state ifassert_state) */ void reset_ifassert_state(struct pim_ifchannel *ch) { - THREAD_OFF(ch->t_ifassert_timer); + EVENT_OFF(ch->t_ifassert_timer); pim_ifassert_winner_set(ch, PIM_IFASSERT_NOINFO, PIMADDR_ANY, router->infinite_assert_metric); @@ -632,7 +632,7 @@ static void on_ifjoin_expiry_timer(struct event *t) { struct pim_ifchannel *ch; - ch = THREAD_ARG(t); + ch = EVENT_ARG(t); if (PIM_DEBUG_PIM_TRACE) zlog_debug("%s: ifchannel %s expiry timer", __func__, @@ -649,7 +649,7 @@ static void on_ifjoin_prune_pending_timer(struct event *t) struct interface *ifp; struct pim_interface *pim_ifp; - ch = THREAD_ARG(t); + ch = EVENT_ARG(t); if (PIM_DEBUG_PIM_TRACE) zlog_debug("%s: IFCHANNEL%pSG %s Prune Pending Timer Popped", @@ -920,13 +920,13 @@ void pim_ifchannel_join_add(struct interface *ifp, pim_addr neigh_addr, return; } } - THREAD_OFF(ch->t_ifjoin_expiry_timer); + EVENT_OFF(ch->t_ifjoin_expiry_timer); break; case PIM_IFJOIN_PRUNE: if (source_flags & PIM_ENCODE_RPT_BIT) { pim_ifchannel_ifjoin_switch(__func__, ch, PIM_IFJOIN_NOINFO); - THREAD_OFF(ch->t_ifjoin_expiry_timer); + EVENT_OFF(ch->t_ifjoin_expiry_timer); delete_on_noinfo(ch); return; } else @@ -943,7 +943,7 @@ void pim_ifchannel_join_add(struct interface *ifp, pim_addr neigh_addr, * maximum of its current value and the HoldTime from the * triggering Join/Prune message. */ - THREAD_OFF(ch->t_ifjoin_prune_pending_timer); + EVENT_OFF(ch->t_ifjoin_prune_pending_timer); /* Check if SGRpt join Received */ if ((source_flags & PIM_ENCODE_RPT_BIT) && @@ -955,7 +955,7 @@ void pim_ifchannel_join_add(struct interface *ifp, pim_addr neigh_addr, * I transitions to the NoInfo state.The ET and PPT are * cancelled. */ - THREAD_OFF(ch->t_ifjoin_expiry_timer); + EVENT_OFF(ch->t_ifjoin_expiry_timer); pim_ifchannel_ifjoin_switch(__func__, ch, PIM_IFJOIN_NOINFO); return; @@ -970,7 +970,7 @@ void pim_ifchannel_join_add(struct interface *ifp, pim_addr neigh_addr, if (remain > holdtime) return; } - THREAD_OFF(ch->t_ifjoin_expiry_timer); + EVENT_OFF(ch->t_ifjoin_expiry_timer); break; case PIM_IFJOIN_PRUNE_TMP: @@ -1030,8 +1030,8 @@ void pim_ifchannel_prune(struct interface *ifp, pim_addr upstream, be taken not to use "ch" afterwards since it would be deleted. */ - THREAD_OFF(ch->t_ifjoin_prune_pending_timer); - THREAD_OFF(ch->t_ifjoin_expiry_timer); + EVENT_OFF(ch->t_ifjoin_prune_pending_timer); + EVENT_OFF(ch->t_ifjoin_expiry_timer); event_add_timer_msec(router->master, on_ifjoin_prune_pending_timer, ch, jp_override_interval_msec, @@ -1068,7 +1068,7 @@ void pim_ifchannel_prune(struct interface *ifp, pim_addr upstream, /* If we called ifjoin_prune() directly instead, care should be taken not to use "ch" afterwards since it would be deleted. */ - THREAD_OFF(ch->t_ifjoin_prune_pending_timer); + EVENT_OFF(ch->t_ifjoin_prune_pending_timer); event_add_timer_msec(router->master, on_ifjoin_prune_pending_timer, ch, jp_override_interval_msec, @@ -1076,7 +1076,7 @@ void pim_ifchannel_prune(struct interface *ifp, pim_addr upstream, break; case PIM_IFJOIN_PRUNE: if (source_flags & PIM_ENCODE_RPT_BIT) { - THREAD_OFF(ch->t_ifjoin_prune_pending_timer); + EVENT_OFF(ch->t_ifjoin_prune_pending_timer); /* * While in Prune State, Receive SGRpt Prune. * RFC 7761 Sec 4.5.3: @@ -1092,7 +1092,7 @@ void pim_ifchannel_prune(struct interface *ifp, pim_addr upstream, if (rem > holdtime) return; - THREAD_OFF(ch->t_ifjoin_expiry_timer); + EVENT_OFF(ch->t_ifjoin_expiry_timer); } event_add_timer(router->master, on_ifjoin_expiry_timer, @@ -1103,7 +1103,7 @@ void pim_ifchannel_prune(struct interface *ifp, pim_addr upstream, case PIM_IFJOIN_PRUNE_TMP: if (source_flags & PIM_ENCODE_RPT_BIT) { ch->ifjoin_state = PIM_IFJOIN_PRUNE; - THREAD_OFF(ch->t_ifjoin_expiry_timer); + EVENT_OFF(ch->t_ifjoin_expiry_timer); event_add_timer(router->master, on_ifjoin_expiry_timer, ch, holdtime, &ch->t_ifjoin_expiry_timer); @@ -1112,7 +1112,7 @@ void pim_ifchannel_prune(struct interface *ifp, pim_addr upstream, case PIM_IFJOIN_PRUNE_PENDING_TMP: if (source_flags & PIM_ENCODE_RPT_BIT) { ch->ifjoin_state = PIM_IFJOIN_PRUNE_PENDING; - THREAD_OFF(ch->t_ifjoin_expiry_timer); + EVENT_OFF(ch->t_ifjoin_expiry_timer); event_add_timer(router->master, on_ifjoin_expiry_timer, ch, holdtime, &ch->t_ifjoin_expiry_timer); @@ -1466,8 +1466,8 @@ void pim_ifchannel_set_star_g_join_state(struct pim_ifchannel *ch, int eom, break; if (child->ifjoin_state == PIM_IFJOIN_PRUNE_PENDING_TMP) - THREAD_OFF(child->t_ifjoin_prune_pending_timer); - THREAD_OFF(child->t_ifjoin_expiry_timer); + EVENT_OFF(child->t_ifjoin_prune_pending_timer); + EVENT_OFF(child->t_ifjoin_expiry_timer); PIM_IF_FLAG_UNSET_S_G_RPT(child->flags); child->ifjoin_state = PIM_IFJOIN_NOINFO; diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index a8c125df2..063ba6edd 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -329,7 +329,7 @@ static void pim_igmp_other_querier_expire(struct event *t) { struct gm_sock *igmp; - igmp = THREAD_ARG(t); + igmp = EVENT_ARG(t); assert(!igmp->t_igmp_query_timer); @@ -377,7 +377,7 @@ void pim_igmp_other_querier_timer_on(struct gm_sock *igmp) "Querier %s resetting TIMER event for Other-Querier-Present", ifaddr_str); } - THREAD_OFF(igmp->t_other_querier_timer); + EVENT_OFF(igmp->t_other_querier_timer); } else { /* We are the current querier, then stop sending general queries: @@ -439,7 +439,7 @@ void pim_igmp_other_querier_timer_off(struct gm_sock *igmp) ifaddr_str, igmp->fd, igmp->interface->name); } } - THREAD_OFF(igmp->t_other_querier_timer); + EVENT_OFF(igmp->t_other_querier_timer); } int igmp_validate_checksum(char *igmp_msg, int igmp_msg_len) @@ -883,7 +883,7 @@ void pim_igmp_general_query_off(struct gm_sock *igmp) ifaddr_str, igmp->fd, igmp->interface->name); } } - THREAD_OFF(igmp->t_igmp_query_timer); + EVENT_OFF(igmp->t_igmp_query_timer); } /* Issue IGMP general query */ @@ -895,7 +895,7 @@ static void pim_igmp_general_query(struct event *t) struct pim_interface *pim_ifp; int query_buf_size; - igmp = THREAD_ARG(t); + igmp = EVENT_ARG(t); assert(igmp->interface); assert(igmp->interface->info); @@ -953,7 +953,7 @@ static void sock_close(struct gm_sock *igmp) igmp->interface->name); } } - THREAD_OFF(igmp->t_igmp_read); + EVENT_OFF(igmp->t_igmp_read); if (close(igmp->fd)) { flog_err( @@ -1045,7 +1045,7 @@ void igmp_group_delete(struct gm_group *group) igmp_source_delete(src); } - THREAD_OFF(group->t_group_query_retransmit_timer); + EVENT_OFF(group->t_group_query_retransmit_timer); group_timer_off(group); igmp_group_count_decr(pim_ifp); @@ -1211,7 +1211,7 @@ static void igmp_read_on(struct gm_sock *igmp); static void pim_igmp_read(struct event *t) { uint8_t buf[10000]; - struct gm_sock *igmp = (struct gm_sock *)THREAD_ARG(t); + struct gm_sock *igmp = (struct gm_sock *)EVENT_ARG(t); struct sockaddr_storage from; struct sockaddr_storage to; socklen_t fromlen = sizeof(from); @@ -1304,7 +1304,7 @@ static void igmp_group_timer(struct event *t) { struct gm_group *group; - group = THREAD_ARG(t); + group = EVENT_ARG(t); if (PIM_DEBUG_GM_TRACE) { char group_str[INET_ADDRSTRLEN]; @@ -1348,7 +1348,7 @@ static void group_timer_off(struct gm_group *group) zlog_debug("Cancelling TIMER event for group %s on %s", group_str, group->interface->name); } - THREAD_OFF(group->t_group_timer); + EVENT_OFF(group->t_group_timer); } void igmp_group_timer_on(struct gm_group *group, long interval_msec, diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c index 1906516a9..15078dd1e 100644 --- a/pimd/pim_igmpv3.c +++ b/pimd/pim_igmpv3.c @@ -112,7 +112,7 @@ static void igmp_source_timer(struct event *t) struct gm_source *source; struct gm_group *group; - source = THREAD_ARG(t); + source = EVENT_ARG(t); group = source->source_group; @@ -187,7 +187,7 @@ static void source_timer_off(struct gm_group *group, struct gm_source *source) group_str, source_str, group->interface->name); } - THREAD_OFF(source->t_source_timer); + EVENT_OFF(source->t_source_timer); } static void igmp_source_timer_on(struct gm_group *group, @@ -1206,7 +1206,7 @@ static void igmp_group_retransmit(struct event *t) int num_retransmit_sources_left; int send_with_sflag_set; /* boolean */ - group = THREAD_ARG(t); + group = EVENT_ARG(t); if (PIM_DEBUG_GM_TRACE) { char group_str[INET_ADDRSTRLEN]; diff --git a/pimd/pim_join.c b/pimd/pim_join.c index 20821d58b..671f7a37a 100644 --- a/pimd/pim_join.c +++ b/pimd/pim_join.c @@ -326,10 +326,9 @@ int pim_joinprune_recv(struct interface *ifp, struct pim_neighbor *neigh, if (PIM_IF_FLAG_TEST_S_G_RPT(child->flags)) { if (child->ifjoin_state == PIM_IFJOIN_PRUNE_PENDING_TMP) - THREAD_OFF( + EVENT_OFF( child->t_ifjoin_prune_pending_timer); - THREAD_OFF( - child->t_ifjoin_expiry_timer); + EVENT_OFF(child->t_ifjoin_expiry_timer); PIM_IF_FLAG_UNSET_S_G_RPT(child->flags); child->ifjoin_state = PIM_IFJOIN_NOINFO; delete_on_noinfo(child); diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index f3c6ef650..4d5da3182 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -775,7 +775,7 @@ static void mroute_read(struct event *t) int cont = 1; int rd; ifindex_t ifindex; - pim = THREAD_ARG(t); + pim = EVENT_ARG(t); while (cont) { rd = pim_socket_recvfromto(pim->mroute_socket, (uint8_t *)buf, @@ -815,7 +815,7 @@ static void mroute_read_on(struct pim_instance *pim) static void mroute_read_off(struct pim_instance *pim) { - THREAD_OFF(pim->thread); + EVENT_OFF(pim->thread); } int pim_mroute_socket_enable(struct pim_instance *pim) diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index 9726da544..18146db52 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -56,7 +56,7 @@ static void pim_msdp_sa_timer_expiry_log(struct pim_msdp_sa *sa, /* RFC-3618:Sec-5.1 - global active source advertisement timer */ static void pim_msdp_sa_adv_timer_cb(struct event *t) { - struct pim_instance *pim = THREAD_ARG(t); + struct pim_instance *pim = EVENT_ARG(t); if (PIM_DEBUG_MSDP_EVENTS) { zlog_debug("MSDP SA advertisement timer expired"); @@ -68,7 +68,7 @@ static void pim_msdp_sa_adv_timer_cb(struct event *t) static void pim_msdp_sa_adv_timer_setup(struct pim_instance *pim, bool start) { - THREAD_OFF(pim->msdp.sa_adv_timer); + EVENT_OFF(pim->msdp.sa_adv_timer); if (start) { event_add_timer(pim->msdp.master, pim_msdp_sa_adv_timer_cb, pim, PIM_MSDP_SA_ADVERTISMENT_TIME, @@ -81,7 +81,7 @@ static void pim_msdp_sa_state_timer_cb(struct event *t) { struct pim_msdp_sa *sa; - sa = THREAD_ARG(t); + sa = EVENT_ARG(t); if (PIM_DEBUG_MSDP_EVENTS) { pim_msdp_sa_timer_expiry_log(sa, "state"); @@ -92,7 +92,7 @@ static void pim_msdp_sa_state_timer_cb(struct event *t) static void pim_msdp_sa_state_timer_setup(struct pim_msdp_sa *sa, bool start) { - THREAD_OFF(sa->sa_state_timer); + EVENT_OFF(sa->sa_state_timer); if (start) { event_add_timer(sa->pim->msdp.master, pim_msdp_sa_state_timer_cb, sa, @@ -865,7 +865,7 @@ static void pim_msdp_peer_hold_timer_cb(struct event *t) { struct pim_msdp_peer *mp; - mp = THREAD_ARG(t); + mp = EVENT_ARG(t); if (PIM_DEBUG_MSDP_EVENTS) { pim_msdp_peer_timer_expiry_log(mp, "hold"); @@ -884,7 +884,7 @@ static void pim_msdp_peer_hold_timer_cb(struct event *t) static void pim_msdp_peer_hold_timer_setup(struct pim_msdp_peer *mp, bool start) { struct pim_instance *pim = mp->pim; - THREAD_OFF(mp->hold_timer); + EVENT_OFF(mp->hold_timer); if (start) { event_add_timer(pim->msdp.master, pim_msdp_peer_hold_timer_cb, mp, pim->msdp.hold_time, &mp->hold_timer); @@ -897,7 +897,7 @@ static void pim_msdp_peer_ka_timer_cb(struct event *t) { struct pim_msdp_peer *mp; - mp = THREAD_ARG(t); + mp = EVENT_ARG(t); if (PIM_DEBUG_MSDP_EVENTS) { pim_msdp_peer_timer_expiry_log(mp, "ka"); @@ -909,7 +909,7 @@ static void pim_msdp_peer_ka_timer_cb(struct event *t) static void pim_msdp_peer_ka_timer_setup(struct pim_msdp_peer *mp, bool start) { - THREAD_OFF(mp->ka_timer); + EVENT_OFF(mp->ka_timer); if (start) { event_add_timer(mp->pim->msdp.master, pim_msdp_peer_ka_timer_cb, mp, mp->pim->msdp.keep_alive, &mp->ka_timer); @@ -957,7 +957,7 @@ static void pim_msdp_peer_cr_timer_cb(struct event *t) { struct pim_msdp_peer *mp; - mp = THREAD_ARG(t); + mp = EVENT_ARG(t); if (PIM_DEBUG_MSDP_EVENTS) { pim_msdp_peer_timer_expiry_log(mp, "connect-retry"); @@ -972,7 +972,7 @@ static void pim_msdp_peer_cr_timer_cb(struct event *t) static void pim_msdp_peer_cr_timer_setup(struct pim_msdp_peer *mp, bool start) { - THREAD_OFF(mp->cr_timer); + EVENT_OFF(mp->cr_timer); if (start) { event_add_timer(mp->pim->msdp.master, pim_msdp_peer_cr_timer_cb, mp, mp->pim->msdp.connection_retry, diff --git a/pimd/pim_msdp_packet.c b/pimd/pim_msdp_packet.c index 959aec0c7..0ec7aa77f 100644 --- a/pimd/pim_msdp_packet.c +++ b/pimd/pim_msdp_packet.c @@ -200,7 +200,7 @@ void pim_msdp_write(struct event *thread) int work_cnt = 0; int work_max_cnt = 100; - mp = THREAD_ARG(thread); + mp = EVENT_ARG(thread); mp->t_write = NULL; if (PIM_DEBUG_MSDP_INTERNAL) { @@ -692,7 +692,7 @@ void pim_msdp_read(struct event *thread) int rc; uint32_t len; - mp = THREAD_ARG(thread); + mp = EVENT_ARG(thread); mp->t_read = NULL; if (PIM_DEBUG_MSDP_INTERNAL) { diff --git a/pimd/pim_msdp_socket.c b/pimd/pim_msdp_socket.c index ff70cb8ca..57b313489 100644 --- a/pimd/pim_msdp_socket.c +++ b/pimd/pim_msdp_socket.c @@ -53,7 +53,7 @@ static void pim_msdp_update_sock_send_buffer_size(int fd) static void pim_msdp_sock_accept(struct event *thread) { union sockunion su; - struct pim_instance *pim = THREAD_ARG(thread); + struct pim_instance *pim = EVENT_ARG(thread); int accept_sock; int msdp_sock; struct pim_msdp_peer *mp; @@ -61,7 +61,7 @@ static void pim_msdp_sock_accept(struct event *thread) sockunion_init(&su); /* re-register accept thread */ - accept_sock = THREAD_FD(thread); + accept_sock = EVENT_FD(thread); if (accept_sock < 0) { flog_err(EC_LIB_DEVELOPMENT, "accept_sock is negative value %d", accept_sock); diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c index dbe2cbaf9..3d0ecb1bf 100644 --- a/pimd/pim_neighbor.c +++ b/pimd/pim_neighbor.c @@ -194,7 +194,7 @@ static void on_neighbor_timer(struct event *t) struct interface *ifp; char msg[100]; - neigh = THREAD_ARG(t); + neigh = EVENT_ARG(t); ifp = neigh->interface; @@ -220,7 +220,7 @@ void pim_neighbor_timer_reset(struct pim_neighbor *neigh, uint16_t holdtime) { neigh->holdtime = holdtime; - THREAD_OFF(neigh->t_expire_timer); + EVENT_OFF(neigh->t_expire_timer); /* 0xFFFF is request for no holdtime @@ -240,7 +240,7 @@ void pim_neighbor_timer_reset(struct pim_neighbor *neigh, uint16_t holdtime) static void on_neighbor_jp_timer(struct event *t) { - struct pim_neighbor *neigh = THREAD_ARG(t); + struct pim_neighbor *neigh = EVENT_ARG(t); struct pim_rpf rpf; if (PIM_DEBUG_PIM_TRACE) @@ -259,7 +259,7 @@ static void on_neighbor_jp_timer(struct event *t) static void pim_neighbor_start_jp_timer(struct pim_neighbor *neigh) { - THREAD_OFF(neigh->jp_timer); + EVENT_OFF(neigh->jp_timer); event_add_timer(router->master, on_neighbor_jp_timer, neigh, router->t_periodic, &neigh->jp_timer); } @@ -375,7 +375,7 @@ void pim_neighbor_free(struct pim_neighbor *neigh) delete_prefix_list(neigh); list_delete(&neigh->upstream_jp_agg); - THREAD_OFF(neigh->jp_timer); + EVENT_OFF(neigh->jp_timer); bfd_sess_free(&neigh->bfd_session); @@ -579,7 +579,7 @@ void pim_neighbor_delete(struct interface *ifp, struct pim_neighbor *neigh, zlog_notice("PIM NEIGHBOR DOWN: neighbor %pPA on interface %s: %s", &neigh->source_addr, ifp->name, delete_message); - THREAD_OFF(neigh->t_expire_timer); + EVENT_OFF(neigh->t_expire_timer); pim_if_assert_on_neighbor_down(ifp, neigh->source_addr); diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index bbe00aae6..ffd2d4283 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -70,7 +70,7 @@ static void sock_close(struct interface *ifp) pim_ifp->pim_sock_fd, ifp->name); } } - THREAD_OFF(pim_ifp->t_pim_sock_read); + EVENT_OFF(pim_ifp->t_pim_sock_read); if (PIM_DEBUG_PIM_TRACE) { if (pim_ifp->t_pim_hello_timer) { @@ -79,7 +79,7 @@ static void sock_close(struct interface *ifp) ifp->name); } } - THREAD_OFF(pim_ifp->t_pim_hello_timer); + EVENT_OFF(pim_ifp->t_pim_hello_timer); if (PIM_DEBUG_PIM_TRACE) { zlog_debug("Deleting PIM socket fd=%d on interface %s", @@ -350,8 +350,8 @@ static void pim_sock_read(struct event *t) static long long count = 0; int cont = 1; - orig_ifp = ifp = THREAD_ARG(t); - fd = THREAD_FD(t); + orig_ifp = ifp = EVENT_ARG(t); + fd = EVENT_FD(t); pim_ifp = ifp->info; @@ -821,7 +821,7 @@ static void hello_resched(struct interface *ifp) zlog_debug("Rescheduling %d sec hello on interface %s", pim_ifp->pim_hello_period, ifp->name); } - THREAD_OFF(pim_ifp->t_pim_hello_timer); + EVENT_OFF(pim_ifp->t_pim_hello_timer); event_add_timer(router->master, on_pim_hello_send, ifp, pim_ifp->pim_hello_period, &pim_ifp->t_pim_hello_timer); } @@ -834,7 +834,7 @@ static void on_pim_hello_send(struct event *t) struct pim_interface *pim_ifp; struct interface *ifp; - ifp = THREAD_ARG(t); + ifp = EVENT_ARG(t); pim_ifp = ifp->info; /* @@ -923,7 +923,7 @@ void pim_hello_restart_triggered(struct interface *ifp) return; } - THREAD_OFF(pim_ifp->t_pim_hello_timer); + EVENT_OFF(pim_ifp->t_pim_hello_timer); } random_msec = triggered_hello_delay_msec; diff --git a/pimd/pim_register.c b/pimd/pim_register.c index 522381737..be8b4c400 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -743,7 +743,7 @@ void pim_reg_del_on_couldreg_fail(struct interface *ifp) && (up->reg_state != PIM_REG_NOINFO)) { pim_channel_del_oif(up->channel_oil, pim->regiface, PIM_OIF_FLAG_PROTO_PIM, __func__); - THREAD_OFF(up->t_rs_timer); + EVENT_OFF(up->t_rs_timer); up->reg_state = PIM_REG_NOINFO; } } diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c index 2073b4cb0..dadf29f53 100644 --- a/pimd/pim_ssmpingd.c +++ b/pimd/pim_ssmpingd.c @@ -196,7 +196,7 @@ static void ssmpingd_delete(struct ssmpingd_sock *ss) { assert(ss); - THREAD_OFF(ss->t_sock_read); + EVENT_OFF(ss->t_sock_read); if (close(ss->sock_fd)) { zlog_warn( @@ -290,7 +290,7 @@ static void ssmpingd_sock_read(struct event *t) { struct ssmpingd_sock *ss; - ss = THREAD_ARG(t); + ss = EVENT_ARG(t); ssmpingd_read_msg(ss); diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index b08c36326..283fdfc19 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -166,10 +166,10 @@ static void upstream_channel_oil_detach(struct pim_upstream *up) static void pim_upstream_timers_stop(struct pim_upstream *up) { - THREAD_OFF(up->t_ka_timer); - THREAD_OFF(up->t_rs_timer); - THREAD_OFF(up->t_msdp_reg_timer); - THREAD_OFF(up->t_join_timer); + EVENT_OFF(up->t_ka_timer); + EVENT_OFF(up->t_rs_timer); + EVENT_OFF(up->t_msdp_reg_timer); + EVENT_OFF(up->t_join_timer); } struct pim_upstream *pim_upstream_del(struct pim_instance *pim, @@ -293,7 +293,7 @@ static void on_join_timer(struct event *t) { struct pim_upstream *up; - up = THREAD_ARG(t); + up = EVENT_ARG(t); if (!up->rpf.source_nexthop.interface) { if (PIM_DEBUG_PIM_TRACE) @@ -323,7 +323,7 @@ static void join_timer_stop(struct pim_upstream *up) { struct pim_neighbor *nbr = NULL; - THREAD_OFF(up->t_join_timer); + EVENT_OFF(up->t_join_timer); if (up->rpf.source_nexthop.interface) nbr = pim_neighbor_find(up->rpf.source_nexthop.interface, @@ -353,7 +353,7 @@ void join_timer_start(struct pim_upstream *up) if (nbr) pim_jp_agg_add_group(nbr->upstream_jp_agg, up, 1, nbr); else { - THREAD_OFF(up->t_join_timer); + EVENT_OFF(up->t_join_timer); event_add_timer(router->master, on_join_timer, up, router->t_periodic, &up->t_join_timer); } @@ -370,7 +370,7 @@ void join_timer_start(struct pim_upstream *up) void pim_upstream_join_timer_restart(struct pim_upstream *up, struct pim_rpf *old) { - // THREAD_OFF(up->t_join_timer); + // EVENT_OFF(up->t_join_timer); join_timer_start(up); } @@ -382,7 +382,7 @@ static void pim_upstream_join_timer_restart_msec(struct pim_upstream *up, __func__, interval_msec, up->sg_str); } - THREAD_OFF(up->t_join_timer); + EVENT_OFF(up->t_join_timer); event_add_timer_msec(router->master, on_join_timer, up, interval_msec, &up->t_join_timer); } @@ -1361,7 +1361,7 @@ static void pim_upstream_fhr_kat_expiry(struct pim_instance *pim, up->sg_str); /* stop reg-stop timer */ - THREAD_OFF(up->t_rs_timer); + EVENT_OFF(up->t_rs_timer); /* remove regiface from the OIL if it is there*/ pim_channel_del_oif(up->channel_oil, pim->regiface, PIM_OIF_FLAG_PROTO_PIM, __func__); @@ -1465,7 +1465,7 @@ static void pim_upstream_keep_alive_timer(struct event *t) { struct pim_upstream *up; - up = THREAD_ARG(t); + up = EVENT_ARG(t); /* pull the stats and re-check */ if (pim_upstream_sg_running_proc(up)) @@ -1482,7 +1482,7 @@ void pim_upstream_keep_alive_timer_start(struct pim_upstream *up, uint32_t time) zlog_debug("kat start on %s with no stream reference", up->sg_str); } - THREAD_OFF(up->t_ka_timer); + EVENT_OFF(up->t_ka_timer); event_add_timer(router->master, pim_upstream_keep_alive_timer, up, time, &up->t_ka_timer); @@ -1496,7 +1496,7 @@ void pim_upstream_keep_alive_timer_start(struct pim_upstream *up, uint32_t time) /* MSDP on RP needs to know if a source is registerable to this RP */ static void pim_upstream_msdp_reg_timer(struct event *t) { - struct pim_upstream *up = THREAD_ARG(t); + struct pim_upstream *up = EVENT_ARG(t); struct pim_instance *pim = up->channel_oil->pim; /* source is no longer active - pull the SA from MSDP's cache */ @@ -1505,7 +1505,7 @@ static void pim_upstream_msdp_reg_timer(struct event *t) void pim_upstream_msdp_reg_timer_start(struct pim_upstream *up) { - THREAD_OFF(up->t_msdp_reg_timer); + EVENT_OFF(up->t_msdp_reg_timer); event_add_timer(router->master, pim_upstream_msdp_reg_timer, up, PIM_MSDP_REG_RXED_PERIOD, &up->t_msdp_reg_timer); @@ -1685,7 +1685,7 @@ static void pim_upstream_register_stop_timer(struct event *t) struct pim_interface *pim_ifp; struct pim_instance *pim; struct pim_upstream *up; - up = THREAD_ARG(t); + up = EVENT_ARG(t); pim = up->channel_oil->pim; if (PIM_DEBUG_PIM_TRACE) { @@ -1749,7 +1749,7 @@ void pim_upstream_start_register_stop_timer(struct pim_upstream *up, { uint32_t time; - THREAD_OFF(up->t_rs_timer); + EVENT_OFF(up->t_rs_timer); if (!null_register) { uint32_t lower = (0.5 * router->register_suppress_time); diff --git a/pimd/pim_vxlan.c b/pimd/pim_vxlan.c index 56a88babd..8df3c90f0 100644 --- a/pimd/pim_vxlan.c +++ b/pimd/pim_vxlan.c @@ -178,7 +178,7 @@ static void pim_vxlan_work_timer_cb(struct event *t) /* global 1second timer used for periodic processing */ static void pim_vxlan_work_timer_setup(bool start) { - THREAD_OFF(vxlan_info.work_timer); + EVENT_OFF(vxlan_info.work_timer); if (start) event_add_timer(router->master, pim_vxlan_work_timer_cb, NULL, PIM_VXLAN_WORK_TIME, &vxlan_info.work_timer); @@ -225,7 +225,7 @@ static void pim_vxlan_orig_mr_up_del(struct pim_vxlan_sg *vxlan_sg) * if there are no other references. */ if (PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up->flags)) { - THREAD_OFF(up->t_ka_timer); + EVENT_OFF(up->t_ka_timer); up = pim_upstream_keep_alive_timer_proc(up); } else { /* this is really unexpected as we force vxlan diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 502dd7c8e..69635e72b 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -387,7 +387,7 @@ void pim_scan_oil(struct pim_instance *pim) static void on_rpf_cache_refresh(struct event *t) { - struct pim_instance *pim = THREAD_ARG(t); + struct pim_instance *pim = EVENT_ARG(t); /* update kernel multicast forwarding cache (MFC) */ pim_scan_oil(pim); diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index fa5cbac47..0a994809b 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -37,7 +37,7 @@ static void zclient_lookup_connect(struct event *t) { struct zclient *zlookup; - zlookup = THREAD_ARG(t); + zlookup = EVENT_ARG(t); if (zlookup->sock >= 0) { return; @@ -114,7 +114,7 @@ static void zclient_lookup_failed(struct zclient *zlookup) void zclient_lookup_free(void) { - THREAD_OFF(zlookup_read); + EVENT_OFF(zlookup_read); zclient_stop(zlookup); zclient_free(zlookup); zlookup = NULL; @@ -366,7 +366,7 @@ static int zclient_lookup_nexthop_once(struct pim_instance *pim, void zclient_lookup_read_pipe(struct event *thread) { - struct zclient *zlookup = THREAD_ARG(thread); + struct zclient *zlookup = EVENT_ARG(thread); struct pim_instance *pim = pim_get_pim_instance(VRF_DEFAULT); struct pim_zlookup_nexthop nexthop_tab[10]; pim_addr l = PIMADDR_ANY; diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index a085bc3f9..db8502550 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -413,7 +413,7 @@ static void rip_interface_clean(struct rip_interface *ri) ri->enable_interface = 0; ri->running = 0; - THREAD_OFF(ri->t_wakeup); + EVENT_OFF(ri->t_wakeup); } void rip_interfaces_clean(struct rip *rip) @@ -472,7 +472,7 @@ int rip_if_down(struct interface *ifp) ri = ifp->info; - THREAD_OFF(ri->t_wakeup); + EVENT_OFF(ri->t_wakeup); rip = ri->rip; if (rip) { @@ -780,7 +780,7 @@ static void rip_interface_wakeup(struct event *t) struct rip_interface *ri; /* Get interface. */ - ifp = THREAD_ARG(t); + ifp = EVENT_ARG(t); ri = ifp->info; diff --git a/ripd/rip_nb_rpcs.c b/ripd/rip_nb_rpcs.c index be5528481..bbe3d0f0f 100644 --- a/ripd/rip_nb_rpcs.c +++ b/ripd/rip_nb_rpcs.c @@ -51,8 +51,8 @@ static void clear_rip_route(struct rip *rip) } if (rinfo) { - THREAD_OFF(rinfo->t_timeout); - THREAD_OFF(rinfo->t_garbage_collect); + EVENT_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_garbage_collect); listnode_delete(list, rinfo); rip_info_free(rinfo); } diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c index 99338f4e8..0f5a14557 100644 --- a/ripd/rip_peer.c +++ b/ripd/rip_peer.c @@ -23,7 +23,7 @@ static struct rip_peer *rip_peer_new(void) static void rip_peer_free(struct rip_peer *peer) { - THREAD_OFF(peer->t_timeout); + EVENT_OFF(peer->t_timeout); XFREE(MTYPE_RIP_PEER, peer); } @@ -56,7 +56,7 @@ static void rip_peer_timeout(struct event *t) { struct rip_peer *peer; - peer = THREAD_ARG(t); + peer = EVENT_ARG(t); listnode_delete(peer->rip->peer_list, peer); rip_peer_free(peer); } @@ -69,7 +69,7 @@ static struct rip_peer *rip_peer_get(struct rip *rip, struct in_addr *addr) peer = rip_peer_lookup(rip, addr); if (peer) { - THREAD_OFF(peer->t_timeout); + EVENT_OFF(peer->t_timeout); } else { peer = rip_peer_new(); peer->rip = rip; diff --git a/ripd/ripd.c b/ripd/ripd.c index 766176751..5e07ca48f 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -126,10 +126,10 @@ static void rip_garbage_collect(struct event *t) struct rip_info *rinfo; struct route_node *rp; - rinfo = THREAD_ARG(t); + rinfo = EVENT_ARG(t); /* Off timeout timer. */ - THREAD_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_timeout); /* Get route_node pointer. */ rp = rinfo->rp; @@ -211,14 +211,14 @@ struct rip_info *rip_ecmp_replace(struct rip *rip, struct rip_info *rinfo_new) if (tmp_rinfo == rinfo) continue; - THREAD_OFF(tmp_rinfo->t_timeout); - THREAD_OFF(tmp_rinfo->t_garbage_collect); + EVENT_OFF(tmp_rinfo->t_timeout); + EVENT_OFF(tmp_rinfo->t_garbage_collect); list_delete_node(list, node); rip_info_free(tmp_rinfo); } - THREAD_OFF(rinfo->t_timeout); - THREAD_OFF(rinfo->t_garbage_collect); + EVENT_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_garbage_collect); memcpy(rinfo, rinfo_new, sizeof(struct rip_info)); if (rip_route_rte(rinfo)) { @@ -247,12 +247,12 @@ struct rip_info *rip_ecmp_delete(struct rip *rip, struct rip_info *rinfo) struct route_node *rp = rinfo->rp; struct list *list = (struct list *)rp->info; - THREAD_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_timeout); if (listcount(list) > 1) { /* Some other ECMP entries still exist. Just delete this entry. */ - THREAD_OFF(rinfo->t_garbage_collect); + EVENT_OFF(rinfo->t_garbage_collect); listnode_delete(list, rinfo); if (rip_route_rte(rinfo) && CHECK_FLAG(rinfo->flags, RIP_RTF_FIB)) @@ -289,7 +289,7 @@ struct rip_info *rip_ecmp_delete(struct rip *rip, struct rip_info *rinfo) /* Timeout RIP routes. */ static void rip_timeout(struct event *t) { - struct rip_info *rinfo = THREAD_ARG(t); + struct rip_info *rinfo = EVENT_ARG(t); struct rip *rip = rip_info_get_instance(rinfo); rip_ecmp_delete(rip, rinfo); @@ -298,7 +298,7 @@ static void rip_timeout(struct event *t) static void rip_timeout_update(struct rip *rip, struct rip_info *rinfo) { if (rinfo->metric != RIP_METRIC_INFINITY) { - THREAD_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_timeout); event_add_timer(master, rip_timeout, rinfo, rip->timeout_time, &rinfo->t_timeout); } @@ -644,8 +644,8 @@ static void rip_rte_process(struct rte *rte, struct sockaddr_in *from, assert(newinfo.metric != RIP_METRIC_INFINITY); - THREAD_OFF(rinfo->t_timeout); - THREAD_OFF(rinfo->t_garbage_collect); + EVENT_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_garbage_collect); memcpy(rinfo, &newinfo, sizeof(struct rip_info)); rip_timeout_update(rip, rinfo); @@ -1598,7 +1598,7 @@ void rip_redistribute_delete(struct rip *rip, int type, int sub_type, RIP_TIMER_ON(rinfo->t_garbage_collect, rip_garbage_collect, rip->garbage_time); - THREAD_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_timeout); rinfo->flags |= RIP_RTF_CHANGED; if (IS_RIP_DEBUG_EVENT) @@ -1699,7 +1699,7 @@ static void rip_request_process(struct rip_packet *packet, int size, /* First entry point of RIP packet. */ static void rip_read(struct event *t) { - struct rip *rip = THREAD_ARG(t); + struct rip *rip = EVENT_ARG(t); int sock; int ret; int rtenum; @@ -1715,7 +1715,7 @@ static void rip_read(struct event *t) struct prefix p; /* Fetch socket then register myself. */ - sock = THREAD_FD(t); + sock = EVENT_FD(t); /* Add myself to tne next event */ rip_event(rip, RIP_READ, sock); @@ -2480,7 +2480,7 @@ static void rip_update_process(struct rip *rip, int route_type) /* RIP's periodical timer. */ static void rip_update(struct event *t) { - struct rip *rip = THREAD_ARG(t); + struct rip *rip = EVENT_ARG(t); if (IS_RIP_DEBUG_EVENT) zlog_debug("update timer fire!"); @@ -2490,7 +2490,7 @@ static void rip_update(struct event *t) /* Triggered updates may be suppressed if a regular update is due by the time the triggered update would be sent. */ - THREAD_OFF(rip->t_triggered_interval); + EVENT_OFF(rip->t_triggered_interval); rip->trigger = 0; /* Register myself. */ @@ -2522,7 +2522,7 @@ static void rip_clear_changed_flag(struct rip *rip) /* Triggered update interval timer. */ static void rip_triggered_interval(struct event *t) { - struct rip *rip = THREAD_ARG(t); + struct rip *rip = EVENT_ARG(t); if (rip->trigger) { rip->trigger = 0; @@ -2533,11 +2533,11 @@ static void rip_triggered_interval(struct event *t) /* Execute triggered update. */ static void rip_triggered_update(struct event *t) { - struct rip *rip = THREAD_ARG(t); + struct rip *rip = EVENT_ARG(t); int interval; /* Cancel interval timer. */ - THREAD_OFF(rip->t_triggered_interval); + EVENT_OFF(rip->t_triggered_interval); rip->trigger = 0; /* Logging triggered update. */ @@ -2587,7 +2587,7 @@ void rip_redistribute_withdraw(struct rip *rip, int type) rinfo->metric = RIP_METRIC_INFINITY; RIP_TIMER_ON(rinfo->t_garbage_collect, rip_garbage_collect, rip->garbage_time); - THREAD_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_timeout); rinfo->flags |= RIP_RTF_CHANGED; if (IS_RIP_DEBUG_EVENT) { @@ -2769,7 +2769,7 @@ void rip_event(struct rip *rip, enum rip_event event, int sock) event_add_read(master, rip_read, rip, sock, &rip->t_read); break; case RIP_UPDATE_EVENT: - THREAD_OFF(rip->t_update); + EVENT_OFF(rip->t_update); jitter = rip_update_jitter(rip->update_time); event_add_timer(master, rip_update, rip, sock ? 2 : rip->update_time + jitter, @@ -2899,8 +2899,8 @@ void rip_ecmp_disable(struct rip *rip) if (tmp_rinfo == rinfo) continue; - THREAD_OFF(tmp_rinfo->t_timeout); - THREAD_OFF(tmp_rinfo->t_garbage_collect); + EVENT_OFF(tmp_rinfo->t_timeout); + EVENT_OFF(tmp_rinfo->t_garbage_collect); list_delete_node(list, node); rip_info_free(tmp_rinfo); } @@ -3492,8 +3492,8 @@ static void rip_instance_disable(struct rip *rip) rip_zebra_ipv4_delete(rip, rp); for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) { - THREAD_OFF(rinfo->t_timeout); - THREAD_OFF(rinfo->t_garbage_collect); + EVENT_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_garbage_collect); rip_info_free(rinfo); } list_delete(&list); @@ -3505,12 +3505,12 @@ static void rip_instance_disable(struct rip *rip) rip_redistribute_disable(rip); /* Cancel RIP related timers. */ - THREAD_OFF(rip->t_update); - THREAD_OFF(rip->t_triggered_update); - THREAD_OFF(rip->t_triggered_interval); + EVENT_OFF(rip->t_update); + EVENT_OFF(rip->t_triggered_update); + EVENT_OFF(rip->t_triggered_interval); /* Cancel read thread. */ - THREAD_OFF(rip->t_read); + EVENT_OFF(rip->t_read); /* Close RIP socket. */ close(rip->sock); diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index e88936cda..516e280b0 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -155,7 +155,7 @@ static int ripng_if_down(struct interface *ifp) ri = ifp->info; - THREAD_OFF(ri->t_wakeup); + EVENT_OFF(ri->t_wakeup); ripng = ri->ripng; @@ -301,7 +301,7 @@ void ripng_interface_clean(struct ripng *ripng) ri->enable_interface = 0; ri->running = 0; - THREAD_OFF(ri->t_wakeup); + EVENT_OFF(ri->t_wakeup); } } @@ -592,7 +592,7 @@ static void ripng_interface_wakeup(struct event *t) struct ripng_interface *ri; /* Get interface. */ - ifp = THREAD_ARG(t); + ifp = EVENT_ARG(t); ri = ifp->info; diff --git a/ripngd/ripng_nb_rpcs.c b/ripngd/ripng_nb_rpcs.c index 381ff717c..b23572d49 100644 --- a/ripngd/ripng_nb_rpcs.c +++ b/ripngd/ripng_nb_rpcs.c @@ -53,8 +53,8 @@ static void clear_ripng_route(struct ripng *ripng) } if (rinfo) { - THREAD_OFF(rinfo->t_timeout); - THREAD_OFF(rinfo->t_garbage_collect); + EVENT_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_garbage_collect); listnode_delete(list, rinfo); ripng_info_free(rinfo); } diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c index a40f4b1eb..c03f2a4df 100644 --- a/ripngd/ripng_peer.c +++ b/ripngd/ripng_peer.c @@ -28,7 +28,7 @@ static struct ripng_peer *ripng_peer_new(void) static void ripng_peer_free(struct ripng_peer *peer) { - THREAD_OFF(peer->t_timeout); + EVENT_OFF(peer->t_timeout); XFREE(MTYPE_RIPNG_PEER, peer); } @@ -64,7 +64,7 @@ static void ripng_peer_timeout(struct event *t) { struct ripng_peer *peer; - peer = THREAD_ARG(t); + peer = EVENT_ARG(t); listnode_delete(peer->ripng->peer_list, peer); ripng_peer_free(peer); } @@ -78,7 +78,7 @@ static struct ripng_peer *ripng_peer_get(struct ripng *ripng, peer = ripng_peer_lookup(ripng, addr); if (peer) { - THREAD_OFF(peer->t_timeout); + EVENT_OFF(peer->t_timeout); } else { peer = ripng_peer_new(); peer->ripng = ripng; diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 10a9ce574..18456ac48 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -413,10 +413,10 @@ static void ripng_garbage_collect(struct event *t) struct ripng_info *rinfo; struct agg_node *rp; - rinfo = THREAD_ARG(t); + rinfo = EVENT_ARG(t); /* Off timeout timer. */ - THREAD_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_timeout); /* Get route_node pointer. */ rp = rinfo->rp; @@ -503,14 +503,14 @@ struct ripng_info *ripng_ecmp_replace(struct ripng *ripng, /* Re-use the first entry, and delete the others. */ for (ALL_LIST_ELEMENTS(list, node, nextnode, tmp_rinfo)) if (tmp_rinfo != rinfo) { - THREAD_OFF(tmp_rinfo->t_timeout); - THREAD_OFF(tmp_rinfo->t_garbage_collect); + EVENT_OFF(tmp_rinfo->t_timeout); + EVENT_OFF(tmp_rinfo->t_garbage_collect); list_delete_node(list, node); ripng_info_free(tmp_rinfo); } - THREAD_OFF(rinfo->t_timeout); - THREAD_OFF(rinfo->t_garbage_collect); + EVENT_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_garbage_collect); memcpy(rinfo, rinfo_new, sizeof(struct ripng_info)); if (ripng_route_rte(rinfo)) { @@ -542,7 +542,7 @@ struct ripng_info *ripng_ecmp_delete(struct ripng *ripng, struct agg_node *rp = rinfo->rp; struct list *list = (struct list *)rp->info; - THREAD_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_timeout); if (rinfo->metric != RIPNG_METRIC_INFINITY) ripng_aggregate_decrement(rp, rinfo); @@ -550,7 +550,7 @@ struct ripng_info *ripng_ecmp_delete(struct ripng *ripng, if (listcount(list) > 1) { /* Some other ECMP entries still exist. Just delete this entry. */ - THREAD_OFF(rinfo->t_garbage_collect); + EVENT_OFF(rinfo->t_garbage_collect); listnode_delete(list, rinfo); if (ripng_route_rte(rinfo) && CHECK_FLAG(rinfo->flags, RIPNG_RTF_FIB)) @@ -587,7 +587,7 @@ struct ripng_info *ripng_ecmp_delete(struct ripng *ripng, /* Timeout RIPng routes. */ static void ripng_timeout(struct event *t) { - struct ripng_info *rinfo = THREAD_ARG(t); + struct ripng_info *rinfo = EVENT_ARG(t); struct ripng *ripng = ripng_info_get_instance(rinfo); ripng_ecmp_delete(ripng, rinfo); @@ -596,7 +596,7 @@ static void ripng_timeout(struct event *t) static void ripng_timeout_update(struct ripng *ripng, struct ripng_info *rinfo) { if (rinfo->metric != RIPNG_METRIC_INFINITY) { - THREAD_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_timeout); event_add_timer(master, ripng_timeout, rinfo, ripng->timeout_time, &rinfo->t_timeout); } @@ -1007,7 +1007,7 @@ void ripng_redistribute_delete(struct ripng *ripng, int type, int sub_type, RIPNG_TIMER_ON(rinfo->t_garbage_collect, ripng_garbage_collect, ripng->garbage_time); - THREAD_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_timeout); /* Aggregate count decrement. */ ripng_aggregate_decrement(rp, rinfo); @@ -1046,7 +1046,7 @@ void ripng_redistribute_withdraw(struct ripng *ripng, int type) RIPNG_TIMER_ON(rinfo->t_garbage_collect, ripng_garbage_collect, ripng->garbage_time); - THREAD_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_timeout); /* Aggregate count decrement. */ ripng_aggregate_decrement(rp, rinfo); @@ -1284,7 +1284,7 @@ static void ripng_request_process(struct ripng_packet *packet, int size, /* First entry point of reading RIPng packet. */ static void ripng_read(struct event *thread) { - struct ripng *ripng = THREAD_ARG(thread); + struct ripng *ripng = EVENT_ARG(thread); int len; int sock; struct sockaddr_in6 from; @@ -1299,7 +1299,7 @@ static void ripng_read(struct event *thread) /* Fetch thread data and set read pointer to empty for event managing. `sock' sould be same as ripng->sock. */ - sock = THREAD_FD(thread); + sock = EVENT_FD(thread); /* Add myself to the next event. */ ripng_event(ripng, RIPNG_READ, sock); @@ -1392,7 +1392,7 @@ static void ripng_clear_changed_flag(struct ripng *ripng) enabled interface. */ static void ripng_update(struct event *t) { - struct ripng *ripng = THREAD_ARG(t); + struct ripng *ripng = EVENT_ARG(t); struct interface *ifp; struct ripng_interface *ri; @@ -1430,7 +1430,7 @@ static void ripng_update(struct event *t) /* Triggered updates may be suppressed if a regular update is due by the time the triggered update would be sent. */ - THREAD_OFF(ripng->t_triggered_interval); + EVENT_OFF(ripng->t_triggered_interval); ripng->trigger = 0; /* Reset flush event. */ @@ -1440,7 +1440,7 @@ static void ripng_update(struct event *t) /* Triggered update interval timer. */ static void ripng_triggered_interval(struct event *t) { - struct ripng *ripng = THREAD_ARG(t); + struct ripng *ripng = EVENT_ARG(t); if (ripng->trigger) { ripng->trigger = 0; @@ -1451,13 +1451,13 @@ static void ripng_triggered_interval(struct event *t) /* Execute triggered update. */ void ripng_triggered_update(struct event *t) { - struct ripng *ripng = THREAD_ARG(t); + struct ripng *ripng = EVENT_ARG(t); struct interface *ifp; struct ripng_interface *ri; int interval; /* Cancel interval timer. */ - THREAD_OFF(ripng->t_triggered_interval); + EVENT_OFF(ripng->t_triggered_interval); ripng->trigger = 0; /* Logging triggered update. */ @@ -1901,7 +1901,7 @@ void ripng_event(struct ripng *ripng, enum ripng_event event, int sock) event_add_read(master, ripng_read, ripng, sock, &ripng->t_read); break; case RIPNG_UPDATE_EVENT: - THREAD_OFF(ripng->t_update); + EVENT_OFF(ripng->t_update); /* Update timer jitter. */ jitter = ripng_update_jitter(ripng->update_time); @@ -2194,9 +2194,8 @@ void ripng_ecmp_disable(struct ripng *ripng) /* Drop all other entries, except the first one. */ for (ALL_LIST_ELEMENTS(list, node, nextnode, tmp_rinfo)) if (tmp_rinfo != rinfo) { - THREAD_OFF(tmp_rinfo->t_timeout); - THREAD_OFF( - tmp_rinfo->t_garbage_collect); + EVENT_OFF(tmp_rinfo->t_timeout); + EVENT_OFF(tmp_rinfo->t_garbage_collect); list_delete_node(list, node); ripng_info_free(tmp_rinfo); } @@ -2513,8 +2512,8 @@ static void ripng_instance_disable(struct ripng *ripng) ripng_zebra_ipv6_delete(ripng, rp); for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) { - THREAD_OFF(rinfo->t_timeout); - THREAD_OFF(rinfo->t_garbage_collect); + EVENT_OFF(rinfo->t_timeout); + EVENT_OFF(rinfo->t_garbage_collect); ripng_info_free(rinfo); } list_delete(&list); @@ -2533,12 +2532,12 @@ static void ripng_instance_disable(struct ripng *ripng) ripng_redistribute_disable(ripng); /* Cancel the RIPng timers */ - THREAD_OFF(ripng->t_update); - THREAD_OFF(ripng->t_triggered_update); - THREAD_OFF(ripng->t_triggered_interval); + EVENT_OFF(ripng->t_update); + EVENT_OFF(ripng->t_triggered_update); + EVENT_OFF(ripng->t_triggered_interval); /* Cancel the read thread */ - THREAD_OFF(ripng->t_read); + EVENT_OFF(ripng->t_read); /* Close the RIPng socket */ if (ripng->sock >= 0) { diff --git a/tests/helpers/c/main.c b/tests/helpers/c/main.c index 09f20e44b..4ae72fa29 100644 --- a/tests/helpers/c/main.c +++ b/tests/helpers/c/main.c @@ -35,7 +35,7 @@ DEFUN (daemon_exit, static int timer_count; static void test_timer(struct event *thread) { - int *count = THREAD_ARG(thread); + int *count = EVENT_ARG(thread); printf("run %d of timer\n", (*count)++); event_add_timer(master, test_timer, count, 5, NULL); diff --git a/tests/lib/test_heavy_thread.c b/tests/lib/test_heavy_thread.c index bd5ecf37c..f931894ff 100644 --- a/tests/lib/test_heavy_thread.c +++ b/tests/lib/test_heavy_thread.c @@ -58,7 +58,7 @@ static void slow_func(struct vty *vty, const char *str, const int i) static void clear_something(struct event *thread) { - struct work_state *ws = THREAD_ARG(thread); + struct work_state *ws = EVENT_ARG(thread); /* this could be like iterating through 150k of route_table * or worse, iterating through a list of peers, to bgp_stop them with diff --git a/vrrpd/vrrp.c b/vrrpd/vrrp.c index 0bccdce36..7a779307d 100644 --- a/vrrpd/vrrp.c +++ b/vrrpd/vrrp.c @@ -900,7 +900,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src, if (pkt->hdr.priority == 0) { vrrp_send_advertisement(r); - THREAD_OFF(r->t_adver_timer); + EVENT_OFF(r->t_adver_timer); event_add_timer_msec(master, vrrp_adver_timer_expire, r, r->vr->advertisement_interval * CS2MS, @@ -913,13 +913,13 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src, "Received advertisement from %s w/ priority %hhu; switching to Backup", r->vr->vrid, family2str(r->family), sipstr, pkt->hdr.priority); - THREAD_OFF(r->t_adver_timer); + EVENT_OFF(r->t_adver_timer); if (r->vr->version == 3) { r->master_adver_interval = htons(pkt->hdr.v3.adver_int); } vrrp_recalculate_timers(r); - THREAD_OFF(r->t_master_down_timer); + EVENT_OFF(r->t_master_down_timer); event_add_timer_msec(master, vrrp_master_down_timer_expire, r, r->master_down_interval * CS2MS, @@ -936,7 +936,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src, break; case VRRP_STATE_BACKUP: if (pkt->hdr.priority == 0) { - THREAD_OFF(r->t_master_down_timer); + EVENT_OFF(r->t_master_down_timer); event_add_timer_msec( master, vrrp_master_down_timer_expire, r, r->skew_time * CS2MS, &r->t_master_down_timer); @@ -947,7 +947,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src, ntohs(pkt->hdr.v3.adver_int); } vrrp_recalculate_timers(r); - THREAD_OFF(r->t_master_down_timer); + EVENT_OFF(r->t_master_down_timer); event_add_timer_msec(master, vrrp_master_down_timer_expire, r, r->master_down_interval * CS2MS, @@ -978,7 +978,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src, */ static void vrrp_read(struct event *thread) { - struct vrrp_router *r = THREAD_ARG(thread); + struct vrrp_router *r = EVENT_ARG(thread); struct vrrp_pkt *pkt; ssize_t pktsize; @@ -1405,7 +1405,7 @@ static void vrrp_change_state_backup(struct vrrp_router *r) vrrp_zebra_radv_set(r, false); /* Disable Adver_Timer */ - THREAD_OFF(r->t_adver_timer); + EVENT_OFF(r->t_adver_timer); r->advert_pending = false; r->garp_pending = false; @@ -1475,7 +1475,7 @@ static void vrrp_change_state(struct vrrp_router *r, int to) */ static void vrrp_adver_timer_expire(struct event *thread) { - struct vrrp_router *r = THREAD_ARG(thread); + struct vrrp_router *r = EVENT_ARG(thread); DEBUGD(&vrrp_dbg_proto, VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM @@ -1503,7 +1503,7 @@ static void vrrp_adver_timer_expire(struct event *thread) */ static void vrrp_master_down_timer_expire(struct event *thread) { - struct vrrp_router *r = THREAD_ARG(thread); + struct vrrp_router *r = EVENT_ARG(thread); zlog_info(VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM "Master_Down_Timer expired", @@ -1632,10 +1632,10 @@ static int vrrp_shutdown(struct vrrp_router *r) } /* Cancel all timers */ - THREAD_OFF(r->t_adver_timer); - THREAD_OFF(r->t_master_down_timer); - THREAD_OFF(r->t_read); - THREAD_OFF(r->t_write); + EVENT_OFF(r->t_adver_timer); + EVENT_OFF(r->t_master_down_timer); + EVENT_OFF(r->t_read); + EVENT_OFF(r->t_write); /* Protodown macvlan */ if (r->mvl_ifp) diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 8fb57872e..0a164ec16 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -3730,7 +3730,7 @@ static void vtysh_log_print(struct vtysh_client *vclient, static void vtysh_log_read(struct event *thread) { - struct vtysh_client *vclient = THREAD_ARG(thread); + struct vtysh_client *vclient = EVENT_ARG(thread); struct { struct zlog_live_hdr hdr; char text[4096]; @@ -3769,7 +3769,7 @@ static void vtysh_log_read(struct event *thread) "log monitor connection closed unexpectedly"); buf.hdr.textlen = strlen(buf.text); - THREAD_OFF(vclient->log_reader); + EVENT_OFF(vclient->log_reader); close(vclient->log_fd); vclient->log_fd = -1; @@ -3891,7 +3891,7 @@ DEFPY (no_vtysh_terminal_monitor, * a close notification... */ if (vclient->log_fd != -1) { - THREAD_OFF(vclient->log_reader); + EVENT_OFF(vclient->log_reader); close(vclient->log_fd); vclient->log_fd = -1; diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c index eab4ede05..1797fc0f0 100644 --- a/watchfrr/watchfrr.c +++ b/watchfrr/watchfrr.c @@ -349,7 +349,7 @@ static struct timeval *time_elapsed(struct timeval *result, static void restart_kill(struct event *t_kill) { - struct restart_info *restart = THREAD_ARG(t_kill); + struct restart_info *restart = EVENT_ARG(t_kill); struct timeval delay; time_elapsed(&delay, &restart->time); @@ -556,7 +556,7 @@ static int run_job(struct restart_info *restart, const char *cmdtype, static void wakeup_down(struct event *t_wakeup) { - struct daemon *dmn = THREAD_ARG(t_wakeup); + struct daemon *dmn = EVENT_ARG(t_wakeup); dmn->t_wakeup = NULL; if (try_connect(dmn) < 0) @@ -567,7 +567,7 @@ static void wakeup_down(struct event *t_wakeup) static void wakeup_init(struct event *t_wakeup) { - struct daemon *dmn = THREAD_ARG(t_wakeup); + struct daemon *dmn = EVENT_ARG(t_wakeup); dmn->t_wakeup = NULL; if (try_connect(dmn) < 0) { @@ -587,7 +587,7 @@ static void restart_done(struct daemon *dmn) dmn->name, state_str[dmn->state]); return; } - THREAD_OFF(dmn->t_wakeup); + EVENT_OFF(dmn->t_wakeup); if (try_connect(dmn) < 0) SET_WAKEUP_DOWN(dmn); @@ -612,9 +612,9 @@ static void daemon_down(struct daemon *dmn, const char *why) close(dmn->fd); dmn->fd = -1; } - THREAD_OFF(dmn->t_read); - THREAD_OFF(dmn->t_write); - THREAD_OFF(dmn->t_wakeup); + EVENT_OFF(dmn->t_read); + EVENT_OFF(dmn->t_write); + EVENT_OFF(dmn->t_wakeup); if (try_connect(dmn) < 0) SET_WAKEUP_DOWN(dmn); @@ -624,7 +624,7 @@ static void daemon_down(struct daemon *dmn, const char *why) static void handle_read(struct event *t_read) { - struct daemon *dmn = THREAD_ARG(t_read); + struct daemon *dmn = EVENT_ARG(t_read); static const char resp[sizeof(PING_TOKEN) + 4] = PING_TOKEN "\n"; char buf[sizeof(resp) + 100]; ssize_t rc; @@ -740,7 +740,7 @@ static void daemon_up(struct daemon *dmn, const char *why) if (gs.numdown == 0) { daemon_send_ready(0); - THREAD_OFF(gs.t_operational); + EVENT_OFF(gs.t_operational); event_add_timer(master, daemon_restarting_operational, NULL, gs.operational_timeout, &gs.t_operational); @@ -752,7 +752,7 @@ static void daemon_up(struct daemon *dmn, const char *why) static void check_connect(struct event *t_write) { - struct daemon *dmn = THREAD_ARG(t_write); + struct daemon *dmn = EVENT_ARG(t_write); int sockerr; socklen_t reslen = sizeof(sockerr); @@ -780,7 +780,7 @@ static void check_connect(struct event *t_write) static void wakeup_connect_hanging(struct event *t_wakeup) { - struct daemon *dmn = THREAD_ARG(t_wakeup); + struct daemon *dmn = EVENT_ARG(t_wakeup); char why[100]; dmn->t_wakeup = NULL; @@ -938,7 +938,7 @@ static void phase_check(void) gs.start_command, 1, 0); } gs.phase = PHASE_NONE; - THREAD_OFF(gs.t_phase_hanging); + EVENT_OFF(gs.t_phase_hanging); zlog_notice("Phased global restart has completed."); break; } @@ -987,7 +987,7 @@ static void try_restart(struct daemon *dmn) static void wakeup_unresponsive(struct event *t_wakeup) { - struct daemon *dmn = THREAD_ARG(t_wakeup); + struct daemon *dmn = EVENT_ARG(t_wakeup); dmn->t_wakeup = NULL; if (dmn->state != DAEMON_UNRESPONSIVE) @@ -1002,7 +1002,7 @@ static void wakeup_unresponsive(struct event *t_wakeup) static void wakeup_no_answer(struct event *t_wakeup) { - struct daemon *dmn = THREAD_ARG(t_wakeup); + struct daemon *dmn = EVENT_ARG(t_wakeup); dmn->t_wakeup = NULL; dmn->state = DAEMON_UNRESPONSIVE; @@ -1019,7 +1019,7 @@ static void wakeup_send_echo(struct event *t_wakeup) { static const char echocmd[] = "echo " PING_TOKEN; ssize_t rc; - struct daemon *dmn = THREAD_ARG(t_wakeup); + struct daemon *dmn = EVENT_ARG(t_wakeup); dmn->t_wakeup = NULL; if (((rc = write(dmn->fd, echocmd, sizeof(echocmd))) < 0) diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c index 03dd23feb..54bbc9933 100644 --- a/zebra/dplane_fpm_nl.c +++ b/zebra/dplane_fpm_nl.c @@ -437,8 +437,8 @@ static void fpm_reconnect(struct fpm_nl_ctx *fnc) stream_reset(fnc->ibuf); stream_reset(fnc->obuf); - THREAD_OFF(fnc->t_read); - THREAD_OFF(fnc->t_write); + EVENT_OFF(fnc->t_read); + EVENT_OFF(fnc->t_write); /* FPM is disabled, don't attempt to connect. */ if (fnc->disabled) @@ -450,7 +450,7 @@ static void fpm_reconnect(struct fpm_nl_ctx *fnc) static void fpm_read(struct event *t) { - struct fpm_nl_ctx *fnc = THREAD_ARG(t); + struct fpm_nl_ctx *fnc = EVENT_ARG(t); fpm_msg_hdr_t fpm; ssize_t rv; char buf[65535]; @@ -612,7 +612,7 @@ static void fpm_read(struct event *t) static void fpm_write(struct event *t) { - struct fpm_nl_ctx *fnc = THREAD_ARG(t); + struct fpm_nl_ctx *fnc = EVENT_ARG(t); socklen_t statuslen; ssize_t bwritten; int rv, status; @@ -716,7 +716,7 @@ static void fpm_write(struct event *t) static void fpm_connect(struct event *t) { - struct fpm_nl_ctx *fnc = THREAD_ARG(t); + struct fpm_nl_ctx *fnc = EVENT_ARG(t); struct sockaddr_in *sin = (struct sockaddr_in *)&fnc->addr; struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&fnc->addr; socklen_t slen; @@ -1022,7 +1022,7 @@ static int fpm_lsp_send_cb(struct hash_bucket *bucket, void *arg) static void fpm_lsp_send(struct event *t) { - struct fpm_nl_ctx *fnc = THREAD_ARG(t); + struct fpm_nl_ctx *fnc = EVENT_ARG(t); struct zebra_vrf *zvrf = vrf_info_lookup(VRF_DEFAULT); struct fpm_lsp_arg fla; @@ -1082,7 +1082,7 @@ static int fpm_nhg_send_cb(struct hash_bucket *bucket, void *arg) static void fpm_nhg_send(struct event *t) { - struct fpm_nl_ctx *fnc = THREAD_ARG(t); + struct fpm_nl_ctx *fnc = EVENT_ARG(t); struct fpm_nhg_arg fna; fna.fnc = fnc; @@ -1111,7 +1111,7 @@ static void fpm_nhg_send(struct event *t) */ static void fpm_rib_send(struct event *t) { - struct fpm_nl_ctx *fnc = THREAD_ARG(t); + struct fpm_nl_ctx *fnc = EVENT_ARG(t); rib_dest_t *dest; struct route_node *rn; struct route_table *rt; @@ -1218,7 +1218,7 @@ static void fpm_rmac_send(struct event *t) { struct fpm_rmac_arg fra; - fra.fnc = THREAD_ARG(t); + fra.fnc = EVENT_ARG(t); fra.ctx = dplane_ctx_alloc(); fra.complete = true; hash_iterate(zrouter.l3vni_table, fpm_enqueue_l3vni_table, &fra); @@ -1242,7 +1242,7 @@ static void fpm_nhg_reset_cb(struct hash_bucket *bucket, void *arg) static void fpm_nhg_reset(struct event *t) { - struct fpm_nl_ctx *fnc = THREAD_ARG(t); + struct fpm_nl_ctx *fnc = EVENT_ARG(t); hash_iterate(zrouter.nhgs_id, fpm_nhg_reset_cb, NULL); @@ -1262,7 +1262,7 @@ static void fpm_lsp_reset_cb(struct hash_bucket *bucket, void *arg) static void fpm_lsp_reset(struct event *t) { - struct fpm_nl_ctx *fnc = THREAD_ARG(t); + struct fpm_nl_ctx *fnc = EVENT_ARG(t); struct zebra_vrf *zvrf = vrf_info_lookup(VRF_DEFAULT); hash_iterate(zvrf->lsp_table, fpm_lsp_reset_cb, NULL); @@ -1276,7 +1276,7 @@ static void fpm_lsp_reset(struct event *t) */ static void fpm_rib_reset(struct event *t) { - struct fpm_nl_ctx *fnc = THREAD_ARG(t); + struct fpm_nl_ctx *fnc = EVENT_ARG(t); rib_dest_t *dest; struct route_node *rn; struct route_table *rt; @@ -1317,7 +1317,7 @@ static void fpm_unset_l3vni_table(struct hash_bucket *bucket, void *arg) static void fpm_rmac_reset(struct event *t) { - struct fpm_nl_ctx *fnc = THREAD_ARG(t); + struct fpm_nl_ctx *fnc = EVENT_ARG(t); hash_iterate(zrouter.l3vni_table, fpm_unset_l3vni_table, NULL); @@ -1328,7 +1328,7 @@ static void fpm_rmac_reset(struct event *t) static void fpm_process_queue(struct event *t) { - struct fpm_nl_ctx *fnc = THREAD_ARG(t); + struct fpm_nl_ctx *fnc = EVENT_ARG(t); struct zebra_dplane_ctx *ctx; bool no_bufs = false; uint64_t processed_contexts = 0; @@ -1389,8 +1389,8 @@ static void fpm_process_queue(struct event *t) */ static void fpm_process_event(struct event *t) { - struct fpm_nl_ctx *fnc = THREAD_ARG(t); - enum fpm_nl_events event = THREAD_VAL(t); + struct fpm_nl_ctx *fnc = EVENT_ARG(t); + enum fpm_nl_events event = EVENT_VAL(t); switch (event) { case FNE_DISABLE: @@ -1474,16 +1474,16 @@ static int fpm_nl_start(struct zebra_dplane_provider *prov) static int fpm_nl_finish_early(struct fpm_nl_ctx *fnc) { /* Disable all events and close socket. */ - THREAD_OFF(fnc->t_lspreset); - THREAD_OFF(fnc->t_lspwalk); - THREAD_OFF(fnc->t_nhgreset); - THREAD_OFF(fnc->t_nhgwalk); - THREAD_OFF(fnc->t_ribreset); - THREAD_OFF(fnc->t_ribwalk); - THREAD_OFF(fnc->t_rmacreset); - THREAD_OFF(fnc->t_rmacwalk); - THREAD_OFF(fnc->t_event); - THREAD_OFF(fnc->t_nhg); + EVENT_OFF(fnc->t_lspreset); + EVENT_OFF(fnc->t_lspwalk); + EVENT_OFF(fnc->t_nhgreset); + EVENT_OFF(fnc->t_nhgwalk); + EVENT_OFF(fnc->t_ribreset); + EVENT_OFF(fnc->t_ribwalk); + EVENT_OFF(fnc->t_rmacreset); + EVENT_OFF(fnc->t_rmacwalk); + EVENT_OFF(fnc->t_event); + EVENT_OFF(fnc->t_nhg); event_cancel_async(fnc->fthread->master, &fnc->t_read, NULL); event_cancel_async(fnc->fthread->master, &fnc->t_write, NULL); event_cancel_async(fnc->fthread->master, &fnc->t_connect, NULL); diff --git a/zebra/interface.c b/zebra/interface.c index 9f05a8d11..03376afc0 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -53,7 +53,7 @@ static void if_down_del_nbr_connected(struct interface *ifp); static void if_zebra_speed_update(struct event *thread) { - struct interface *ifp = THREAD_ARG(thread); + struct interface *ifp = EVENT_ARG(thread); struct zebra_if *zif = ifp->info; uint32_t new_speed; bool changed = false; @@ -223,7 +223,7 @@ static int if_zebra_delete_hook(struct interface *ifp) XFREE(MTYPE_ZIF_DESC, zebra_if->desc); - THREAD_OFF(zebra_if->speed_update); + EVENT_OFF(zebra_if->speed_update); XFREE(MTYPE_ZINFO, zebra_if); } diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index 06a5b6600..1e520283f 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -193,7 +193,7 @@ static void irdp_advertisement(struct interface *ifp, struct prefix *p) void irdp_send_thread(struct event *t_advert) { uint32_t timer, tmp; - struct interface *ifp = THREAD_ARG(t_advert); + struct interface *ifp = EVENT_ARG(t_advert); struct zebra_if *zi = ifp->info; struct irdp_interface *irdp = zi->irdp; struct prefix *p; @@ -245,7 +245,7 @@ void irdp_advert_off(struct interface *ifp) if (!irdp) return; - THREAD_OFF(irdp->t_advertise); + EVENT_OFF(irdp->t_advertise); if (ifp->connected) for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, ifc)) { @@ -280,7 +280,7 @@ void process_solicit(struct interface *ifp) return; irdp->flags |= IF_SOLICIT; - THREAD_OFF(irdp->t_advertise); + EVENT_OFF(irdp->t_advertise); timer = (frr_weak_random() % MAX_RESPONSE_DELAY) + 1; diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index e821d375e..0ccc0af41 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -217,7 +217,7 @@ void irdp_read_raw(struct event *r) char buf[IRDP_RX_BUF]; int ret, ifindex = 0; - int irdp_sock = THREAD_FD(r); + int irdp_sock = EVENT_FD(r); event_add_read(zrouter.master, irdp_read_raw, NULL, irdp_sock, &t_irdp_raw); diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index 3fbaefe8a..9cd06c1a0 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -484,7 +484,7 @@ static int dplane_netlink_information_fetch(struct nlmsghdr *h, ns_id_t ns_id, static void kernel_read(struct event *thread) { - struct zebra_ns *zns = (struct zebra_ns *)THREAD_ARG(thread); + struct zebra_ns *zns = (struct zebra_ns *)EVENT_ARG(thread); struct zebra_dplane_info dp_info; /* Capture key info from ns struct */ @@ -1959,7 +1959,7 @@ static void kernel_nlsock_fini(struct nlsock *nls) void kernel_terminate(struct zebra_ns *zns, bool complete) { - THREAD_OFF(zns->t_netlink); + EVENT_OFF(zns->t_netlink); kernel_nlsock_fini(&zns->netlink); diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index 6a32f523d..e8041dce0 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -1326,7 +1326,7 @@ static void kernel_read(struct event *thread) } buf; /* Fetch routing socket. */ - sock = THREAD_FD(thread); + sock = EVENT_FD(thread); nbytes = read(sock, &buf, sizeof(buf)); diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 4fece96f6..f205ab01e 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -477,7 +477,7 @@ no_more_opts: static void rtadv_timer(struct event *thread) { - struct zebra_vrf *zvrf = THREAD_ARG(thread); + struct zebra_vrf *zvrf = EVENT_ARG(thread); struct vrf *vrf; struct interface *ifp; struct zebra_if *zif; @@ -825,9 +825,9 @@ static void rtadv_read(struct event *thread) struct sockaddr_in6 from; ifindex_t ifindex = 0; int hoplimit = -1; - struct zebra_vrf *zvrf = THREAD_ARG(thread); + struct zebra_vrf *zvrf = EVENT_ARG(thread); - sock = THREAD_FD(thread); + sock = EVENT_FD(thread); zvrf->rtadv.ra_read = NULL; /* Register myself. */ @@ -2806,8 +2806,8 @@ static void rtadv_event(struct zebra_vrf *zvrf, enum rtadv_event event, int val) &rtadv->ra_timer); break; case RTADV_STOP: - THREAD_OFF(rtadv->ra_timer); - THREAD_OFF(rtadv->ra_read); + EVENT_OFF(rtadv->ra_timer); + EVENT_OFF(rtadv->ra_read); break; case RTADV_TIMER: event_add_timer(zrouter.master, rtadv_timer, zvrf, val, diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 8d5ccac22..5682b08f0 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -5775,7 +5775,7 @@ bool dplane_provider_is_threaded(const struct zebra_dplane_provider *prov) */ static void dplane_incoming_read(struct event *event) { - struct dplane_zns_info *zi = THREAD_ARG(event); + struct dplane_zns_info *zi = EVENT_ARG(event); kernel_dplane_read(&zi->info); @@ -5790,7 +5790,7 @@ static void dplane_incoming_read(struct event *event) */ static void dplane_incoming_request(struct event *event) { - struct dplane_zns_info *zi = THREAD_ARG(event); + struct dplane_zns_info *zi = EVENT_ARG(event); /* Start read task */ event_add_read(zdplane_info.dg_master, dplane_incoming_read, zi, @@ -6607,8 +6607,8 @@ static void dplane_check_shutdown_status(struct event *event) zns_info_list_del(&zdplane_info.dg_zns_list, zi); if (zdplane_info.dg_master) { - THREAD_OFF(zi->t_read); - THREAD_OFF(zi->t_request); + EVENT_OFF(zi->t_read); + EVENT_OFF(zi->t_request); } XFREE(MTYPE_DP_NS, zi); diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c index 900c352df..c7252e48b 100644 --- a/zebra/zebra_evpn_mac.c +++ b/zebra/zebra_evpn_mac.c @@ -386,7 +386,7 @@ static void zebra_evpn_dad_mac_auto_recovery_exp(struct event *t) struct listnode *node = NULL; struct zebra_neigh *nbr = NULL; - mac = THREAD_ARG(t); + mac = EVENT_ARG(t); /* since this is asynchronous we need sanity checks*/ zvrf = vrf_info_lookup(mac->zevpn->vrf_id); @@ -575,7 +575,7 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, } /* Start auto recovery timer for this MAC */ - THREAD_OFF(mac->dad_mac_auto_recovery_timer); + EVENT_OFF(mac->dad_mac_auto_recovery_timer); if (zvrf->dad_freeze && zvrf->dad_freeze_time) { if (IS_ZEBRA_DEBUG_VXLAN) { char mac_buf[MAC_BUF_SIZE]; @@ -1152,7 +1152,7 @@ int zebra_evpn_mac_del(struct zebra_evpn *zevpn, struct zebra_mac *mac) zebra_evpn_mac_stop_hold_timer(mac); /* Cancel auto recovery */ - THREAD_OFF(mac->dad_mac_auto_recovery_timer); + EVENT_OFF(mac->dad_mac_auto_recovery_timer); /* If the MAC is freed before the neigh we will end up * with a stale pointer against the neigh. @@ -1508,7 +1508,7 @@ static void zebra_evpn_mac_hold_exp_cb(struct event *t) bool old_static; bool new_static; - mac = THREAD_ARG(t); + mac = EVENT_ARG(t); /* the purpose of the hold timer is to age out the peer-active * flag */ @@ -1581,7 +1581,7 @@ void zebra_evpn_mac_stop_hold_timer(struct zebra_mac *mac) sizeof(mac_buf))); } - THREAD_OFF(mac->hold_timer); + EVENT_OFF(mac->hold_timer); } void zebra_evpn_sync_mac_del(struct zebra_mac *mac) diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c index 1aee64b60..bf488ca31 100644 --- a/zebra/zebra_evpn_mh.c +++ b/zebra/zebra_evpn_mh.c @@ -2205,7 +2205,7 @@ static void zebra_evpn_es_df_delay_exp_cb(struct event *t) { struct zebra_evpn_es *es; - es = THREAD_ARG(t); + es = EVENT_ARG(t); if (IS_ZEBRA_DEBUG_EVPN_MH_ES) zlog_debug("es %s df-delay expired", es->esi_str); @@ -2314,7 +2314,7 @@ static void zebra_evpn_es_local_info_clear(struct zebra_evpn_es **esp) es->flags &= ~(ZEBRA_EVPNES_LOCAL | ZEBRA_EVPNES_READY_FOR_BGP); - THREAD_OFF(es->df_delay_timer); + EVENT_OFF(es->df_delay_timer); /* clear EVPN protodown flags on the access port */ zebra_evpn_mh_clear_protodown_es(es); @@ -3931,7 +3931,7 @@ static void zebra_evpn_mh_startup_delay_timer_start(const char *rc) if (zmh_info->startup_delay_timer) { if (IS_ZEBRA_DEBUG_EVPN_MH_ES) zlog_debug("startup-delay timer cancelled"); - THREAD_OFF(zmh_info->startup_delay_timer); + EVENT_OFF(zmh_info->startup_delay_timer); } if (zmh_info->startup_delay_time) { diff --git a/zebra/zebra_evpn_neigh.c b/zebra/zebra_evpn_neigh.c index 2405b2cd2..74141e4f3 100644 --- a/zebra/zebra_evpn_neigh.c +++ b/zebra/zebra_evpn_neigh.c @@ -405,7 +405,7 @@ static void zebra_evpn_neigh_hold_exp_cb(struct event *t) bool old_n_static; bool new_n_static; - n = THREAD_ARG(t); + n = EVENT_ARG(t); /* the purpose of the hold timer is to age out the peer-active * flag */ @@ -576,7 +576,7 @@ int zebra_evpn_neigh_del(struct zebra_evpn *zevpn, struct zebra_neigh *n) listnode_delete(n->mac->neigh_list, n); /* Cancel auto recovery */ - THREAD_OFF(n->dad_ip_auto_recovery_timer); + EVENT_OFF(n->dad_ip_auto_recovery_timer); /* Cancel proxy hold timer */ zebra_evpn_neigh_stop_hold_timer(n); @@ -1086,7 +1086,7 @@ static void zebra_evpn_dad_ip_auto_recovery_exp(struct event *t) struct zebra_neigh *nbr = NULL; struct zebra_evpn *zevpn = NULL; - nbr = THREAD_ARG(t); + nbr = EVENT_ARG(t); /* since this is asynchronous we need sanity checks*/ zvrf = vrf_info_lookup(nbr->zevpn->vrf_id); @@ -1223,7 +1223,7 @@ static void zebra_evpn_dup_addr_detect_for_neigh( nbr->dad_dup_detect_time = monotime(NULL); /* Start auto recovery timer for this IP */ - THREAD_OFF(nbr->dad_ip_auto_recovery_timer); + EVENT_OFF(nbr->dad_ip_auto_recovery_timer); if (zvrf->dad_freeze && zvrf->dad_freeze_time) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( @@ -1680,7 +1680,7 @@ void zebra_evpn_clear_dup_neigh_hash(struct hash_bucket *bucket, void *ctxt) nbr->detect_start_time.tv_sec = 0; nbr->detect_start_time.tv_usec = 0; nbr->dad_dup_detect_time = 0; - THREAD_OFF(nbr->dad_ip_auto_recovery_timer); + EVENT_OFF(nbr->dad_ip_auto_recovery_timer); if (CHECK_FLAG(nbr->flags, ZEBRA_NEIGH_LOCAL)) { zebra_evpn_neigh_send_add_to_client(zevpn->vni, &nbr->ip, diff --git a/zebra/zebra_evpn_neigh.h b/zebra/zebra_evpn_neigh.h index 67fef799c..c82b3673b 100644 --- a/zebra/zebra_evpn_neigh.h +++ b/zebra/zebra_evpn_neigh.h @@ -158,7 +158,7 @@ static inline void zebra_evpn_neigh_stop_hold_timer(struct zebra_neigh *n) if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug("sync-neigh vni %u ip %pIA mac %pEA 0x%x hold stop", n->zevpn->vni, &n->ip, &n->emac, n->flags); - THREAD_OFF(n->hold_timer); + EVENT_OFF(n->hold_timer); } void zebra_evpn_sync_neigh_static_chg(struct zebra_neigh *n, bool old_n_static, diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index db277e96e..0842b4431 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -481,7 +481,7 @@ static inline void zfpm_write_on(void) */ static inline void zfpm_read_off(void) { - THREAD_OFF(zfpm_g->t_read); + EVENT_OFF(zfpm_g->t_read); } /* @@ -489,12 +489,12 @@ static inline void zfpm_read_off(void) */ static inline void zfpm_write_off(void) { - THREAD_OFF(zfpm_g->t_write); + EVENT_OFF(zfpm_g->t_write); } static inline void zfpm_connect_off(void) { - THREAD_OFF(zfpm_g->t_connect); + EVENT_OFF(zfpm_g->t_connect); } /* @@ -568,7 +568,7 @@ static void zfpm_connection_up(const char *detail) /* * Start thread to push existing routes to the FPM. */ - THREAD_OFF(zfpm_g->t_conn_up); + EVENT_OFF(zfpm_g->t_conn_up); zfpm_rnodes_iter_init(&zfpm_g->t_conn_up_state.iter); zfpm_g->fpm_mac_dump_done = false; @@ -1697,7 +1697,7 @@ static void zfpm_stop_stats_timer(void) return; zfpm_debug("Stopping existing stats timer"); - THREAD_OFF(zfpm_g->t_stats); + EVENT_OFF(zfpm_g->t_stats); } /* diff --git a/zebra/zebra_gr.c b/zebra/zebra_gr.c index 4d0caba89..3106b82c4 100644 --- a/zebra/zebra_gr.c +++ b/zebra/zebra_gr.c @@ -80,7 +80,7 @@ void zebra_gr_stale_client_cleanup(struct list *client_list) /* Cancel the stale timer */ if (info->t_stale_removal != NULL) { - THREAD_OFF(info->t_stale_removal); + EVENT_OFF(info->t_stale_removal); info->t_stale_removal = NULL; /* Process the stale routes */ event_execute( @@ -115,7 +115,7 @@ static void zebra_gr_client_info_delte(struct zserv *client, TAILQ_REMOVE(&(client->gr_info_queue), info, gr_info); - THREAD_OFF(info->t_stale_removal); + EVENT_OFF(info->t_stale_removal); XFREE(MTYPE_ZEBRA_GR, info->current_prefix); @@ -463,7 +463,7 @@ void zread_client_capabilities(ZAPI_HANDLER_ARGS) */ static void zebra_gr_route_stale_delete_timer_expiry(struct event *thread) { - struct client_gr_info *info = THREAD_ARG(thread); + struct client_gr_info *info = EVENT_ARG(thread); int32_t cnt = 0; struct zserv *client; struct vrf *vrf = vrf_lookup_by_id(info->vrf_id); @@ -692,7 +692,7 @@ static void zebra_gr_process_client_stale_routes(struct zserv *client, LOG_GR("%s: Client %s canceled stale delete timer vrf %s(%d)", __func__, zebra_route_string(client->proto), VRF_LOGNAME(vrf), info->vrf_id); - THREAD_OFF(info->t_stale_removal); + EVENT_OFF(info->t_stale_removal); event_execute(zrouter.master, zebra_gr_route_stale_delete_timer_expiry, info, 0); diff --git a/zebra/zebra_mlag.c b/zebra/zebra_mlag.c index 18bbd2fd4..6713dbc96 100644 --- a/zebra/zebra_mlag.c +++ b/zebra/zebra_mlag.c @@ -294,7 +294,7 @@ static void zebra_mlag_publish_process_state(struct zserv *client, */ static void zebra_mlag_post_data_from_main_thread(struct event *thread) { - struct stream *s = THREAD_ARG(thread); + struct stream *s = EVENT_ARG(thread); struct stream *zebra_s = NULL; struct listnode *node; struct zserv *client; diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c index 9ceecb5e9..5ccff635f 100644 --- a/zebra/zebra_netns_notify.c +++ b/zebra/zebra_netns_notify.c @@ -231,7 +231,7 @@ static bool zebra_ns_notify_is_default_netns(const char *name) static void zebra_ns_ready_read(struct event *t) { - struct zebra_netns_info *zns_info = THREAD_ARG(t); + struct zebra_netns_info *zns_info = EVENT_ARG(t); const char *netnspath; int err, stop_retry = 0; @@ -282,7 +282,7 @@ static void zebra_ns_ready_read(struct event *t) static void zebra_ns_notify_read(struct event *t) { - int fd_monitor = THREAD_FD(t); + int fd_monitor = EVENT_FD(t); struct inotify_event *event; char buf[BUFSIZ]; ssize_t len; @@ -442,7 +442,7 @@ void zebra_ns_notify_close(void) fd = zebra_netns_notify_current->u.fd; if (zebra_netns_notify_current->master != NULL) - THREAD_OFF(zebra_netns_notify_current); + EVENT_OFF(zebra_netns_notify_current); /* auto-removal of notify items */ if (fd > 0) diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 23156d8bf..8616b1405 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -1619,7 +1619,7 @@ void zebra_nhg_free(struct nhg_hash_entry *nhe) nhe->nhg.nexthop); } - THREAD_OFF(nhe->timer); + EVENT_OFF(nhe->timer); zebra_nhg_free_members(nhe); @@ -1644,7 +1644,7 @@ void zebra_nhg_hash_free(void *p) nhe->nhg.nexthop); } - THREAD_OFF(nhe->timer); + EVENT_OFF(nhe->timer); nexthops_free(nhe->nhg.nexthop); @@ -1685,7 +1685,7 @@ void zebra_nhg_hash_free_zero_id(struct hash_bucket *b, void *arg) static void zebra_nhg_timer(struct event *thread) { - struct nhg_hash_entry *nhe = THREAD_ARG(thread); + struct nhg_hash_entry *nhe = EVENT_ARG(thread); if (IS_ZEBRA_DEBUG_NHG_DETAIL) zlog_debug("Nexthop Timer for nhe: %pNG", nhe); @@ -1728,7 +1728,7 @@ void zebra_nhg_increment_ref(struct nhg_hash_entry *nhe) nhe->refcnt++; if (event_is_scheduled(nhe->timer)) { - THREAD_OFF(nhe->timer); + EVENT_OFF(nhe->timer); nhe->refcnt--; UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_KEEP_AROUND); } @@ -3507,7 +3507,7 @@ struct nhg_hash_entry *zebra_nhg_proto_add(uint32_t id, int type, /* Dont call the dec API, we dont want to uninstall the ID */ old->refcnt = 0; - THREAD_OFF(old->timer); + EVENT_OFF(old->timer); zebra_nhg_free(old); old = NULL; } diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index e77dcedd9..a1fee840d 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -141,9 +141,9 @@ void zebra_ptm_finish(void) free(ptm_cb.in_data); /* Cancel events. */ - THREAD_OFF(ptm_cb.t_read); - THREAD_OFF(ptm_cb.t_write); - THREAD_OFF(ptm_cb.t_timer); + EVENT_OFF(ptm_cb.t_read); + EVENT_OFF(ptm_cb.t_write); + EVENT_OFF(ptm_cb.t_timer); if (ptm_cb.wb) buffer_free(ptm_cb.wb); @@ -197,7 +197,7 @@ static int zebra_ptm_send_message(char *data, int size) ptm_cb.reconnect_time, &ptm_cb.t_timer); return -1; case BUFFER_EMPTY: - THREAD_OFF(ptm_cb.t_write); + EVENT_OFF(ptm_cb.t_write); break; case BUFFER_PENDING: event_add_write(zrouter.master, zebra_ptm_flush_messages, NULL, @@ -635,7 +635,7 @@ void zebra_ptm_sock_read(struct event *thread) int rc; errno = 0; - sock = THREAD_FD(thread); + sock = EVENT_FD(thread); if (sock == -1) return; diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c index edcb97dde..d5f56d417 100644 --- a/zebra/zebra_pw.c +++ b/zebra/zebra_pw.c @@ -89,7 +89,7 @@ void zebra_pw_del(struct zebra_vrf *zvrf, struct zebra_pw *pw) dplane_pw_uninstall(pw); } - THREAD_OFF(pw->install_retry_timer); + EVENT_OFF(pw->install_retry_timer); /* unlink and release memory */ RB_REMOVE(zebra_pw_head, &zvrf->pseudowires, pw); @@ -207,7 +207,7 @@ void zebra_pw_install_failure(struct zebra_pw *pw, int pwstatus) pw->vrf_id, pw->ifname, PW_INSTALL_RETRY_INTERVAL); /* schedule to retry later */ - THREAD_OFF(pw->install_retry_timer); + EVENT_OFF(pw->install_retry_timer); event_add_timer(zrouter.master, zebra_pw_install_retry, pw, PW_INSTALL_RETRY_INTERVAL, &pw->install_retry_timer); @@ -216,7 +216,7 @@ void zebra_pw_install_failure(struct zebra_pw *pw, int pwstatus) static void zebra_pw_install_retry(struct event *thread) { - struct zebra_pw *pw = THREAD_ARG(thread); + struct zebra_pw *pw = EVENT_ARG(thread); zebra_pw_install(pw); } diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 17e71db49..014b5126b 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -4397,7 +4397,7 @@ static void rib_update_handler(struct event *thread) { struct rib_update_ctx *ctx; - ctx = THREAD_ARG(thread); + ctx = EVENT_ARG(thread); rib_update_handle_vrf_all(ctx->event, ZEBRA_ROUTE_ALL); diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index b55d152ef..d9a7ee465 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -1747,7 +1747,7 @@ static void zebra_route_map_set_delay_timer(uint32_t value) if (!value && zebra_t_rmap_update) { /* Event driven route map updates is being disabled */ /* But there's a pending timer. Fire it off now */ - THREAD_OFF(zebra_t_rmap_update); + EVENT_OFF(zebra_t_rmap_update); zebra_route_map_update_timer(NULL); } } @@ -1757,7 +1757,7 @@ void zebra_routemap_finish(void) /* Set zebra_rmap_update_timer to 0 so that it wont schedule again */ zebra_rmap_update_timer = 0; /* Thread off if any scheduled already */ - THREAD_OFF(zebra_t_rmap_update); + EVENT_OFF(zebra_t_rmap_update); route_map_finish(); } @@ -1874,7 +1874,7 @@ static void zebra_route_map_mark_update(const char *rmap_name) { /* rmap_update_timer of 0 means don't do route updates */ if (zebra_rmap_update_timer) - THREAD_OFF(zebra_t_rmap_update); + EVENT_OFF(zebra_t_rmap_update); event_add_timer(zrouter.master, zebra_route_map_update_timer, NULL, zebra_rmap_update_timer, &zebra_t_rmap_update); diff --git a/zebra/zebra_router.c b/zebra/zebra_router.c index 787442f5c..a47728791 100644 --- a/zebra/zebra_router.c +++ b/zebra/zebra_router.c @@ -218,7 +218,7 @@ void zebra_router_terminate(void) { struct zebra_router_table *zrt, *tmp; - THREAD_OFF(zrouter.sweeper); + EVENT_OFF(zrouter.sweeper); RB_FOREACH_SAFE (zrt, zebra_router_table_head, &zrouter.tables, tmp) zebra_router_free_table(zrt); diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 153a5b8d8..c370ad916 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -3449,7 +3449,7 @@ int zebra_vxlan_clear_dup_detect_vni_mac(struct zebra_vrf *zvrf, vni_t vni, mac->detect_start_time.tv_sec = 0; mac->detect_start_time.tv_usec = 0; mac->dad_dup_detect_time = 0; - THREAD_OFF(mac->dad_mac_auto_recovery_timer); + EVENT_OFF(mac->dad_mac_auto_recovery_timer); /* warn-only action return */ if (!zvrf->dad_freeze) @@ -3531,7 +3531,7 @@ int zebra_vxlan_clear_dup_detect_vni_ip(struct zebra_vrf *zvrf, vni_t vni, nbr->detect_start_time.tv_sec = 0; nbr->detect_start_time.tv_usec = 0; nbr->dad_dup_detect_time = 0; - THREAD_OFF(nbr->dad_ip_auto_recovery_timer); + EVENT_OFF(nbr->dad_ip_auto_recovery_timer); if (!!CHECK_FLAG(nbr->flags, ZEBRA_NEIGH_LOCAL)) { zebra_evpn_neigh_send_add_to_client(zevpn->vni, ip, &nbr->emac, @@ -3566,7 +3566,7 @@ static void zevpn_clear_dup_mac_hash(struct hash_bucket *bucket, void *ctxt) mac->detect_start_time.tv_sec = 0; mac->detect_start_time.tv_usec = 0; mac->dad_dup_detect_time = 0; - THREAD_OFF(mac->dad_mac_auto_recovery_timer); + EVENT_OFF(mac->dad_mac_auto_recovery_timer); /* Remove all IPs as duplicate associcated with this MAC */ for (ALL_LIST_ELEMENTS_RO(mac->neigh_list, node, nbr)) { diff --git a/zebra/zserv.c b/zebra/zserv.c index c25b61ea4..87cce37ba 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -34,7 +34,7 @@ #include "lib/sockopt.h" /* for setsockopt_so_recvbuf, setsockopt... */ #include "lib/sockunion.h" /* for sockopt_reuseaddr, sockopt_reuseport */ #include "lib/stream.h" /* for STREAM_SIZE, stream (ptr only), ... */ -#include "event.h" /* for thread (ptr only), THREAD_ARG, ... */ +#include "event.h" /* for thread (ptr only), EVENT_ARG, ... */ #include "lib/vrf.h" /* for vrf_info_lookup, VRF_DEFAULT */ #include "lib/vty.h" /* for vty_out, vty (ptr only) */ #include "lib/zclient.h" /* for zmsghdr, ZEBRA_HEADER_SIZE, ZEBRA... */ @@ -188,8 +188,8 @@ static void zserv_client_fail(struct zserv *client) atomic_store_explicit(&client->pthread->running, false, memory_order_relaxed); - THREAD_OFF(client->t_read); - THREAD_OFF(client->t_write); + EVENT_OFF(client->t_read); + EVENT_OFF(client->t_write); zserv_event(client, ZSERV_HANDLE_CLIENT_FAIL); } @@ -215,7 +215,7 @@ static void zserv_client_fail(struct zserv *client) */ static void zserv_write(struct event *thread) { - struct zserv *client = THREAD_ARG(thread); + struct zserv *client = EVENT_ARG(thread); struct stream *msg; uint32_t wcmd = 0; struct stream_fifo *cache; @@ -308,7 +308,7 @@ zwrite_fail: */ static void zserv_read(struct event *thread) { - struct zserv *client = THREAD_ARG(thread); + struct zserv *client = EVENT_ARG(thread); int sock; size_t already; struct stream_fifo *cache; @@ -321,7 +321,7 @@ static void zserv_read(struct event *thread) memory_order_relaxed); cache = stream_fifo_new(); p2p = p2p_orig; - sock = THREAD_FD(thread); + sock = EVENT_FD(thread); while (p2p) { ssize_t nb; @@ -493,7 +493,7 @@ static void zserv_client_event(struct zserv *client, */ static void zserv_process_messages(struct event *thread) { - struct zserv *client = THREAD_ARG(thread); + struct zserv *client = EVENT_ARG(thread); struct stream *msg; struct stream_fifo *cache = stream_fifo_new(); uint32_t p2p = zrouter.packets_to_process; @@ -671,8 +671,8 @@ void zserv_close_client(struct zserv *client) zebra_route_string(client->proto)); event_cancel_event(zrouter.master, client); - THREAD_OFF(client->t_cleanup); - THREAD_OFF(client->t_process); + EVENT_OFF(client->t_cleanup); + EVENT_OFF(client->t_process); /* destroy pthread */ frr_pthread_destroy(client->pthread); @@ -711,7 +711,7 @@ void zserv_close_client(struct zserv *client) */ static void zserv_handle_client_fail(struct event *thread) { - struct zserv *client = THREAD_ARG(thread); + struct zserv *client = EVENT_ARG(thread); zserv_close_client(client); } @@ -853,7 +853,7 @@ static void zserv_accept(struct event *thread) struct sockaddr_in client; socklen_t len; - accept_sock = THREAD_FD(thread); + accept_sock = EVENT_FD(thread); /* Reregister myself. */ zserv_event(NULL, ZSERV_ACCEPT); |