diff options
author | Donald Sharp <sharpd@nvidia.com> | 2023-03-07 20:14:41 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2023-03-24 13:32:17 +0100 |
commit | cd9d0537411d0a74cd19ae36f6d3716c8ccbb4c1 (patch) | |
tree | f97009b8971d71b4c05cbc0d00b98608efd40e44 /lib | |
parent | *: Convert thread_master_XXX functions to event_master_XXX (diff) | |
download | frr-cd9d0537411d0a74cd19ae36f6d3716c8ccbb4c1.tar.xz frr-cd9d0537411d0a74cd19ae36f6d3716c8ccbb4c1.zip |
*: Convert `struct event_master` to `struct event_loop`
Let's find a better name for it.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib')
44 files changed, 140 insertions, 145 deletions
diff --git a/lib/agentx.c b/lib/agentx.c index 3b9be3397..45f14c270 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -27,7 +27,7 @@ DEFINE_HOOK(agentx_enabled, (), ()); static bool agentx_enabled = false; -static struct event_master *agentx_tm; +static struct event_loop *agentx_tm; static struct event *timeout_thr = NULL; static struct list *events = NULL; @@ -244,7 +244,7 @@ bool smux_enabled(void) return agentx_enabled; } -void smux_init(struct event_master *tm) +void smux_init(struct event_loop *tm) { agentx_tm = tm; @@ -111,7 +111,7 @@ struct bfd_sessions_global { struct bfd_source_list source_list; /** Pointer to FRR's event manager. */ - struct event_master *tm; + struct event_loop *tm; /** Pointer to zebra client data structure. */ struct zclient *zc; @@ -1039,7 +1039,7 @@ static int bfd_protocol_integration_finish(void) return 0; } -void bfd_protocol_integration_init(struct zclient *zc, struct event_master *tm) +void bfd_protocol_integration_init(struct zclient *zc, struct event_loop *tm) { /* Initialize data structure. */ TAILQ_INIT(&bsglobal.bsplist); @@ -348,7 +348,7 @@ void bfd_sess_show(struct vty *vty, struct json_object *json, * Initializes the BFD integration library. This function executes the * following actions: * - * - Copy the `struct event_master` pointer to use as "thread" to execute + * - Copy the `struct event_loop` pointer to use as "thread" to execute * the BFD session parameters installation. * - Copy the `struct zclient` pointer to install its callbacks. * - Initializes internal data structures. @@ -356,7 +356,7 @@ void bfd_sess_show(struct vty *vty, struct json_object *json, * \param tm normally the daemon main thread event manager. * \param zc the zebra client of the daemon. */ -void bfd_protocol_integration_init(struct zclient *zc, struct event_master *tm); +void bfd_protocol_integration_init(struct zclient *zc, struct event_loop *tm); /** * BFD session registration arguments. diff --git a/lib/event.c b/lib/event.c index c23f1f8a9..f95e98a7f 100644 --- a/lib/event.c +++ b/lib/event.c @@ -73,7 +73,7 @@ pthread_key_t thread_current; static pthread_mutex_t masters_mtx = PTHREAD_MUTEX_INITIALIZER; static struct list *masters; -static void thread_free(struct event_master *master, struct event *thread); +static void thread_free(struct event_loop *master, struct event *thread); #ifndef EXCLUDE_CPU_TIME #define EXCLUDE_CPU_TIME 0 @@ -185,7 +185,7 @@ static void cpu_record_print(struct vty *vty, uint8_t filter) { struct cpu_event_history tmp; void *args[3] = {&tmp, vty, &filter}; - struct event_master *m; + struct event_loop *m; struct listnode *ln; if (!cputime_enabled) @@ -263,7 +263,7 @@ static void cpu_record_hash_clear(struct hash_bucket *bucket, void *args[]) static void cpu_record_clear(uint8_t filter) { uint8_t *tmp = &filter; - struct event_master *m; + struct event_loop *m; struct listnode *ln; frr_with_mutex (&masters_mtx) { @@ -395,7 +395,7 @@ ALIAS (service_walltime_warning, "Set up miscellaneous service\n" "Warn for tasks exceeding total wallclock threshold\n") -static void show_thread_poll_helper(struct vty *vty, struct event_master *m) +static void show_thread_poll_helper(struct vty *vty, struct event_loop *m) { const char *name = m->name ? m->name : "main"; char underline[strlen(name) + 1]; @@ -444,7 +444,7 @@ DEFUN_NOSH (show_thread_poll, "Show poll FD's and information\n") { struct listnode *node; - struct event_master *m; + struct event_loop *m; frr_with_mutex (&masters_mtx) { for (ALL_LIST_ELEMENTS_RO(masters, node, m)) { @@ -481,7 +481,7 @@ DEFUN (clear_thread_cpu, return CMD_SUCCESS; } -static void show_thread_timers_helper(struct vty *vty, struct event_master *m) +static void show_thread_timers_helper(struct vty *vty, struct event_loop *m) { const char *name = m->name ? m->name : "main"; char underline[strlen(name) + 1]; @@ -506,7 +506,7 @@ DEFPY_NOSH (show_thread_timers, "Show all timers and how long they have in the system\n") { struct listnode *node; - struct event_master *m; + struct event_loop *m; frr_with_mutex (&masters_mtx) { for (ALL_LIST_ELEMENTS_RO(masters, node, m)) @@ -544,14 +544,14 @@ static void initializer(void) pthread_key_create(&thread_current, NULL); } -struct event_master *event_master_create(const char *name) +struct event_loop *event_master_create(const char *name) { - struct event_master *rv; + struct event_loop *rv; struct rlimit limit; pthread_once(&init_once, &initializer); - rv = XCALLOC(MTYPE_EVENT_MASTER, sizeof(struct event_master)); + rv = XCALLOC(MTYPE_EVENT_MASTER, sizeof(struct event_loop)); /* Initialize master mutex */ pthread_mutex_init(&rv->mtx, NULL); @@ -623,7 +623,7 @@ struct event_master *event_master_create(const char *name) return rv; } -void event_master_set_name(struct event_master *master, const char *name) +void event_master_set_name(struct event_loop *master, const char *name) { frr_with_mutex (&master->mtx) { XFREE(MTYPE_EVENT_MASTER, master->name); @@ -634,7 +634,7 @@ void event_master_set_name(struct event_master *master, const char *name) #define EVENT_UNUSED_DEPTH 10 /* Move thread to unuse list. */ -static void thread_add_unuse(struct event_master *m, struct event *thread) +static void thread_add_unuse(struct event_loop *m, struct event *thread) { pthread_mutex_t mtxc = thread->mtx; @@ -656,8 +656,7 @@ static void thread_add_unuse(struct event_master *m, struct event *thread) } /* Free all unused thread. */ -static void thread_list_free(struct event_master *m, - struct event_list_head *list) +static void thread_list_free(struct event_loop *m, struct event_list_head *list) { struct event *t; @@ -665,8 +664,7 @@ static void thread_list_free(struct event_master *m, thread_free(m, t); } -static void thread_array_free(struct event_master *m, - struct event **thread_array) +static void thread_array_free(struct event_loop *m, struct event **thread_array) { struct event *t; int index; @@ -689,7 +687,7 @@ static void thread_array_free(struct event_master *m, * If we are shutting down, Free up unused threads * So we can see if we forget to shut anything off */ -void event_master_free_unused(struct event_master *m) +void event_master_free_unused(struct event_loop *m) { frr_with_mutex (&m->mtx) { struct event *t; @@ -699,7 +697,7 @@ void event_master_free_unused(struct event_master *m) } /* Stop thread scheduler. */ -void event_master_free(struct event_master *m) +void event_master_free(struct event_loop *m) { struct event *t; @@ -791,7 +789,7 @@ char *event_timer_to_hhmmss(char *buf, int buf_size, struct event *t_timer) } /* Get new thread. */ -static struct event *thread_get(struct event_master *m, uint8_t type, +static struct event *thread_get(struct event_loop *m, uint8_t type, void (*func)(struct event *), void *arg, const struct xref_eventsched *xref) { @@ -838,7 +836,7 @@ static struct event *thread_get(struct event_master *m, uint8_t type, return thread; } -static void thread_free(struct event_master *master, struct event *thread) +static void thread_free(struct event_loop *master, struct event *thread) { /* Update statistics. */ assert(master->alloc > 0); @@ -849,7 +847,7 @@ static void thread_free(struct event_master *master, struct event *thread) XFREE(MTYPE_THREAD, thread); } -static int fd_poll(struct event_master *m, const struct timeval *timer_wait, +static int fd_poll(struct event_loop *m, const struct timeval *timer_wait, bool *eintr_p) { sigset_t origsigs; @@ -948,7 +946,7 @@ done: /* Add new read thread. */ void _event_add_read_write(const struct xref_eventsched *xref, - struct event_master *m, void (*func)(struct event *), + struct event_loop *m, void (*func)(struct event *), void *arg, int fd, struct event **t_ptr) { int dir = xref->event_type; @@ -1027,7 +1025,7 @@ void _event_add_read_write(const struct xref_eventsched *xref, } static void _event_add_timer_timeval(const struct xref_eventsched *xref, - struct event_master *m, + struct event_loop *m, void (*func)(struct event *), void *arg, struct timeval *time_relative, struct event **t_ptr) @@ -1080,9 +1078,9 @@ static void _event_add_timer_timeval(const struct xref_eventsched *xref, /* Add timer event thread. */ -void _event_add_timer(const struct xref_eventsched *xref, - struct event_master *m, void (*func)(struct event *), - void *arg, long timer, struct event **t_ptr) +void _event_add_timer(const struct xref_eventsched *xref, struct event_loop *m, + void (*func)(struct event *), void *arg, long timer, + struct event **t_ptr) { struct timeval trel; @@ -1096,7 +1094,7 @@ void _event_add_timer(const struct xref_eventsched *xref, /* Add timer event thread with "millisecond" resolution */ void _event_add_timer_msec(const struct xref_eventsched *xref, - struct event_master *m, void (*func)(struct event *), + struct event_loop *m, void (*func)(struct event *), void *arg, long timer, struct event **t_ptr) { struct timeval trel; @@ -1111,16 +1109,16 @@ void _event_add_timer_msec(const struct xref_eventsched *xref, /* Add timer event thread with "timeval" resolution */ void _event_add_timer_tv(const struct xref_eventsched *xref, - struct event_master *m, void (*func)(struct event *), + struct event_loop *m, void (*func)(struct event *), void *arg, struct timeval *tv, struct event **t_ptr) { _event_add_timer_timeval(xref, m, func, arg, tv, t_ptr); } /* Add simple event thread. */ -void _event_add_event(const struct xref_eventsched *xref, - struct event_master *m, void (*func)(struct event *), - void *arg, int val, struct event **t_ptr) +void _event_add_event(const struct xref_eventsched *xref, struct event_loop *m, + void (*func)(struct event *), void *arg, int val, + struct event **t_ptr) { struct event *thread = NULL; @@ -1166,7 +1164,7 @@ void _event_add_event(const struct xref_eventsched *xref, * - POLLIN * - POLLOUT */ -static void event_cancel_rw(struct event_master *master, int fd, short state, +static void event_cancel_rw(struct event_loop *master, int fd, short state, int idx_hint) { bool found = false; @@ -1232,7 +1230,7 @@ static void event_cancel_rw(struct event_master *master, int fd, short state, * Process task cancellation given a task argument: iterate through the * various lists of tasks, looking for any that match the argument. */ -static void cancel_arg_helper(struct event_master *master, +static void cancel_arg_helper(struct event_loop *master, const struct cancel_req *cr) { struct event *t; @@ -1325,7 +1323,7 @@ static void cancel_arg_helper(struct event_master *master, * @param master the thread master to process * @REQUIRE master->mtx */ -static void do_event_cancel(struct event_master *master) +static void do_event_cancel(struct event_loop *master) { struct event_list_head *list = NULL; struct event **thread_array = NULL; @@ -1407,7 +1405,7 @@ static void do_event_cancel(struct event_master *master) /* * Helper function used for multiple flavors of arg-based cancellation. */ -static void cancel_event_helper(struct event_master *m, void *arg, int flags) +static void cancel_event_helper(struct event_loop *m, void *arg, int flags) { struct cancel_req *cr; @@ -1436,7 +1434,7 @@ static void cancel_event_helper(struct event_master *m, void *arg, int flags) * @param m the event_master to cancel from * @param arg the argument passed when creating the event */ -void event_cancel_event(struct event_master *master, void *arg) +void event_cancel_event(struct event_loop *master, void *arg) { cancel_event_helper(master, arg, 0); } @@ -1449,7 +1447,7 @@ void event_cancel_event(struct event_master *master, void *arg) * @param m the event_master to cancel from * @param arg the argument passed when creating the event */ -void event_cancel_event_ready(struct event_master *m, void *arg) +void event_cancel_event_ready(struct event_loop *m, void *arg) { /* Only cancel ready/event tasks */ @@ -1465,7 +1463,7 @@ void event_cancel_event_ready(struct event_master *m, void *arg) */ void event_cancel(struct event **thread) { - struct event_master *master; + struct event_loop *master; if (thread == NULL || *thread == NULL) return; @@ -1514,7 +1512,7 @@ void event_cancel(struct event **thread) * @param thread pointer to thread to cancel * @param eventobj the event */ -void event_cancel_async(struct event_master *master, struct event **thread, +void event_cancel_async(struct event_loop *master, struct event **thread, void *eventobj) { assert(!(thread && eventobj) && (thread || eventobj)); @@ -1567,7 +1565,7 @@ static struct timeval *thread_timer_wait(struct event_timer_list_head *timers, return timer_val; } -static struct event *thread_run(struct event_master *m, struct event *thread, +static struct event *thread_run(struct event_loop *m, struct event *thread, struct event *fetch) { *fetch = *thread; @@ -1575,9 +1573,8 @@ static struct event *thread_run(struct event_master *m, struct event *thread, return fetch; } -static int thread_process_io_helper(struct event_master *m, - struct event *thread, short state, - short actual_state, int pos) +static int thread_process_io_helper(struct event_loop *m, struct event *thread, + short state, short actual_state, int pos) { struct event **thread_array; @@ -1623,7 +1620,7 @@ static int thread_process_io_helper(struct event_master *m, * @param m the thread master * @param num the number of active file descriptors (return value of poll()) */ -static void thread_process_io(struct event_master *m, unsigned int num) +static void thread_process_io(struct event_loop *m, unsigned int num) { unsigned int ready = 0; struct pollfd *pfds = m->handler.copy; @@ -1681,7 +1678,7 @@ static void thread_process_io(struct event_master *m, unsigned int num) } /* Add all timers that have popped to the ready list. */ -static unsigned int thread_process_timers(struct event_master *m, +static unsigned int thread_process_timers(struct event_loop *m, struct timeval *timenow) { struct timeval prev = *timenow; @@ -1738,7 +1735,7 @@ static unsigned int thread_process(struct event_list_head *list) /* Fetch next ready thread. */ -struct event *event_fetch(struct event_master *m, struct event *fetch) +struct event *event_fetch(struct event_loop *m, struct event *fetch) { struct event *thread = NULL; struct timeval now; @@ -2055,7 +2052,7 @@ void event_call(struct event *thread) } /* Execute thread */ -void _event_execute(const struct xref_eventsched *xref, struct event_master *m, +void _event_execute(const struct xref_eventsched *xref, struct event_loop *m, void (*func)(struct event *), void *arg, int val) { struct event *thread; diff --git a/lib/event.h b/lib/event.h index 7ea4152e5..107949900 100644 --- a/lib/event.h +++ b/lib/event.h @@ -66,7 +66,7 @@ struct xref_eventsched { }; /* Master of the theads. */ -struct event_master { +struct event_loop { char *name; struct event **read; @@ -109,7 +109,7 @@ struct event { struct event_list_item eventitem; struct event_timer_list_item timeritem; struct event **ref; /* external reference (if given) */ - struct event_master *master; /* pointer to the struct event_master */ + struct event_loop *master; /* pointer to the struct event_loop */ void (*func)(struct event *); /* event function */ void *arg; /* event argument */ union { @@ -209,48 +209,48 @@ struct cpu_event_history { }) /* end */ /* Prototypes. */ -extern struct event_master *event_master_create(const char *name); -void event_master_set_name(struct event_master *master, const char *name); -extern void event_master_free(struct event_master *m); -extern void event_master_free_unused(struct event_master *m); +extern struct event_loop *event_master_create(const char *name); +void event_master_set_name(struct event_loop *master, const char *name); +extern void event_master_free(struct event_loop *m); +extern void event_master_free_unused(struct event_loop *m); extern void _event_add_read_write(const struct xref_eventsched *xref, - struct event_master *master, + struct event_loop *master, void (*fn)(struct event *), void *arg, int fd, struct event **tref); extern void _event_add_timer(const struct xref_eventsched *xref, - struct event_master *master, + struct event_loop *master, void (*fn)(struct event *), void *arg, long t, struct event **tref); extern void _event_add_timer_msec(const struct xref_eventsched *xref, - struct event_master *master, + struct event_loop *master, void (*fn)(struct event *), void *arg, long t, struct event **tref); extern void _event_add_timer_tv(const struct xref_eventsched *xref, - struct event_master *master, + struct event_loop *master, void (*fn)(struct event *), void *arg, struct timeval *tv, struct event **tref); extern void _event_add_event(const struct xref_eventsched *xref, - struct event_master *master, + struct event_loop *master, void (*fn)(struct event *), void *arg, int val, struct event **tref); extern void _event_execute(const struct xref_eventsched *xref, - struct event_master *master, + struct event_loop *master, void (*fn)(struct event *), void *arg, int val); extern void event_cancel(struct event **event); -extern void event_cancel_async(struct event_master *m, struct event **eptr, +extern void event_cancel_async(struct event_loop *m, struct event **eptr, void *data); /* Cancel ready tasks with an arg matching 'arg' */ -extern void event_cancel_event_ready(struct event_master *m, void *arg); +extern void event_cancel_event_ready(struct event_loop *m, void *arg); /* Cancel all tasks with an arg matching 'arg', including timers and io */ -extern void event_cancel_event(struct event_master *m, void *arg); -extern struct event *event_fetch(struct event_master *m, struct event *event); +extern void event_cancel_event(struct event_loop *m, void *arg); +extern struct event *event_fetch(struct event_loop *m, struct event *event); extern void event_call(struct event *event); extern unsigned long event_timer_remain_second(struct event *event); extern struct timeval event_timer_remain(struct event *event); diff --git a/lib/frr_pthread.h b/lib/frr_pthread.h index 821e0f1b4..36d0bdae8 100644 --- a/lib/frr_pthread.h +++ b/lib/frr_pthread.h @@ -41,7 +41,7 @@ struct frr_pthread { struct rcu_thread *rcu_thread; /* thread master for this pthread's thread.c event loop */ - struct event_master *master; + struct event_loop *master; /* caller-specified data; start & stop funcs, name, id */ struct frr_pthread_attr attr; diff --git a/lib/frr_zmq.c b/lib/frr_zmq.c index 98cf9ee44..0b17e781e 100644 --- a/lib/frr_zmq.c +++ b/lib/frr_zmq.c @@ -150,7 +150,7 @@ out_err: } int _frrzmq_event_add_read(const struct xref_eventsched *xref, - struct event_master *master, + struct event_loop *master, void (*msgfunc)(void *arg, void *zmqsock), void (*partfunc)(void *arg, void *zmqsock, zmq_msg_t *msg, unsigned partnum), @@ -258,7 +258,7 @@ out_err: } int _frrzmq_event_add_write(const struct xref_eventsched *xref, - struct event_master *master, + struct event_loop *master, void (*msgfunc)(void *arg, void *zmqsock), void (*errfunc)(void *arg, void *zmqsock), void *arg, void *zmqsock, struct frrzmq_cb **cbp) @@ -342,7 +342,7 @@ void frrzmq_check_events(struct frrzmq_cb **cbp, struct cb_core *core, if (zmq_getsockopt(cb->zmqsock, ZMQ_EVENTS, &events, &len)) return; if ((events & event) && core->thread && !core->cancelled) { - struct event_master *tm = core->thread->master; + struct event_loop *tm = core->thread->master; event_cancel(&core->thread); diff --git a/lib/frr_zmq.h b/lib/frr_zmq.h index 47b2e954a..44f209b25 100644 --- a/lib/frr_zmq.h +++ b/lib/frr_zmq.h @@ -109,14 +109,14 @@ struct frrzmq_cb; */ extern int _frrzmq_event_add_read(const struct xref_eventsched *xref, - struct event_master *master, + struct event_loop *master, void (*msgfunc)(void *arg, void *zmqsock), void (*partfunc)(void *arg, void *zmqsock, zmq_msg_t *msg, unsigned partnum), void (*errfunc)(void *arg, void *zmqsock), void *arg, void *zmqsock, struct frrzmq_cb **cb); extern int _frrzmq_event_add_write(const struct xref_eventsched *xref, - struct event_master *master, + struct event_loop *master, void (*msgfunc)(void *arg, void *zmqsock), void (*errfunc)(void *arg, void *zmqsock), void *arg, void *zmqsock, diff --git a/lib/grammar_sandbox_main.c b/lib/grammar_sandbox_main.c index 5f72dcbeb..abd42f359 100644 --- a/lib/grammar_sandbox_main.c +++ b/lib/grammar_sandbox_main.c @@ -23,7 +23,7 @@ static void vty_do_exit(int isexit) exit(0); } -struct event_master *master; +struct event_loop *master; int main(int argc, char **argv) { diff --git a/lib/libfrr.c b/lib/libfrr.c index 6b7579712..07e2eafec 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -33,10 +33,10 @@ #include "frrscript.h" #include "systemd.h" -DEFINE_HOOK(frr_early_init, (struct event_master * tm), (tm)); -DEFINE_HOOK(frr_late_init, (struct event_master * tm), (tm)); -DEFINE_HOOK(frr_config_pre, (struct event_master * tm), (tm)); -DEFINE_HOOK(frr_config_post, (struct event_master * tm), (tm)); +DEFINE_HOOK(frr_early_init, (struct event_loop * tm), (tm)); +DEFINE_HOOK(frr_late_init, (struct event_loop * tm), (tm)); +DEFINE_HOOK(frr_config_pre, (struct event_loop * tm), (tm)); +DEFINE_HOOK(frr_config_post, (struct event_loop * tm), (tm)); DEFINE_KOOH(frr_early_fini, (), ()); DEFINE_KOOH(frr_fini, (), ()); @@ -696,8 +696,8 @@ static void _err_print(const void *cookie, const char *errstr) fprintf(stderr, "%s: %s\n", prefix, errstr); } -static struct event_master *master; -struct event_master *frr_init(void) +static struct event_loop *master; +struct event_loop *frr_init(void) { struct option_chain *oc; struct log_arg *log_arg; @@ -1139,7 +1139,7 @@ void frr_detach(void) frr_check_detach(); } -void frr_run(struct event_master *master) +void frr_run(struct event_loop *master) { char instanceinfo[64] = ""; diff --git a/lib/libfrr.h b/lib/libfrr.h index 3043d6b3f..a60580e1d 100644 --- a/lib/libfrr.h +++ b/lib/libfrr.h @@ -133,22 +133,22 @@ extern int frr_getopt(int argc, char *const argv[], int *longindex); extern __attribute__((__noreturn__)) void frr_help_exit(int status); -extern struct event_master *frr_init(void); +extern struct event_loop *frr_init(void); extern const char *frr_get_progname(void); extern enum frr_cli_mode frr_get_cli_mode(void); extern uint32_t frr_get_fd_limit(void); extern bool frr_is_startup_fd(int fd); /* call order of these hooks is as ordered here */ -DECLARE_HOOK(frr_early_init, (struct event_master * tm), (tm)); -DECLARE_HOOK(frr_late_init, (struct event_master * tm), (tm)); +DECLARE_HOOK(frr_early_init, (struct event_loop * tm), (tm)); +DECLARE_HOOK(frr_late_init, (struct event_loop * tm), (tm)); /* fork() happens between late_init and config_pre */ -DECLARE_HOOK(frr_config_pre, (struct event_master * tm), (tm)); -DECLARE_HOOK(frr_config_post, (struct event_master * tm), (tm)); +DECLARE_HOOK(frr_config_pre, (struct event_loop * tm), (tm)); +DECLARE_HOOK(frr_config_post, (struct event_loop * tm), (tm)); extern void frr_config_fork(void); -extern void frr_run(struct event_master *master); +extern void frr_run(struct event_loop *master); extern void frr_detach(void); extern bool frr_zclient_addr(struct sockaddr_storage *sa, socklen_t *sa_len, diff --git a/lib/libfrr_trace.h b/lib/libfrr_trace.h index 5a957d4c4..4d25f5580 100644 --- a/lib/libfrr_trace.h +++ b/lib/libfrr_trace.h @@ -73,7 +73,7 @@ TRACEPOINT_EVENT( TRACEPOINT_LOGLEVEL(frr_libfrr, hash_release, TRACE_INFO) #define THREAD_SCHEDULE_ARGS \ - TP_ARGS(struct event_master *, master, const char *, funcname, \ + TP_ARGS(struct event_loop *, master, const char *, funcname, \ const char *, schedfrom, int, fromln, struct event **, \ thread_ptr, int, fd, int, val, void *, arg, long, time) diff --git a/lib/mgmt_be_client.c b/lib/mgmt_be_client.c index 4445c2b49..c35399cb5 100644 --- a/lib/mgmt_be_client.c +++ b/lib/mgmt_be_client.c @@ -105,7 +105,7 @@ DECLARE_LIST(mgmt_be_txns, struct mgmt_be_txn_ctx, list_linkage); struct mgmt_be_client_ctx { int conn_fd; - struct event_master *tm; + struct event_loop *tm; struct event *conn_retry_tmr; struct event *conn_read_ev; struct event *conn_write_ev; @@ -1106,7 +1106,7 @@ extern struct nb_config *running_config; * Initialize library and try connecting with MGMTD. */ uintptr_t mgmt_be_client_lib_init(struct mgmt_be_client_params *params, - struct event_master *master_thread) + struct event_loop *master_thread) { assert(master_thread && params && strlen(params->name) && !mgmt_be_client_ctx.tm); diff --git a/lib/mgmt_be_client.h b/lib/mgmt_be_client.h index 2cb90478d..db427457a 100644 --- a/lib/mgmt_be_client.h +++ b/lib/mgmt_be_client.h @@ -189,7 +189,7 @@ mgmt_be_client_name2id(const char *name) * Backend client lib handler (nothing but address of mgmt_be_client_ctx) */ extern uintptr_t mgmt_be_client_lib_init(struct mgmt_be_client_params *params, - struct event_master *master_thread); + struct event_loop *master_thread); /* * Subscribe with MGMTD for one or more YANG subtree(s). diff --git a/lib/mgmt_fe_client.c b/lib/mgmt_fe_client.c index a54de4244..57c1961ff 100644 --- a/lib/mgmt_fe_client.c +++ b/lib/mgmt_fe_client.c @@ -49,7 +49,7 @@ DEFINE_MTYPE_STATIC(LIB, MGMTD_FE_SESSION, "MGMTD Frontend session"); struct mgmt_fe_client_ctx { int conn_fd; - struct event_master *tm; + struct event_loop *tm; struct event *conn_retry_tmr; struct event *conn_read_ev; struct event *conn_write_ev; @@ -784,7 +784,7 @@ static void mgmt_fe_client_schedule_conn_retry( * Initialize library and try connecting with MGMTD. */ uintptr_t mgmt_fe_client_lib_init(struct mgmt_fe_client_params *params, - struct event_master *master_thread) + struct event_loop *master_thread) { assert(master_thread && params && strlen(params->name) && !mgmt_fe_client_ctx.tm); diff --git a/lib/mgmt_fe_client.h b/lib/mgmt_fe_client.h index 2761b4fda..2269a72ac 100644 --- a/lib/mgmt_fe_client.h +++ b/lib/mgmt_fe_client.h @@ -131,7 +131,7 @@ struct mgmt_fe_client_params { * Frontend client lib handler (nothing but address of mgmt_fe_client_ctx) */ extern uintptr_t mgmt_fe_client_lib_init(struct mgmt_fe_client_params *params, - struct event_master *master_thread); + struct event_loop *master_thread); /* * Create a new Session for a Frontend Client connection. diff --git a/lib/northbound.c b/lib/northbound.c index 28952bb26..307cf0fb4 100644 --- a/lib/northbound.c +++ b/lib/northbound.c @@ -2685,7 +2685,7 @@ void nb_validate_callbacks(void) } -void nb_init(struct event_master *tm, +void nb_init(struct event_loop *tm, const struct frr_yang_module_info *const modules[], size_t nmodules, bool db_enabled) { diff --git a/lib/northbound.h b/lib/northbound.h index c29102257..59703363b 100644 --- a/lib/northbound.h +++ b/lib/northbound.h @@ -1478,7 +1478,7 @@ void nb_validate_callbacks(void); * db_enabled * Set this to record the transactions in the transaction log. */ -extern void nb_init(struct event_master *tm, +extern void nb_init(struct event_loop *tm, const struct frr_yang_module_info *const modules[], size_t nmodules, bool db_enabled); diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index f480182c7..5cf5f93b4 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -29,7 +29,7 @@ struct debug nb_dbg_events = {0, "Northbound events"}; struct debug nb_dbg_libyang = {0, "libyang debugging"}; struct nb_config *vty_shared_candidate_config; -static struct event_master *master; +static struct event_loop *master; static void vty_show_nb_errors(struct vty *vty, int error, const char *errmsg) { @@ -1876,7 +1876,7 @@ static const struct cmd_variable_handler yang_var_handlers[] = { .completions = yang_translator_autocomplete}, {.completions = NULL}}; -void nb_cli_init(struct event_master *tm) +void nb_cli_init(struct event_loop *tm) { master = tm; diff --git a/lib/northbound_cli.h b/lib/northbound_cli.h index 630fbe12f..c8f8a8481 100644 --- a/lib/northbound_cli.h +++ b/lib/northbound_cli.h @@ -137,7 +137,7 @@ extern void nb_cli_show_config_prepare(struct nb_config *config, extern void nb_cli_confirmed_commit_clean(struct vty *vty); extern int nb_cli_confirmed_commit_rollback(struct vty *vty); extern void nb_cli_install_default(int node); -extern void nb_cli_init(struct event_master *tm); +extern void nb_cli_init(struct event_loop *tm); extern void nb_cli_terminate(void); #ifdef __cplusplus diff --git a/lib/northbound_confd.c b/lib/northbound_confd.c index 0e01b0603..34406a110 100644 --- a/lib/northbound_confd.c +++ b/lib/northbound_confd.c @@ -23,7 +23,7 @@ DEFINE_MTYPE_STATIC(LIB, CONFD, "ConfD module"); static struct debug nb_dbg_client_confd = {0, "Northbound client: ConfD"}; -static struct event_master *master; +static struct event_loop *master; static struct sockaddr confd_addr; static int cdb_sub_sock, dp_ctl_sock, dp_worker_sock; static struct event *t_cdb_sub, *t_dp_ctl, *t_dp_worker; @@ -1465,7 +1465,7 @@ static int frr_confd_finish(void) return 0; } -static int frr_confd_module_late_init(struct event_master *tm) +static int frr_confd_module_late_init(struct event_loop *tm) { master = tm; diff --git a/lib/northbound_grpc.cpp b/lib/northbound_grpc.cpp index fcea77488..5ce80fb5f 100644 --- a/lib/northbound_grpc.cpp +++ b/lib/northbound_grpc.cpp @@ -38,7 +38,7 @@ */ static bool nb_dbg_client_grpc = 0; -static struct event_master *main_master; +static struct event_loop *main_master; static struct frr_pthread *fpt; @@ -1298,7 +1298,7 @@ error: flog_err(EC_LIB_GRPC_INIT, "failed to initialize the gRPC module"); } -static int frr_grpc_module_late_init(struct event_master *tm) +static int frr_grpc_module_late_init(struct event_loop *tm) { main_master = tm; hook_register(frr_fini, frr_grpc_finish); diff --git a/lib/northbound_sysrepo.c b/lib/northbound_sysrepo.c index 2cfee9de6..86105d2e7 100644 --- a/lib/northbound_sysrepo.c +++ b/lib/northbound_sysrepo.c @@ -23,7 +23,7 @@ DEFINE_MTYPE_STATIC(LIB, SYSREPO, "Sysrepo module"); static struct debug nb_dbg_client_sysrepo = {0, "Northbound client: Sysrepo"}; -static struct event_master *master; +static struct event_loop *master; static sr_session_ctx_t *session; static sr_conn_ctx_t *connection; static struct nb_transaction *transaction; @@ -721,7 +721,7 @@ static int frr_sr_finish(void) return 0; } -static int frr_sr_module_config_loaded(struct event_master *tm) +static int frr_sr_module_config_loaded(struct event_loop *tm) { master = tm; @@ -736,7 +736,7 @@ static int frr_sr_module_config_loaded(struct event_master *tm) return 0; } -static int frr_sr_module_late_init(struct event_master *tm) +static int frr_sr_module_late_init(struct event_loop *tm) { frr_sr_cli_init(); diff --git a/lib/pullwr.c b/lib/pullwr.c index 4dae87314..3967eb587 100644 --- a/lib/pullwr.c +++ b/lib/pullwr.c @@ -16,7 +16,7 @@ struct pullwr { int fd; - struct event_master *tm; + struct event_loop *tm; /* writer == NULL <=> we're idle */ struct event *writer; @@ -40,7 +40,7 @@ DEFINE_MTYPE_STATIC(LIB, PULLWR_BUF, "pull-driven write buffer"); static void pullwr_run(struct event *t); -struct pullwr *_pullwr_new(struct event_master *tm, int fd, void *arg, +struct pullwr *_pullwr_new(struct event_loop *tm, int fd, void *arg, void (*fill)(void *, struct pullwr *), void (*err)(void *, struct pullwr *, bool)) { diff --git a/lib/pullwr.h b/lib/pullwr.h index fee4c9cd6..a589389c3 100644 --- a/lib/pullwr.h +++ b/lib/pullwr.h @@ -45,7 +45,7 @@ struct pullwr; * and released with pullwr_del(). This can be done from inside the callback, * the pullwr code holds no more references on it when calling err(). */ -extern struct pullwr *_pullwr_new(struct event_master *tm, int fd, void *arg, +extern struct pullwr *_pullwr_new(struct event_loop *tm, int fd, void *arg, void (*fill)(void *, struct pullwr *), void (*err)(void *, struct pullwr *, bool eof)); diff --git a/lib/resolver.c b/lib/resolver.c index e5932299f..d5915040b 100644 --- a/lib/resolver.c +++ b/lib/resolver.c @@ -23,7 +23,7 @@ XREF_SETUP(); struct resolver_state { ares_channel channel; - struct event_master *master; + struct event_loop *master; struct event *timeout; }; @@ -314,7 +314,7 @@ static int resolver_config_write_debug(struct vty *vty) } -void resolver_init(struct event_master *tm) +void resolver_init(struct event_loop *tm) { struct ares_options ares_opts; diff --git a/lib/resolver.h b/lib/resolver.h index 98da02c22..aba4e16c0 100644 --- a/lib/resolver.h +++ b/lib/resolver.h @@ -22,7 +22,7 @@ struct resolver_query { struct event *literal_cb; }; -void resolver_init(struct event_master *tm); +void resolver_init(struct event_loop *tm); void resolver_resolve(struct resolver_query *query, int af, vrf_id_t vrf_id, const char *hostname, void (*cb)(struct resolver_query *, const char *, int, diff --git a/lib/sigevent.c b/lib/sigevent.c index 88c010e57..3cd65eb80 100644 --- a/lib/sigevent.c +++ b/lib/sigevent.c @@ -331,8 +331,7 @@ static void trap_default_signals(void) } } -void signal_init(struct event_master *m, int sigc, - struct frr_signal_t signals[]) +void signal_init(struct event_loop *m, int sigc, struct frr_signal_t signals[]) { int i = 0; diff --git a/lib/sigevent.h b/lib/sigevent.h index 8eef32853..34753e1fd 100644 --- a/lib/sigevent.h +++ b/lib/sigevent.h @@ -25,12 +25,12 @@ struct frr_signal_t { /* initialise sigevent system * takes: - * - pointer to valid struct event_master + * - pointer to valid struct event_loop * - number of elements in passed in signals array * - array of frr_signal_t's describing signals to handle * and handlers to use for each signal */ -extern void signal_init(struct event_master *m, int sigc, +extern void signal_init(struct event_loop *m, int sigc, struct frr_signal_t *signals); diff --git a/lib/smux.h b/lib/smux.h index d83a34b30..366bf6fea 100644 --- a/lib/smux.h +++ b/lib/smux.h @@ -99,7 +99,7 @@ struct index_oid { */ extern bool smux_enabled(void); -extern void smux_init(struct event_master *tm); +extern void smux_init(struct event_loop *tm); extern void smux_agentx_enable(void); extern void smux_register_mib(const char *, struct variable *, size_t, int, oid[], size_t); diff --git a/lib/spf_backoff.c b/lib/spf_backoff.c index b363f6f0b..ab9c94445 100644 --- a/lib/spf_backoff.c +++ b/lib/spf_backoff.c @@ -37,7 +37,7 @@ enum spf_backoff_state { }; struct spf_backoff { - struct event_master *m; + struct event_loop *m; /* Timers as per draft */ long init_delay; @@ -70,7 +70,7 @@ static const char *spf_backoff_state2str(enum spf_backoff_state state) return "???"; } -struct spf_backoff *spf_backoff_new(struct event_master *m, const char *name, +struct spf_backoff *spf_backoff_new(struct event_loop *m, const char *name, long init_delay, long short_delay, long long_delay, long holddown, long timetolearn) diff --git a/lib/spf_backoff.h b/lib/spf_backoff.h index c550c66c8..83f1b76ad 100644 --- a/lib/spf_backoff.h +++ b/lib/spf_backoff.h @@ -18,10 +18,10 @@ extern "C" { #endif struct spf_backoff; -struct event_master; +struct event_loop; struct vty; -struct spf_backoff *spf_backoff_new(struct event_master *m, const char *name, +struct spf_backoff *spf_backoff_new(struct event_loop *m, const char *name, long init_delay, long short_delay, long long_delay, long holddown, long timetolearn); diff --git a/lib/systemd.c b/lib/systemd.c index 7d8421f33..bd364ad66 100644 --- a/lib/systemd.c +++ b/lib/systemd.c @@ -63,7 +63,7 @@ void systemd_send_stopping(void) systemd_send_information("STOPPING=1"); } -static struct event_master *systemd_master = NULL; +static struct event_loop *systemd_master = NULL; static void systemd_send_watchdog(struct event *t) { @@ -74,7 +74,7 @@ static void systemd_send_watchdog(struct event *t) watchdog_msec, NULL); } -void systemd_send_started(struct event_master *m) +void systemd_send_started(struct event_loop *m) { assert(m != NULL); diff --git a/lib/systemd.h b/lib/systemd.h index c8fb328ad..ba2461b8a 100644 --- a/lib/systemd.h +++ b/lib/systemd.h @@ -21,11 +21,11 @@ extern bool sd_stderr_is_journal; void systemd_send_stopping(void); /* - * master - The struct event_master * to use to schedule ourself + * master - The struct event_loop * to use to schedule ourself * the_process - Should we send watchdog if we are not the requested * process? */ -void systemd_send_started(struct event_master *master); +void systemd_send_started(struct event_loop *master); /* * status - A status string to send to systemd @@ -2801,7 +2801,7 @@ int vty_config_node_exit(struct vty *vty) } /* Master of the threads. */ -static struct event_master *vty_master; +static struct event_loop *vty_master; static void vty_event_serv(enum vty_event event, struct vty_serv *vty_serv) { @@ -3655,7 +3655,7 @@ int vty_mgmt_send_get_data(struct vty *vty, Mgmtd__DatastoreId datastore, } /* Install vty's own commands like `who' command. */ -void vty_init(struct event_master *master_thread, bool do_command_logging) +void vty_init(struct event_loop *master_thread, bool do_command_logging) { /* For further configuration read, preserve current directory. */ vty_save_cwd(); @@ -337,7 +337,7 @@ struct vty_arg { extern struct nb_config *vty_mgmt_candidate_config; /* Prototypes. */ -extern void vty_init(struct event_master *m, bool do_command_logging); +extern void vty_init(struct event_loop *m, bool do_command_logging); extern void vty_init_vtysh(void); extern void vty_terminate(void); extern void vty_reset(void); diff --git a/lib/wheel.c b/lib/wheel.c index 02f27e313..d9362bac4 100644 --- a/lib/wheel.c +++ b/lib/wheel.c @@ -60,7 +60,7 @@ static void wheel_timer_thread(struct event *t) event_execute(wheel->master, wheel_timer_thread_helper, wheel, 0); } -struct timer_wheel *wheel_init(struct event_master *master, int period, +struct timer_wheel *wheel_init(struct event_loop *master, int period, size_t slots, unsigned int (*slot_key)(const void *), void (*slot_run)(void *), const char *run_name) diff --git a/lib/wheel.h b/lib/wheel.h index 8b4a83115..0d9ac1002 100644 --- a/lib/wheel.h +++ b/lib/wheel.h @@ -13,7 +13,7 @@ extern "C" { struct timer_wheel { char *name; - struct event_master *master; + struct event_loop *master; int slots; long long curr_slot; unsigned int period; @@ -66,7 +66,7 @@ struct timer_wheel { * and cause significant amount of time handling thread events instead * of running your code. */ -struct timer_wheel *wheel_init(struct event_master *master, int period, +struct timer_wheel *wheel_init(struct event_loop *master, int period, size_t slots, unsigned int (*slot_key)(const void *), void (*slot_run)(void *), const char *run_name); diff --git a/lib/workqueue.c b/lib/workqueue.c index 1da7db682..3b677e008 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -59,8 +59,7 @@ static void work_queue_item_remove(struct work_queue *wq, } /* create new work queue */ -struct work_queue *work_queue_new(struct event_master *m, - const char *queue_name) +struct work_queue *work_queue_new(struct event_loop *m, const char *queue_name) { struct work_queue *new; diff --git a/lib/workqueue.h b/lib/workqueue.h index ca29ae3d1..5d84739d5 100644 --- a/lib/workqueue.h +++ b/lib/workqueue.h @@ -47,7 +47,7 @@ struct work_queue { /* Everything but the specification struct is private * the following may be read */ - struct event_master *master; /* thread master */ + struct event_loop *master; /* thread master */ struct event *thread; /* thread, if one is active */ char *name; /* work queue name */ @@ -137,7 +137,7 @@ static inline void work_queue_item_dequeue(struct work_queue *wq, * user must fill in the spec of the returned work queue before adding * anything to it */ -extern struct work_queue *work_queue_new(struct event_master *m, +extern struct work_queue *work_queue_new(struct event_loop *m, const char *queue_name); /* destroy work queue */ diff --git a/lib/zclient.c b/lib/zclient.c index 0e9ce3d63..d708a711a 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -51,7 +51,7 @@ socklen_t zclient_addr_len; static int zclient_debug; /* Allocate zclient structure. */ -struct zclient *zclient_new(struct event_master *master, +struct zclient *zclient_new(struct event_loop *master, struct zclient_options *opt, zclient_handler *const *handlers, size_t n_handlers) { diff --git a/lib/zclient.h b/lib/zclient.h index 0a20af8c3..367e5b147 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -290,7 +290,7 @@ typedef int (zclient_handler)(ZAPI_CALLBACK_ARGS); /* Structure for the zebra client. */ struct zclient { /* The thread master we schedule ourselves on */ - struct event_master *master; + struct event_loop *master; /* Privileges to change socket values */ struct zebra_privs_t *privs; @@ -862,7 +862,7 @@ int zclient_neigh_ip_encode(struct stream *s, uint16_t cmd, union sockunion *in, extern uint32_t zclient_get_nhg_start(uint32_t proto); -extern struct zclient *zclient_new(struct event_master *m, +extern struct zclient *zclient_new(struct event_loop *m, struct zclient_options *opt, zclient_handler *const *handlers, size_t n_handlers); diff --git a/lib/zlog_5424.h b/lib/zlog_5424.h index 52b5f6821..06525c004 100644 --- a/lib/zlog_5424.h +++ b/lib/zlog_5424.h @@ -14,7 +14,7 @@ #include "qobj.h" struct event; -struct event_master; +struct event_loop; enum zlog_5424_dst { /* can be used to disable a target temporarily */ @@ -78,7 +78,7 @@ struct zlog_cfg_5424 { */ /* sockets only - read handler to reconnect on errors */ - struct event_master *master; + struct event_loop *master; struct event *t_reconnect; unsigned int reconn_backoff, reconn_backoff_cur, reconn_backoff_max; int sock_type; diff --git a/lib/zlog_5424_cli.c b/lib/zlog_5424_cli.c index 31b3390eb..3003df542 100644 --- a/lib/zlog_5424_cli.c +++ b/lib/zlog_5424_cli.c @@ -28,7 +28,7 @@ DECLARE_RBTREE_UNIQ(targets, struct zlog_cfg_5424_user, targets_item, DEFINE_QOBJ_TYPE(zlog_cfg_5424_user); static struct targets_head targets = INIT_RBTREE_UNIQ(targets); -static struct event_master *log_5424_master; +static struct event_loop *log_5424_master; static void clear_dst(struct zlog_cfg_5424_user *cfg); @@ -948,7 +948,7 @@ void log_5424_cmd_init(void) /* hooks */ -static int log_5424_early_init(struct event_master *master); +static int log_5424_early_init(struct event_loop *master); static int log_5424_rotate(void); static int log_5424_fini(void); @@ -959,7 +959,7 @@ __attribute__((_CONSTRUCTOR(475))) static void zlog_5424_startup_init(void) hook_register(frr_fini, log_5424_fini); } -static int log_5424_early_init(struct event_master *master) +static int log_5424_early_init(struct event_loop *master) { log_5424_master = master; |