summaryrefslogtreecommitdiffstats
path: root/ldpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2022-05-20 20:19:08 +0200
committerDonald Sharp <sharpd@nvidia.com>2023-03-24 13:32:17 +0100
commit907a2395f423e3b97335d554557c2cef7195db84 (patch)
tree18ea691bc5589fa570c739a9f221429633778ea9 /ldpd
parent*: Rename `struct thread` to `struct event` (diff)
downloadfrr-907a2395f423e3b97335d554557c2cef7195db84.tar.xz
frr-907a2395f423e3b97335d554557c2cef7195db84.zip
*: Convert thread_add_XXX functions to event_add_XXX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'ldpd')
-rw-r--r--ldpd/accept.c8
-rw-r--r--ldpd/adjacency.c8
-rw-r--r--ldpd/control.c4
-rw-r--r--ldpd/interface.c6
-rw-r--r--ldpd/lde.c10
-rw-r--r--ldpd/lde_lib.c3
-rw-r--r--ldpd/ldpd.c30
-rw-r--r--ldpd/ldpe.c24
-rw-r--r--ldpd/neighbor.c15
-rw-r--r--ldpd/packet.c10
10 files changed, 58 insertions, 60 deletions
diff --git a/ldpd/accept.c b/ldpd/accept.c
index 6151c1a0b..2088ce977 100644
--- a/ldpd/accept.c
+++ b/ldpd/accept.c
@@ -46,7 +46,7 @@ int accept_add(int fd, void (*cb)(struct event *), void *arg)
av->arg = arg;
LIST_INSERT_HEAD(&accept_queue.queue, av, entry);
- thread_add_read(master, accept_cb, av, av->fd, &av->ev);
+ event_add_read(master, accept_cb, av, av->fd, &av->ev);
log_debug("%s: accepting on fd %d", __func__, fd);
@@ -73,7 +73,7 @@ accept_pause(void)
{
log_debug(__func__);
accept_unarm();
- thread_add_timer(master, accept_timeout, NULL, 1, &accept_queue.evt);
+ event_add_timer(master, accept_timeout, NULL, 1, &accept_queue.evt);
}
void
@@ -91,7 +91,7 @@ accept_arm(void)
{
struct accept_ev *av;
LIST_FOREACH(av, &accept_queue.queue, entry) {
- thread_add_read(master, accept_cb, av, av->fd, &av->ev);
+ event_add_read(master, accept_cb, av, av->fd, &av->ev);
}
}
@@ -106,7 +106,7 @@ accept_unarm(void)
static void accept_cb(struct event *thread)
{
struct accept_ev *av = THREAD_ARG(thread);
- thread_add_read(master, accept_cb, av, av->fd, &av->ev);
+ 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 36c14a562..d9a9d434a 100644
--- a/ldpd/adjacency.c
+++ b/ldpd/adjacency.c
@@ -187,8 +187,8 @@ adj_start_itimer(struct adj *adj)
{
THREAD_OFF(adj->inactivity_timer);
adj->inactivity_timer = NULL;
- thread_add_timer(master, adj_itimer, adj, adj->holdtime,
- &adj->inactivity_timer);
+ event_add_timer(master, adj_itimer, adj, adj->holdtime,
+ &adj->inactivity_timer);
}
void
@@ -345,8 +345,8 @@ tnbr_start_hello_timer(struct tnbr *tnbr)
{
THREAD_OFF(tnbr->hello_timer);
tnbr->hello_timer = NULL;
- thread_add_timer(master, tnbr_hello_timer, tnbr, tnbr_get_hello_interval(tnbr),
- &tnbr->hello_timer);
+ event_add_timer(master, tnbr_hello_timer, tnbr,
+ tnbr_get_hello_interval(tnbr), &tnbr->hello_timer);
}
static void
diff --git a/ldpd/control.c b/ldpd/control.c
index 2313e232f..ade50edd4 100644
--- a/ldpd/control.c
+++ b/ldpd/control.c
@@ -122,8 +122,8 @@ static void control_accept(struct event *thread)
imsg_init(&c->iev.ibuf, connfd);
c->iev.handler_read = control_dispatch_imsg;
c->iev.ev_read = NULL;
- thread_add_read(master, c->iev.handler_read, &c->iev, c->iev.ibuf.fd,
- &c->iev.ev_read);
+ event_add_read(master, c->iev.handler_read, &c->iev, c->iev.ibuf.fd,
+ &c->iev.ev_read);
c->iev.handler_write = ldp_write_handler;
c->iev.ev_write = NULL;
diff --git a/ldpd/interface.c b/ldpd/interface.c
index 6996bf7c1..5a6ea9c51 100644
--- a/ldpd/interface.c
+++ b/ldpd/interface.c
@@ -457,8 +457,8 @@ static void
if_start_hello_timer(struct iface_af *ia)
{
THREAD_OFF(ia->hello_timer);
- thread_add_timer(master, if_hello_timer, ia, if_get_hello_interval(ia),
- &ia->hello_timer);
+ event_add_timer(master, if_hello_timer, ia, if_get_hello_interval(ia),
+ &ia->hello_timer);
}
static void
@@ -733,7 +733,7 @@ static void start_wait_for_ldp_sync_timer(struct iface *iface)
return;
THREAD_OFF(iface->ldp_sync.wait_for_sync_timer);
- thread_add_timer(master, iface_wait_for_ldp_sync_timer, iface,
+ event_add_timer(master, iface_wait_for_ldp_sync_timer, iface,
if_get_wait_for_sync_interval(),
&iface->ldp_sync.wait_for_sync_timer);
}
diff --git a/ldpd/lde.c b/ldpd/lde.c
index 3a38e165c..a84c6635d 100644
--- a/ldpd/lde.c
+++ b/ldpd/lde.c
@@ -134,8 +134,8 @@ lde(void)
fatal(NULL);
imsg_init(&iev_main->ibuf, LDPD_FD_ASYNC);
iev_main->handler_read = lde_dispatch_parent;
- thread_add_read(master, iev_main->handler_read, iev_main, iev_main->ibuf.fd,
- &iev_main->ev_read);
+ event_add_read(master, iev_main->handler_read, iev_main,
+ iev_main->ibuf.fd, &iev_main->ev_read);
iev_main->handler_write = ldp_write_handler;
memset(&iev_main_sync_data, 0, sizeof(iev_main_sync_data));
@@ -523,8 +523,8 @@ static void lde_dispatch_parent(struct event *thread)
fatal(NULL);
imsg_init(&iev_ldpe->ibuf, fd);
iev_ldpe->handler_read = lde_dispatch_imsg;
- thread_add_read(master, iev_ldpe->handler_read, iev_ldpe, iev_ldpe->ibuf.fd,
- &iev_ldpe->ev_read);
+ event_add_read(master, iev_ldpe->handler_read, iev_ldpe,
+ iev_ldpe->ibuf.fd, &iev_ldpe->ev_read);
iev_ldpe->handler_write = ldp_write_handler;
iev_ldpe->ev_write = NULL;
break;
@@ -2178,7 +2178,7 @@ retry:
zclient_sync = NULL;
/* Retry using a timer */
- thread_add_timer(master, zclient_sync_retry, NULL, 1, NULL);
+ event_add_timer(master, zclient_sync_retry, NULL, 1, NULL);
}
static void
diff --git a/ldpd/lde_lib.c b/ldpd/lde_lib.c
index 62d06dfb1..721a1c11e 100644
--- a/ldpd/lde_lib.c
+++ b/ldpd/lde_lib.c
@@ -1058,8 +1058,7 @@ void
lde_gc_start_timer(void)
{
THREAD_OFF(gc_timer);
- thread_add_timer(master, lde_gc_timer, NULL, LDE_GC_INTERVAL,
- &gc_timer);
+ event_add_timer(master, lde_gc_timer, NULL, LDE_GC_INTERVAL, &gc_timer);
}
void
diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c
index f549b34ee..c87bf1ea1 100644
--- a/ldpd/ldpd.c
+++ b/ldpd/ldpd.c
@@ -383,7 +383,7 @@ main(int argc, char *argv[])
frr_config_fork();
/* apply configuration */
- thread_add_event(master, ldp_config_fork_apply, NULL, 0, NULL);
+ event_add_event(master, ldp_config_fork_apply, NULL, 0, NULL);
/* setup pipes to children */
if ((iev_ldpe = calloc(1, sizeof(struct imsgev))) == NULL ||
@@ -394,26 +394,26 @@ main(int argc, char *argv[])
imsg_init(&iev_ldpe->ibuf, pipe_parent2ldpe[0]);
iev_ldpe->handler_read = main_dispatch_ldpe;
- thread_add_read(master, iev_ldpe->handler_read, iev_ldpe, iev_ldpe->ibuf.fd,
- &iev_ldpe->ev_read);
+ event_add_read(master, iev_ldpe->handler_read, iev_ldpe,
+ iev_ldpe->ibuf.fd, &iev_ldpe->ev_read);
iev_ldpe->handler_write = ldp_write_handler;
imsg_init(&iev_ldpe_sync->ibuf, pipe_parent2ldpe_sync[0]);
iev_ldpe_sync->handler_read = main_dispatch_ldpe;
- thread_add_read(master, iev_ldpe_sync->handler_read, iev_ldpe_sync, iev_ldpe_sync->ibuf.fd,
- &iev_ldpe_sync->ev_read);
+ event_add_read(master, iev_ldpe_sync->handler_read, iev_ldpe_sync,
+ iev_ldpe_sync->ibuf.fd, &iev_ldpe_sync->ev_read);
iev_ldpe_sync->handler_write = ldp_write_handler;
imsg_init(&iev_lde->ibuf, pipe_parent2lde[0]);
iev_lde->handler_read = main_dispatch_lde;
- thread_add_read(master, iev_lde->handler_read, iev_lde, iev_lde->ibuf.fd,
- &iev_lde->ev_read);
+ event_add_read(master, iev_lde->handler_read, iev_lde, iev_lde->ibuf.fd,
+ &iev_lde->ev_read);
iev_lde->handler_write = ldp_write_handler;
imsg_init(&iev_lde_sync->ibuf, pipe_parent2lde_sync[0]);
iev_lde_sync->handler_read = main_dispatch_lde;
- thread_add_read(master, iev_lde_sync->handler_read, iev_lde_sync, iev_lde_sync->ibuf.fd,
- &iev_lde_sync->ev_read);
+ event_add_read(master, iev_lde_sync->handler_read, iev_lde_sync,
+ iev_lde_sync->ibuf.fd, &iev_lde_sync->ev_read);
iev_lde_sync->handler_write = ldp_write_handler;
if (main_imsg_send_ipc_sockets(&iev_ldpe->ibuf, &iev_lde->ibuf))
@@ -787,12 +787,12 @@ void
imsg_event_add(struct imsgev *iev)
{
if (iev->handler_read)
- thread_add_read(master, iev->handler_read, iev, iev->ibuf.fd,
- &iev->ev_read);
+ event_add_read(master, iev->handler_read, iev, iev->ibuf.fd,
+ &iev->ev_read);
if (iev->handler_write && iev->ibuf.w.queued)
- thread_add_write(master, iev->handler_write, iev,
- iev->ibuf.fd, &iev->ev_write);
+ event_add_write(master, iev->handler_write, iev, iev->ibuf.fd,
+ &iev->ev_write);
}
int
@@ -819,8 +819,8 @@ void
evbuf_event_add(struct evbuf *eb)
{
if (eb->wbuf.queued)
- thread_add_write(master, eb->handler, eb->arg, eb->wbuf.fd,
- &eb->ev);
+ event_add_write(master, eb->handler, eb->arg, eb->wbuf.fd,
+ &eb->ev);
}
void evbuf_init(struct evbuf *eb, int fd, void (*handler)(struct event *),
diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c
index 61a1a2aa8..68f6bc8bc 100644
--- a/ldpd/ldpe.c
+++ b/ldpd/ldpe.c
@@ -111,8 +111,8 @@ ldpe(void)
fatal(NULL);
imsg_init(&iev_main->ibuf, LDPD_FD_ASYNC);
iev_main->handler_read = ldpe_dispatch_main;
- thread_add_read(master, iev_main->handler_read, iev_main, iev_main->ibuf.fd,
- &iev_main->ev_read);
+ event_add_read(master, iev_main->handler_read, iev_main,
+ iev_main->ibuf.fd, &iev_main->ev_read);
iev_main->handler_write = ldp_write_handler;
memset(&iev_main_data, 0, sizeof(iev_main_data));
@@ -137,8 +137,8 @@ ldpe_init(struct ldpd_init *init)
/* This socket must be open before dropping privileges. */
global.pfkeysock = pfkey_init();
if (sysdep.no_pfkey == 0) {
- thread_add_read(master, ldpe_dispatch_pfkey, NULL, global.pfkeysock,
- &pfkey_ev);
+ event_add_read(master, ldpe_dispatch_pfkey, NULL,
+ global.pfkeysock, &pfkey_ev);
}
#endif
@@ -363,8 +363,8 @@ static void ldpe_dispatch_main(struct event *thread)
fatal(NULL);
imsg_init(&iev_lde->ibuf, fd);
iev_lde->handler_read = ldpe_dispatch_lde;
- thread_add_read(master, iev_lde->handler_read, iev_lde, iev_lde->ibuf.fd,
- &iev_lde->ev_read);
+ event_add_read(master, iev_lde->handler_read, iev_lde,
+ iev_lde->ibuf.fd, &iev_lde->ev_read);
iev_lde->handler_write = ldp_write_handler;
iev_lde->ev_write = NULL;
break;
@@ -763,8 +763,8 @@ static void ldpe_dispatch_pfkey(struct event *thread)
{
int fd = THREAD_FD(thread);
- thread_add_read(master, ldpe_dispatch_pfkey, NULL, global.pfkeysock,
- &pfkey_ev);
+ event_add_read(master, ldpe_dispatch_pfkey, NULL, global.pfkeysock,
+ &pfkey_ev);
if (pfkey_read(fd, NULL) == -1)
fatal("pfkey_read failed, exiting...");
@@ -781,13 +781,13 @@ ldpe_setup_sockets(int af, int disc_socket, int edisc_socket,
/* discovery socket */
af_global->ldp_disc_socket = disc_socket;
- thread_add_read(master, disc_recv_packet, &af_global->disc_ev, af_global->ldp_disc_socket,
- &af_global->disc_ev);
+ event_add_read(master, disc_recv_packet, &af_global->disc_ev,
+ af_global->ldp_disc_socket, &af_global->disc_ev);
/* extended discovery socket */
af_global->ldp_edisc_socket = edisc_socket;
- thread_add_read(master, disc_recv_packet, &af_global->edisc_ev, af_global->ldp_edisc_socket,
- &af_global->edisc_ev);
+ event_add_read(master, disc_recv_packet, &af_global->edisc_ev,
+ af_global->ldp_edisc_socket, &af_global->edisc_ev);
/* session socket */
af_global->ldp_session_socket = session_socket;
diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c
index e1c9e6337..e0cd0ec39 100644
--- a/ldpd/neighbor.c
+++ b/ldpd/neighbor.c
@@ -425,7 +425,7 @@ nbr_start_ktimer(struct nbr *nbr)
secs = nbr->keepalive / KEEPALIVE_PER_PERIOD;
THREAD_OFF(nbr->keepalive_timer);
nbr->keepalive_timer = NULL;
- thread_add_timer(master, nbr_ktimer, nbr, secs, &nbr->keepalive_timer);
+ event_add_timer(master, nbr_ktimer, nbr, secs, &nbr->keepalive_timer);
}
void
@@ -452,8 +452,8 @@ nbr_start_ktimeout(struct nbr *nbr)
{
THREAD_OFF(nbr->keepalive_timeout);
nbr->keepalive_timeout = NULL;
- thread_add_timer(master, nbr_ktimeout, nbr, nbr->keepalive,
- &nbr->keepalive_timeout);
+ event_add_timer(master, nbr_ktimeout, nbr, nbr->keepalive,
+ &nbr->keepalive_timeout);
}
void
@@ -481,7 +481,7 @@ nbr_start_itimeout(struct nbr *nbr)
secs = INIT_FSM_TIMEOUT;
THREAD_OFF(nbr->init_timeout);
nbr->init_timeout = NULL;
- thread_add_timer(master, nbr_itimeout, nbr, secs, &nbr->init_timeout);
+ event_add_timer(master, nbr_itimeout, nbr, secs, &nbr->init_timeout);
}
void
@@ -527,8 +527,7 @@ nbr_start_idtimer(struct nbr *nbr)
THREAD_OFF(nbr->initdelay_timer);
nbr->initdelay_timer = NULL;
- thread_add_timer(master, nbr_idtimer, nbr, secs,
- &nbr->initdelay_timer);
+ event_add_timer(master, nbr_idtimer, nbr, secs, &nbr->initdelay_timer);
}
void
@@ -650,8 +649,8 @@ nbr_establish_connection(struct nbr *nbr)
if (connect(nbr->fd, &remote_su.sa, sockaddr_len(&remote_su.sa))
== -1) {
if (errno == EINPROGRESS) {
- thread_add_write(master, nbr_connect_cb, nbr, nbr->fd,
- &nbr->ev_connect);
+ event_add_write(master, nbr_connect_cb, nbr, nbr->fd,
+ &nbr->ev_connect);
return (0);
}
log_warn("%s: error while connecting to %s", __func__,
diff --git a/ldpd/packet.c b/ldpd/packet.c
index 6770ab73e..ef2f6e82b 100644
--- a/ldpd/packet.c
+++ b/ldpd/packet.c
@@ -129,7 +129,7 @@ void disc_recv_packet(struct event *thread)
struct in_addr lsr_id;
/* reschedule read */
- thread_add_read(master, disc_recv_packet, threadp, fd, threadp);
+ event_add_read(master, disc_recv_packet, threadp, fd, threadp);
/* setup buffer */
memset(&m, 0, sizeof(m));
@@ -406,7 +406,7 @@ static void session_read(struct event *thread)
uint16_t pdu_len, msg_len, msg_size, max_pdu_len;
int ret;
- thread_add_read(master, session_read, nbr, fd, &tcp->rev);
+ event_add_read(master, session_read, nbr, fd, &tcp->rev);
if ((n = read(fd, tcp->rbuf->buf + tcp->rbuf->wpos,
sizeof(tcp->rbuf->buf) - tcp->rbuf->wpos)) == -1) {
@@ -721,7 +721,7 @@ tcp_new(int fd, struct nbr *nbr)
if ((tcp->rbuf = calloc(1, sizeof(struct ibuf_read))) == NULL)
fatal(__func__);
- thread_add_read(master, session_read, nbr, tcp->fd, &tcp->rev);
+ event_add_read(master, session_read, nbr, tcp->fd, &tcp->rev);
tcp->nbr = nbr;
}
@@ -768,8 +768,8 @@ pending_conn_new(int fd, int af, union ldpd_addr *addr)
pconn->addr = *addr;
TAILQ_INSERT_TAIL(&global.pending_conns, pconn, entry);
pconn->ev_timeout = NULL;
- thread_add_timer(master, pending_conn_timeout, pconn, PENDING_CONN_TIMEOUT,
- &pconn->ev_timeout);
+ event_add_timer(master, pending_conn_timeout, pconn,
+ PENDING_CONN_TIMEOUT, &pconn->ev_timeout);
return (pconn);
}