*: Convert struct thread_master to struct event_master and it's ilk

Convert the `struct thread_master` to `struct event_master`
across the code base.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2022-12-11 11:20:40 -05:00
parent 5f6eaa9b96
commit 2453d15dbf
197 changed files with 342 additions and 350 deletions

View file

@ -37,7 +37,7 @@ static void babel_exit_properly(void);
static void babel_save_state_file(void); static void babel_save_state_file(void);
struct thread_master *master; /* quagga's threads handler */ struct event_master *master; /* quagga's threads handler */
struct timeval babel_now; /* current time */ struct timeval babel_now; /* current time */
unsigned char myid[8]; /* unique id (mac address of an interface) */ unsigned char myid[8]; /* unique id (mac address of an interface) */

View file

@ -9,7 +9,7 @@ Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
#include "vty.h" #include "vty.h"
extern struct timeval babel_now; /* current time */ extern struct timeval babel_now; /* current time */
extern struct thread_master *master; /* quagga's threads handler */ extern struct event_master *master; /* quagga's threads handler */
extern int debug; extern int debug;
extern int resend_delay; extern int resend_delay;

View file

@ -686,7 +686,7 @@ void bfd_key_iterate(hash_iter_func hif, void *arg);
unsigned long bfd_get_session_count(void); unsigned long bfd_get_session_count(void);
/* Export callback functions for `event.c`. */ /* Export callback functions for `event.c`. */
extern struct thread_master *master; extern struct event_master *master;
void bfd_recvtimer_cb(struct event *t); void bfd_recvtimer_cb(struct event *t);
void bfd_echo_recvtimer_cb(struct event *t); void bfd_echo_recvtimer_cb(struct event *t);

View file

@ -32,7 +32,7 @@ DEFINE_MTYPE(BFDD, BFDD_CONTROL, "long-lived control socket memory");
DEFINE_MTYPE(BFDD, BFDD_NOTIFICATION, "short-lived control notification data"); DEFINE_MTYPE(BFDD, BFDD_NOTIFICATION, "short-lived control notification data");
/* Master of threads. */ /* Master of threads. */
struct thread_master *master; struct event_master *master;
/* BFDd privileges */ /* BFDd privileges */
static zebra_capabilities_t _caps_p[] = {ZCAP_BIND, ZCAP_SYS_ADMIN, ZCAP_NET_RAW}; static zebra_capabilities_t _caps_p[] = {ZCAP_BIND, ZCAP_SYS_ADMIN, ZCAP_NET_RAW};

View file

@ -609,7 +609,7 @@ DEFUN(no_neighbor_bfd_profile, no_neighbor_bfd_profile_cmd,
} }
#endif /* HAVE_BFDD */ #endif /* HAVE_BFDD */
void bgp_bfd_init(struct thread_master *tm) void bgp_bfd_init(struct event_master *tm)
{ {
/* Initialize BFD client functions */ /* Initialize BFD client functions */
bfd_protocol_integration_init(zclient, tm); bfd_protocol_integration_init(zclient, tm);

View file

@ -12,7 +12,7 @@
((((peer)->sort == BGP_PEER_IBGP) && !(peer)->shared_network) \ ((((peer)->sort == BGP_PEER_IBGP) && !(peer)->shared_network) \
|| is_ebgp_multihop_configured((peer))) || is_ebgp_multihop_configured((peer)))
extern void bgp_bfd_init(struct thread_master *tm); extern void bgp_bfd_init(struct event_master *tm);
extern void bgp_bfd_peer_config_write(struct vty *vty, const struct peer *peer, extern void bgp_bfd_peer_config_write(struct vty *vty, const struct peer *peer,
const char *addr); const char *addr);

View file

@ -2526,7 +2526,7 @@ static int bmp_config_write(struct bgp *bgp, struct vty *vty)
return 0; return 0;
} }
static int bgp_bmp_init(struct thread_master *tm) static int bgp_bmp_init(struct event_master *tm)
{ {
install_node(&bmp_node); install_node(&bmp_node);
install_default(BMP_NODE); install_default(BMP_NODE);

View file

@ -177,7 +177,7 @@ static void lp_chunk_free(void *goner)
XFREE(MTYPE_BGP_LABEL_CHUNK, goner); XFREE(MTYPE_BGP_LABEL_CHUNK, goner);
} }
void bgp_lp_init(struct thread_master *master, struct labelpool *pool) void bgp_lp_init(struct event_master *master, struct labelpool *pool)
{ {
if (BGP_DEBUG(labelpool, LABELPOOL)) if (BGP_DEBUG(labelpool, LABELPOOL))
zlog_debug("%s: entry", __func__); zlog_debug("%s: entry", __func__);

View file

@ -31,7 +31,7 @@ struct labelpool {
uint32_t next_chunksize; /* request this many labels */ uint32_t next_chunksize; /* request this many labels */
}; };
extern void bgp_lp_init(struct thread_master *master, struct labelpool *pool); extern void bgp_lp_init(struct event_master *master, struct labelpool *pool);
extern void bgp_lp_finish(void); extern void bgp_lp_finish(void);
extern void bgp_lp_get(int type, void *labelid, extern void bgp_lp_get(int type, void *labelid,
int (*cbfunc)(mpls_label_t label, void *labelid, bool allocated)); int (*cbfunc)(mpls_label_t label, void *labelid, bool allocated));

View file

@ -591,7 +591,7 @@ err:
} }
static int bgp_rpki_init(struct thread_master *master) static int bgp_rpki_init(struct event_master *master)
{ {
rpki_debug = false; rpki_debug = false;
rtr_is_running = false; rtr_is_running = false;

View file

@ -30,7 +30,7 @@
#include "bgpd/bgp_snmp_bgp4v2.h" #include "bgpd/bgp_snmp_bgp4v2.h"
#include "bgpd/bgp_mplsvpn_snmp.h" #include "bgpd/bgp_mplsvpn_snmp.h"
static int bgp_snmp_init(struct thread_master *tm) static int bgp_snmp_init(struct event_master *tm)
{ {
smux_init(tm); smux_init(tm);
bgp_snmp_bgp4_init(tm); bgp_snmp_bgp4_init(tm);

View file

@ -791,7 +791,7 @@ int bgpTrapBackwardTransition(struct peer *peer)
return 0; return 0;
} }
int bgp_snmp_bgp4_init(struct thread_master *tm) int bgp_snmp_bgp4_init(struct event_master *tm)
{ {
REGISTER_MIB("mibII/bgp", bgp_variables, variable, bgp_oid); REGISTER_MIB("mibII/bgp", bgp_variables, variable, bgp_oid);
return 0; return 0;

View file

@ -71,6 +71,6 @@
extern int bgpTrapEstablished(struct peer *peer); extern int bgpTrapEstablished(struct peer *peer);
extern int bgpTrapBackwardTransition(struct peer *peer); extern int bgpTrapBackwardTransition(struct peer *peer);
extern int bgp_snmp_bgp4_init(struct thread_master *tm); extern int bgp_snmp_bgp4_init(struct event_master *tm);
#endif /* _FRR_BGP_SNMP_BGP4_H_ */ #endif /* _FRR_BGP_SNMP_BGP4_H_ */

View file

@ -1394,7 +1394,7 @@ static struct variable bgpv2_variables[] = {
{1, 9, 1, BGP4V2_NLRI_PATH_ATTR_UNKNOWN, 2, 16}}, {1, 9, 1, BGP4V2_NLRI_PATH_ATTR_UNKNOWN, 2, 16}},
}; };
int bgp_snmp_bgp4v2_init(struct thread_master *tm) int bgp_snmp_bgp4v2_init(struct event_master *tm)
{ {
REGISTER_MIB("mibII/bgpv2", bgpv2_variables, variable, bgpv2_oid); REGISTER_MIB("mibII/bgpv2", bgpv2_variables, variable, bgpv2_oid);
return 0; return 0;

View file

@ -81,6 +81,6 @@
#define BGP4V2_ESTABLISHED_NOTIFICATION 1 #define BGP4V2_ESTABLISHED_NOTIFICATION 1
#define BGP4V2_BACKWARD_TRANSITION_NOTIFICATION 2 #define BGP4V2_BACKWARD_TRANSITION_NOTIFICATION 2
extern int bgp_snmp_bgp4v2_init(struct thread_master *tm); extern int bgp_snmp_bgp4v2_init(struct event_master *tm);
#endif /* _FRR_BGP_SNMP_BGP4V2_H_ */ #endif /* _FRR_BGP_SNMP_BGP4V2_H_ */

View file

@ -3443,7 +3443,7 @@ void bgp_if_init(void)
hook_register_prio(if_del, 0, bgp_if_delete_hook); hook_register_prio(if_del, 0, bgp_if_delete_hook);
} }
void bgp_zebra_init(struct thread_master *master, unsigned short instance) void bgp_zebra_init(struct event_master *master, unsigned short instance)
{ {
zclient_num_connects = 0; zclient_num_connects = 0;

View file

@ -18,7 +18,7 @@
/* Default weight for next hop, if doing weighted ECMP. */ /* Default weight for next hop, if doing weighted ECMP. */
#define BGP_ZEBRA_DEFAULT_NHOP_WEIGHT 1 #define BGP_ZEBRA_DEFAULT_NHOP_WEIGHT 1
extern void bgp_zebra_init(struct thread_master *master, extern void bgp_zebra_init(struct event_master *master,
unsigned short instance); unsigned short instance);
extern void bgp_if_init(void); extern void bgp_if_init(void);
extern void bgp_zebra_init_tm_connect(struct bgp *bgp); extern void bgp_zebra_init_tm_connect(struct bgp *bgp);

View file

@ -8010,7 +8010,7 @@ char *peer_uptime(time_t uptime2, char *buf, size_t len, bool use_json,
return buf; return buf;
} }
void bgp_master_init(struct thread_master *master, const int buffer_size, void bgp_master_init(struct event_master *master, const int buffer_size,
struct list *addresses) struct list *addresses)
{ {
qobj_init(); qobj_init();

View file

@ -98,7 +98,7 @@ struct bgp_master {
struct list *bgp; struct list *bgp;
/* BGP thread master. */ /* BGP thread master. */
struct thread_master *master; struct event_master *master;
/* Listening sockets */ /* Listening sockets */
struct list *listen_sockets; struct list *listen_sockets;
@ -2156,7 +2156,7 @@ extern char *peer_uptime(time_t uptime2, char *buf, size_t len, bool use_json,
extern int bgp_config_write(struct vty *); extern int bgp_config_write(struct vty *);
extern void bgp_master_init(struct thread_master *master, const int buffer_size, extern void bgp_master_init(struct event_master *master, const int buffer_size,
struct list *addresses); struct list *addresses);
extern void bgp_init(unsigned short instance); extern void bgp_init(unsigned short instance);

View file

@ -335,8 +335,7 @@ struct rfapi_rfp_cfg {
* return value: * return value:
* rfp_start_val rfp returned value passed on rfp_stop and other rfapi calls * rfp_start_val rfp returned value passed on rfp_stop and other rfapi calls
--------------------------------------------*/ --------------------------------------------*/
extern void *rfp_start(struct thread_master *master, extern void *rfp_start(struct event_master *master, struct rfapi_rfp_cfg **cfgp,
struct rfapi_rfp_cfg **cfgp,
struct rfapi_rfp_cb_methods **cbmp); struct rfapi_rfp_cb_methods **cbmp);
/*------------------------------------------ /*------------------------------------------

View file

@ -14,7 +14,7 @@
#include "bgpd/bgp_nexthop.h" #include "bgpd/bgp_nexthop.h"
extern void rfapi_init(void); extern void rfapi_init(void);
extern void vnc_zebra_init(struct thread_master *master); extern void vnc_zebra_init(struct event_master *master);
extern void vnc_zebra_destroy(void); extern void vnc_zebra_destroy(void);
extern void rfapi_delete(struct bgp *); extern void rfapi_delete(struct bgp *);

View file

@ -890,7 +890,7 @@ static zclient_handler *const vnc_handlers[] = {
* Modeled after bgp_zebra.c'bgp_zebra_init() * Modeled after bgp_zebra.c'bgp_zebra_init()
* Charriere asks, "Is it possible to carry two?" * Charriere asks, "Is it possible to carry two?"
*/ */
void vnc_zebra_init(struct thread_master *master) void vnc_zebra_init(struct event_master *master)
{ {
/* Set default values. */ /* Set default values. */
zclient_vnc = zclient_new(master, &zclient_options_default, zclient_vnc = zclient_new(master, &zclient_options_default,

View file

@ -17,7 +17,7 @@
struct rfp_instance_t { struct rfp_instance_t {
struct rfapi_rfp_cfg rfapi_config; struct rfapi_rfp_cfg rfapi_config;
struct rfapi_rfp_cb_methods rfapi_callbacks; struct rfapi_rfp_cb_methods rfapi_callbacks;
struct thread_master *master; struct event_master *master;
uint32_t config_var; uint32_t config_var;
}; };
@ -271,7 +271,7 @@ static int rfp_cfg_write_cb(struct vty *vty, void *rfp_start_val)
* rfp_start_val rfp returned value passed on rfp_stop and rfp_cfg_write * rfp_start_val rfp returned value passed on rfp_stop and rfp_cfg_write
* *
--------------------------------------------*/ --------------------------------------------*/
void *rfp_start(struct thread_master *master, struct rfapi_rfp_cfg **cfgp, void *rfp_start(struct event_master *master, struct rfapi_rfp_cfg **cfgp,
struct rfapi_rfp_cb_methods **cbmp) struct rfapi_rfp_cb_methods **cbmp)
{ {
memset(&global_rfi, 0, sizeof(global_rfi)); memset(&global_rfi, 0, sizeof(global_rfi));

View file

@ -58,7 +58,7 @@ Basic boilerplate:
#include "libfrr.h" #include "libfrr.h"
#include "event.h" #include "event.h"
static int module_late_init(struct thread_master *master) static int module_late_init(struct event_master *master)
{ {
/* Do initialization stuff here */ /* Do initialization stuff here */
return 0; return 0;

View file

@ -47,7 +47,7 @@ section. For now it provides basic information necessary to understand the
interplay between the event system and kernel threads. interplay between the event system and kernel threads.
The core event system is implemented in :file:`lib/thread.[ch]`. The primary The core event system is implemented in :file:`lib/thread.[ch]`. The primary
structure is ``struct thread_master``, hereafter referred to as a structure is ``struct event_master``, hereafter referred to as a
``threadmaster``. A ``threadmaster`` is a global state object, or context, that ``threadmaster``. A ``threadmaster`` is a global state object, or context, that
holds all the tasks currently pending execution as well as statistics on tasks holds all the tasks currently pending execution as well as statistics on tasks
that have already executed. The event system is driven by adding tasks to this that have already executed. The event system is driven by adding tasks to this
@ -95,7 +95,7 @@ irrelevant for the time being) for the specific type. For example, to add a
:: ::
event_add_read(struct thread_master *master, int (*handler)(struct event *), void *arg, int fd, struct event **ref); event_add_read(struct event_master *master, int (*handler)(struct event *), void *arg, int fd, struct event **ref);
The ``struct event`` is then created and added to the appropriate internal The ``struct event`` is then created and added to the appropriate internal
datastructure within the ``threadmaster``. Note that the ``READ`` and datastructure within the ``threadmaster``. Note that the ``READ`` and

View file

@ -76,7 +76,7 @@ struct zebra_privs_t eigrpd_privs = {
struct option longopts[] = {{0}}; struct option longopts[] = {{0}};
/* Master of threads. */ /* Master of threads. */
struct thread_master *master; struct event_master *master;
/* Forward declaration of daemon info structure. */ /* Forward declaration of daemon info structure. */
static struct frr_daemon_info eigrpd_di; static struct frr_daemon_info eigrpd_di;

View file

@ -49,7 +49,7 @@ static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS);
struct zclient *zclient = NULL; struct zclient *zclient = NULL;
/* For registering threads. */ /* For registering threads. */
extern struct thread_master *master; extern struct event_master *master;
struct in_addr router_id_zebra; struct in_addr router_id_zebra;
/* Router-id update message from zebra. */ /* Router-id update message from zebra. */

View file

@ -35,7 +35,7 @@ struct eigrp_master {
struct list *eigrp; struct list *eigrp;
/* EIGRP thread master. */ /* EIGRP thread master. */
struct thread_master *master; struct event_master *master;
/* Zebra interface list. */ /* Zebra interface list. */
struct list *iflist; struct list *iflist;
@ -51,7 +51,7 @@ struct eigrp_master {
/* Extern variables. */ /* Extern variables. */
extern struct zclient *zclient; extern struct zclient *zclient;
extern struct thread_master *master; extern struct event_master *master;
extern struct eigrp_master *eigrp_om; extern struct eigrp_master *eigrp_om;
extern struct zebra_privs_t eigrpd_privs; extern struct zebra_privs_t eigrpd_privs;

View file

@ -209,7 +209,7 @@ static int bfd_handle_circuit_add_addr(struct isis_circuit *circuit)
return 0; return 0;
} }
void isis_bfd_init(struct thread_master *tm) void isis_bfd_init(struct event_master *tm)
{ {
bfd_protocol_integration_init(zclient, tm); bfd_protocol_integration_init(zclient, tm);

View file

@ -7,10 +7,10 @@
#define ISIS_BFD_H #define ISIS_BFD_H
struct isis_circuit; struct isis_circuit;
struct thread_master; struct event_master;
void isis_bfd_circuit_cmd(struct isis_circuit *circuit); void isis_bfd_circuit_cmd(struct isis_circuit *circuit);
void isis_bfd_init(struct thread_master *tm); void isis_bfd_init(struct event_master *tm);
#endif #endif

View file

@ -77,7 +77,7 @@ static const struct option longopts[] = {
{0}}; {0}};
/* Master of threads. */ /* Master of threads. */
struct thread_master *master; struct event_master *master;
/* /*
* Prototypes. * Prototypes.

View file

@ -2797,7 +2797,7 @@ static uint8_t *isis_snmp_find_isadj_prot_supp(struct variable *v, oid *name,
/* Register ISIS-MIB. */ /* Register ISIS-MIB. */
static int isis_snmp_init(struct thread_master *tm) static int isis_snmp_init(struct event_master *tm)
{ {
struct isis_func_to_prefix *h2f = isis_func_to_prefix_arr; struct isis_func_to_prefix *h2f = isis_func_to_prefix_arr;
struct variable *v; struct variable *v;

View file

@ -828,7 +828,7 @@ static zclient_handler *const isis_handlers[] = {
[ZEBRA_CLIENT_CLOSE_NOTIFY] = isis_zebra_client_close_notify, [ZEBRA_CLIENT_CLOSE_NOTIFY] = isis_zebra_client_close_notify,
}; };
void isis_zebra_init(struct thread_master *master, int instance) void isis_zebra_init(struct event_master *master, int instance)
{ {
/* Initialize asynchronous zclient. */ /* Initialize asynchronous zclient. */
zclient = zclient_new(master, &zclient_options_default, isis_handlers, zclient = zclient_new(master, &zclient_options_default, isis_handlers,

View file

@ -20,7 +20,7 @@ struct label_chunk {
}; };
#define CHUNK_SIZE 64 #define CHUNK_SIZE 64
void isis_zebra_init(struct thread_master *master, int instance); void isis_zebra_init(struct event_master *master, int instance);
void isis_zebra_stop(void); void isis_zebra_stop(void);
struct isis_route_info; struct isis_route_info;

View file

@ -166,7 +166,7 @@ struct isis *isis_lookup_by_sysid(const uint8_t *sysid)
return NULL; return NULL;
} }
void isis_master_init(struct thread_master *master) void isis_master_init(struct event_master *master)
{ {
memset(&isis_master, 0, sizeof(isis_master)); memset(&isis_master, 0, sizeof(isis_master));
im = &isis_master; im = &isis_master;

View file

@ -71,7 +71,7 @@ struct isis_master {
/* ISIS instance. */ /* ISIS instance. */
struct list *isis; struct list *isis;
/* ISIS thread master. */ /* ISIS thread master. */
struct thread_master *master; struct event_master *master;
uint8_t options; uint8_t options;
}; };
#define F_ISIS_UNIT_TEST 0x01 #define F_ISIS_UNIT_TEST 0x01
@ -252,7 +252,7 @@ DECLARE_MTYPE(ISIS_PLIST_NAME);
DECLARE_HOOK(isis_area_overload_bit_update, (struct isis_area * area), (area)); DECLARE_HOOK(isis_area_overload_bit_update, (struct isis_area * area), (area));
void isis_terminate(void); void isis_terminate(void);
void isis_master_init(struct thread_master *master); void isis_master_init(struct event_master *master);
void isis_vrf_link(struct isis *isis, struct vrf *vrf); void isis_vrf_link(struct isis *isis, struct vrf *vrf);
void isis_vrf_unlink(struct isis *isis, struct vrf *vrf); void isis_vrf_unlink(struct isis *isis, struct vrf *vrf);
struct isis *isis_lookup_by_vrfid(vrf_id_t vrf_id); struct isis *isis_lookup_by_vrfid(vrf_id_t vrf_id);
@ -329,7 +329,7 @@ void config_end_lsp_generate(struct isis_area *area);
#define ISIS_SR "/frr-isisd:isis/instance/segment-routing" #define ISIS_SR "/frr-isisd:isis/instance/segment-routing"
/* Master of threads. */ /* Master of threads. */
extern struct thread_master *master; extern struct event_master *master;
extern unsigned long debug_adj_pkt; extern unsigned long debug_adj_pkt;
extern unsigned long debug_snp_pkt; extern unsigned long debug_snp_pkt;

View file

@ -1173,7 +1173,7 @@ static int ldp_snmp_nbr_state_change(struct nbr * nbr, int old_state)
return 0; return 0;
} }
static int ldp_snmp_init(struct thread_master *tm) static int ldp_snmp_init(struct event_master *tm)
{ {
hook_register(agentx_enabled, ldp_snmp_agentx_enabled); hook_register(agentx_enabled, ldp_snmp_agentx_enabled);
@ -1182,7 +1182,7 @@ static int ldp_snmp_init(struct thread_master *tm)
return 0; return 0;
} }
static int ldp_snmp_register_mib(struct thread_master *tm) static int ldp_snmp_register_mib(struct event_master *tm)
{ {
static int registered = 0; static int registered = 0;

View file

@ -690,8 +690,7 @@ static zclient_handler *const ldp_handlers[] = {
[ZEBRA_OPAQUE_MESSAGE] = ldp_zebra_opaque_msg_handler, [ZEBRA_OPAQUE_MESSAGE] = ldp_zebra_opaque_msg_handler,
}; };
void void ldp_zebra_init(struct event_master *master)
ldp_zebra_init(struct thread_master *master)
{ {
if_zapi_callbacks(ldp_ifp_create, ldp_ifp_up, if_zapi_callbacks(ldp_ifp_create, ldp_ifp_up,
ldp_ifp_down, ldp_ifp_destroy); ldp_ifp_down, ldp_ifp_destroy);

View file

@ -77,7 +77,7 @@ static pid_t lde_pid;
static struct frr_daemon_info ldpd_di; static struct frr_daemon_info ldpd_di;
DEFINE_HOOK(ldp_register_mib, (struct thread_master * tm), (tm)); DEFINE_HOOK(ldp_register_mib, (struct event_master * tm), (tm));
static void ldp_load_module(const char *name) static void ldp_load_module(const char *name)
{ {
@ -104,7 +104,7 @@ enum ldpd_process ldpd_process;
#define LDP_VTY_PORT 2612 #define LDP_VTY_PORT 2612
/* Master of threads. */ /* Master of threads. */
struct thread_master *master; struct event_master *master;
/* ldpd privileges */ /* ldpd privileges */
static zebra_capabilities_t _caps_p [] = static zebra_capabilities_t _caps_p [] =

View file

@ -883,11 +883,11 @@ const char *pw_type_name(uint16_t);
const char *pw_error_code(uint8_t); const char *pw_error_code(uint8_t);
/* quagga */ /* quagga */
extern struct thread_master *master; extern struct event_master *master;
extern char ctl_sock_path[MAXPATHLEN]; extern char ctl_sock_path[MAXPATHLEN];
/* ldp_zebra.c */ /* ldp_zebra.c */
void ldp_zebra_init(struct thread_master *); void ldp_zebra_init(struct event_master *m);
void ldp_zebra_destroy(void); void ldp_zebra_destroy(void);
int ldp_sync_zebra_send_state_update(struct ldp_igp_sync_if_state *); int ldp_sync_zebra_send_state_update(struct ldp_igp_sync_if_state *);
int ldp_zebra_send_rlfa_labels(struct zapi_rlfa_response * int ldp_zebra_send_rlfa_labels(struct zapi_rlfa_response *
@ -904,7 +904,7 @@ void ldp_zebra_regdereg_zebra_info(bool want_register);
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_INTFACELOCAL)) (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_INTFACELOCAL))
#endif #endif
DECLARE_HOOK(ldp_register_mib, (struct thread_master * tm), (tm)); DECLARE_HOOK(ldp_register_mib, (struct event_master * tm), (tm));
extern void ldp_agentx_enabled(void); extern void ldp_agentx_enabled(void);

View file

@ -27,7 +27,7 @@ DEFINE_HOOK(agentx_enabled, (), ());
static bool agentx_enabled = false; static bool agentx_enabled = false;
static struct thread_master *agentx_tm; static struct event_master *agentx_tm;
static struct event *timeout_thr = NULL; static struct event *timeout_thr = NULL;
static struct list *events = NULL; static struct list *events = NULL;
@ -244,7 +244,7 @@ bool smux_enabled(void)
return agentx_enabled; return agentx_enabled;
} }
void smux_init(struct thread_master *tm) void smux_init(struct event_master *tm)
{ {
agentx_tm = tm; agentx_tm = tm;

View file

@ -111,7 +111,7 @@ struct bfd_sessions_global {
struct bfd_source_list source_list; struct bfd_source_list source_list;
/** Pointer to FRR's event manager. */ /** Pointer to FRR's event manager. */
struct thread_master *tm; struct event_master *tm;
/** Pointer to zebra client data structure. */ /** Pointer to zebra client data structure. */
struct zclient *zc; struct zclient *zc;
@ -1039,7 +1039,7 @@ static int bfd_protocol_integration_finish(void)
return 0; return 0;
} }
void bfd_protocol_integration_init(struct zclient *zc, struct thread_master *tm) void bfd_protocol_integration_init(struct zclient *zc, struct event_master *tm)
{ {
/* Initialize data structure. */ /* Initialize data structure. */
TAILQ_INIT(&bsglobal.bsplist); TAILQ_INIT(&bsglobal.bsplist);

View file

@ -348,7 +348,7 @@ void bfd_sess_show(struct vty *vty, struct json_object *json,
* Initializes the BFD integration library. This function executes the * Initializes the BFD integration library. This function executes the
* following actions: * following actions:
* *
* - Copy the `struct thread_master` pointer to use as "thread" to execute * - Copy the `struct event_master` pointer to use as "thread" to execute
* the BFD session parameters installation. * the BFD session parameters installation.
* - Copy the `struct zclient` pointer to install its callbacks. * - Copy the `struct zclient` pointer to install its callbacks.
* - Initializes internal data structures. * - Initializes internal data structures.
@ -356,8 +356,7 @@ void bfd_sess_show(struct vty *vty, struct json_object *json,
* \param tm normally the daemon main thread event manager. * \param tm normally the daemon main thread event manager.
* \param zc the zebra client of the daemon. * \param zc the zebra client of the daemon.
*/ */
void bfd_protocol_integration_init(struct zclient *zc, void bfd_protocol_integration_init(struct zclient *zc, struct event_master *tm);
struct thread_master *tm);
/** /**
* BFD session registration arguments. * BFD session registration arguments.

View file

@ -73,7 +73,7 @@ pthread_key_t thread_current;
static pthread_mutex_t masters_mtx = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t masters_mtx = PTHREAD_MUTEX_INITIALIZER;
static struct list *masters; static struct list *masters;
static void thread_free(struct thread_master *master, struct event *thread); static void thread_free(struct event_master *master, struct event *thread);
#ifndef EXCLUDE_CPU_TIME #ifndef EXCLUDE_CPU_TIME
#define EXCLUDE_CPU_TIME 0 #define EXCLUDE_CPU_TIME 0
@ -185,7 +185,7 @@ static void cpu_record_print(struct vty *vty, uint8_t filter)
{ {
struct cpu_thread_history tmp; struct cpu_thread_history tmp;
void *args[3] = {&tmp, vty, &filter}; void *args[3] = {&tmp, vty, &filter};
struct thread_master *m; struct event_master *m;
struct listnode *ln; struct listnode *ln;
if (!cputime_enabled) 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) static void cpu_record_clear(uint8_t filter)
{ {
uint8_t *tmp = &filter; uint8_t *tmp = &filter;
struct thread_master *m; struct event_master *m;
struct listnode *ln; struct listnode *ln;
frr_with_mutex (&masters_mtx) { frr_with_mutex (&masters_mtx) {
@ -395,7 +395,7 @@ ALIAS (service_walltime_warning,
"Set up miscellaneous service\n" "Set up miscellaneous service\n"
"Warn for tasks exceeding total wallclock threshold\n") "Warn for tasks exceeding total wallclock threshold\n")
static void show_thread_poll_helper(struct vty *vty, struct thread_master *m) static void show_thread_poll_helper(struct vty *vty, struct event_master *m)
{ {
const char *name = m->name ? m->name : "main"; const char *name = m->name ? m->name : "main";
char underline[strlen(name) + 1]; char underline[strlen(name) + 1];
@ -444,7 +444,7 @@ DEFUN_NOSH (show_thread_poll,
"Show poll FD's and information\n") "Show poll FD's and information\n")
{ {
struct listnode *node; struct listnode *node;
struct thread_master *m; struct event_master *m;
frr_with_mutex (&masters_mtx) { frr_with_mutex (&masters_mtx) {
for (ALL_LIST_ELEMENTS_RO(masters, node, m)) { for (ALL_LIST_ELEMENTS_RO(masters, node, m)) {
@ -481,7 +481,7 @@ DEFUN (clear_thread_cpu,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
static void show_thread_timers_helper(struct vty *vty, struct thread_master *m) static void show_thread_timers_helper(struct vty *vty, struct event_master *m)
{ {
const char *name = m->name ? m->name : "main"; const char *name = m->name ? m->name : "main";
char underline[strlen(name) + 1]; 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") "Show all timers and how long they have in the system\n")
{ {
struct listnode *node; struct listnode *node;
struct thread_master *m; struct event_master *m;
frr_with_mutex (&masters_mtx) { frr_with_mutex (&masters_mtx) {
for (ALL_LIST_ELEMENTS_RO(masters, node, m)) for (ALL_LIST_ELEMENTS_RO(masters, node, m))
@ -544,14 +544,14 @@ static void initializer(void)
pthread_key_create(&thread_current, NULL); pthread_key_create(&thread_current, NULL);
} }
struct thread_master *thread_master_create(const char *name) struct event_master *thread_master_create(const char *name)
{ {
struct thread_master *rv; struct event_master *rv;
struct rlimit limit; struct rlimit limit;
pthread_once(&init_once, &initializer); pthread_once(&init_once, &initializer);
rv = XCALLOC(MTYPE_EVENT_MASTER, sizeof(struct thread_master)); rv = XCALLOC(MTYPE_EVENT_MASTER, sizeof(struct event_master));
/* Initialize master mutex */ /* Initialize master mutex */
pthread_mutex_init(&rv->mtx, NULL); pthread_mutex_init(&rv->mtx, NULL);
@ -623,7 +623,7 @@ struct thread_master *thread_master_create(const char *name)
return rv; return rv;
} }
void thread_master_set_name(struct thread_master *master, const char *name) void thread_master_set_name(struct event_master *master, const char *name)
{ {
frr_with_mutex (&master->mtx) { frr_with_mutex (&master->mtx) {
XFREE(MTYPE_EVENT_MASTER, master->name); XFREE(MTYPE_EVENT_MASTER, master->name);
@ -634,7 +634,7 @@ void thread_master_set_name(struct thread_master *master, const char *name)
#define EVENT_UNUSED_DEPTH 10 #define EVENT_UNUSED_DEPTH 10
/* Move thread to unuse list. */ /* Move thread to unuse list. */
static void thread_add_unuse(struct thread_master *m, struct event *thread) static void thread_add_unuse(struct event_master *m, struct event *thread)
{ {
pthread_mutex_t mtxc = thread->mtx; pthread_mutex_t mtxc = thread->mtx;
@ -656,8 +656,8 @@ static void thread_add_unuse(struct thread_master *m, struct event *thread)
} }
/* Free all unused thread. */ /* Free all unused thread. */
static void thread_list_free(struct thread_master *m, static void thread_list_free(struct event_master *m,
struct thread_list_head *list) struct thread_list_head *list)
{ {
struct event *t; struct event *t;
@ -665,7 +665,7 @@ static void thread_list_free(struct thread_master *m,
thread_free(m, t); thread_free(m, t);
} }
static void thread_array_free(struct thread_master *m, static void thread_array_free(struct event_master *m,
struct event **thread_array) struct event **thread_array)
{ {
struct event *t; struct event *t;
@ -689,7 +689,7 @@ static void thread_array_free(struct thread_master *m,
* If we are shutting down, Free up unused threads * If we are shutting down, Free up unused threads
* So we can see if we forget to shut anything off * So we can see if we forget to shut anything off
*/ */
void thread_master_free_unused(struct thread_master *m) void thread_master_free_unused(struct event_master *m)
{ {
frr_with_mutex (&m->mtx) { frr_with_mutex (&m->mtx) {
struct event *t; struct event *t;
@ -699,7 +699,7 @@ void thread_master_free_unused(struct thread_master *m)
} }
/* Stop thread scheduler. */ /* Stop thread scheduler. */
void thread_master_free(struct thread_master *m) void thread_master_free(struct event_master *m)
{ {
struct event *t; struct event *t;
@ -791,7 +791,7 @@ char *event_timer_to_hhmmss(char *buf, int buf_size, struct event *t_timer)
} }
/* Get new thread. */ /* Get new thread. */
static struct event *thread_get(struct thread_master *m, uint8_t type, static struct event *thread_get(struct event_master *m, uint8_t type,
void (*func)(struct event *), void *arg, void (*func)(struct event *), void *arg,
const struct xref_threadsched *xref) const struct xref_threadsched *xref)
{ {
@ -838,7 +838,7 @@ static struct event *thread_get(struct thread_master *m, uint8_t type,
return thread; return thread;
} }
static void thread_free(struct thread_master *master, struct event *thread) static void thread_free(struct event_master *master, struct event *thread)
{ {
/* Update statistics. */ /* Update statistics. */
assert(master->alloc > 0); assert(master->alloc > 0);
@ -849,7 +849,7 @@ static void thread_free(struct thread_master *master, struct event *thread)
XFREE(MTYPE_THREAD, thread); XFREE(MTYPE_THREAD, thread);
} }
static int fd_poll(struct thread_master *m, const struct timeval *timer_wait, static int fd_poll(struct event_master *m, const struct timeval *timer_wait,
bool *eintr_p) bool *eintr_p)
{ {
sigset_t origsigs; sigset_t origsigs;
@ -948,9 +948,8 @@ done:
/* Add new read thread. */ /* Add new read thread. */
void _event_add_read_write(const struct xref_threadsched *xref, void _event_add_read_write(const struct xref_threadsched *xref,
struct thread_master *m, struct event_master *m, void (*func)(struct event *),
void (*func)(struct event *), void *arg, int fd, void *arg, int fd, struct event **t_ptr)
struct event **t_ptr)
{ {
int dir = xref->event_type; int dir = xref->event_type;
struct event *thread = NULL; struct event *thread = NULL;
@ -1028,7 +1027,7 @@ void _event_add_read_write(const struct xref_threadsched *xref,
} }
static void _event_add_timer_timeval(const struct xref_threadsched *xref, static void _event_add_timer_timeval(const struct xref_threadsched *xref,
struct thread_master *m, struct event_master *m,
void (*func)(struct event *), void *arg, void (*func)(struct event *), void *arg,
struct timeval *time_relative, struct timeval *time_relative,
struct event **t_ptr) struct event **t_ptr)
@ -1082,7 +1081,7 @@ static void _event_add_timer_timeval(const struct xref_threadsched *xref,
/* Add timer event thread. */ /* Add timer event thread. */
void _event_add_timer(const struct xref_threadsched *xref, void _event_add_timer(const struct xref_threadsched *xref,
struct thread_master *m, void (*func)(struct event *), struct event_master *m, void (*func)(struct event *),
void *arg, long timer, struct event **t_ptr) void *arg, long timer, struct event **t_ptr)
{ {
struct timeval trel; struct timeval trel;
@ -1097,9 +1096,8 @@ void _event_add_timer(const struct xref_threadsched *xref,
/* Add timer event thread with "millisecond" resolution */ /* Add timer event thread with "millisecond" resolution */
void _event_add_timer_msec(const struct xref_threadsched *xref, void _event_add_timer_msec(const struct xref_threadsched *xref,
struct thread_master *m, struct event_master *m, void (*func)(struct event *),
void (*func)(struct event *), void *arg, long timer, void *arg, long timer, struct event **t_ptr)
struct event **t_ptr)
{ {
struct timeval trel; struct timeval trel;
@ -1113,7 +1111,7 @@ void _event_add_timer_msec(const struct xref_threadsched *xref,
/* Add timer event thread with "timeval" resolution */ /* Add timer event thread with "timeval" resolution */
void _event_add_timer_tv(const struct xref_threadsched *xref, void _event_add_timer_tv(const struct xref_threadsched *xref,
struct thread_master *m, void (*func)(struct event *), struct event_master *m, void (*func)(struct event *),
void *arg, struct timeval *tv, struct event **t_ptr) void *arg, struct timeval *tv, struct event **t_ptr)
{ {
_event_add_timer_timeval(xref, m, func, arg, tv, t_ptr); _event_add_timer_timeval(xref, m, func, arg, tv, t_ptr);
@ -1121,7 +1119,7 @@ void _event_add_timer_tv(const struct xref_threadsched *xref,
/* Add simple event thread. */ /* Add simple event thread. */
void _event_add_event(const struct xref_threadsched *xref, void _event_add_event(const struct xref_threadsched *xref,
struct thread_master *m, void (*func)(struct event *), struct event_master *m, void (*func)(struct event *),
void *arg, int val, struct event **t_ptr) void *arg, int val, struct event **t_ptr)
{ {
struct event *thread = NULL; struct event *thread = NULL;
@ -1168,7 +1166,7 @@ void _event_add_event(const struct xref_threadsched *xref,
* - POLLIN * - POLLIN
* - POLLOUT * - POLLOUT
*/ */
static void event_cancel_rw(struct thread_master *master, int fd, short state, static void event_cancel_rw(struct event_master *master, int fd, short state,
int idx_hint) int idx_hint)
{ {
bool found = false; bool found = false;
@ -1234,7 +1232,7 @@ static void event_cancel_rw(struct thread_master *master, int fd, short state,
* Process task cancellation given a task argument: iterate through the * Process task cancellation given a task argument: iterate through the
* various lists of tasks, looking for any that match the argument. * various lists of tasks, looking for any that match the argument.
*/ */
static void cancel_arg_helper(struct thread_master *master, static void cancel_arg_helper(struct event_master *master,
const struct cancel_req *cr) const struct cancel_req *cr)
{ {
struct event *t; struct event *t;
@ -1327,7 +1325,7 @@ static void cancel_arg_helper(struct thread_master *master,
* @param master the thread master to process * @param master the thread master to process
* @REQUIRE master->mtx * @REQUIRE master->mtx
*/ */
static void do_event_cancel(struct thread_master *master) static void do_event_cancel(struct event_master *master)
{ {
struct thread_list_head *list = NULL; struct thread_list_head *list = NULL;
struct event **thread_array = NULL; struct event **thread_array = NULL;
@ -1409,7 +1407,7 @@ static void do_event_cancel(struct thread_master *master)
/* /*
* Helper function used for multiple flavors of arg-based cancellation. * Helper function used for multiple flavors of arg-based cancellation.
*/ */
static void cancel_event_helper(struct thread_master *m, void *arg, int flags) static void cancel_event_helper(struct event_master *m, void *arg, int flags)
{ {
struct cancel_req *cr; struct cancel_req *cr;
@ -1438,7 +1436,7 @@ static void cancel_event_helper(struct thread_master *m, void *arg, int flags)
* @param m the thread_master to cancel from * @param m the thread_master to cancel from
* @param arg the argument passed when creating the event * @param arg the argument passed when creating the event
*/ */
void event_cancel_event(struct thread_master *master, void *arg) void event_cancel_event(struct event_master *master, void *arg)
{ {
cancel_event_helper(master, arg, 0); cancel_event_helper(master, arg, 0);
} }
@ -1451,7 +1449,7 @@ void event_cancel_event(struct thread_master *master, void *arg)
* @param m the thread_master to cancel from * @param m the thread_master to cancel from
* @param arg the argument passed when creating the event * @param arg the argument passed when creating the event
*/ */
void event_cancel_event_ready(struct thread_master *m, void *arg) void event_cancel_event_ready(struct event_master *m, void *arg)
{ {
/* Only cancel ready/event tasks */ /* Only cancel ready/event tasks */
@ -1467,7 +1465,7 @@ void event_cancel_event_ready(struct thread_master *m, void *arg)
*/ */
void event_cancel(struct event **thread) void event_cancel(struct event **thread)
{ {
struct thread_master *master; struct event_master *master;
if (thread == NULL || *thread == NULL) if (thread == NULL || *thread == NULL)
return; return;
@ -1516,7 +1514,7 @@ void event_cancel(struct event **thread)
* @param thread pointer to thread to cancel * @param thread pointer to thread to cancel
* @param eventobj the event * @param eventobj the event
*/ */
void event_cancel_async(struct thread_master *master, struct event **thread, void event_cancel_async(struct event_master *master, struct event **thread,
void *eventobj) void *eventobj)
{ {
assert(!(thread && eventobj) && (thread || eventobj)); assert(!(thread && eventobj) && (thread || eventobj));
@ -1569,7 +1567,7 @@ static struct timeval *thread_timer_wait(struct thread_timer_list_head *timers,
return timer_val; return timer_val;
} }
static struct event *thread_run(struct thread_master *m, struct event *thread, static struct event *thread_run(struct event_master *m, struct event *thread,
struct event *fetch) struct event *fetch)
{ {
*fetch = *thread; *fetch = *thread;
@ -1577,7 +1575,7 @@ static struct event *thread_run(struct thread_master *m, struct event *thread,
return fetch; return fetch;
} }
static int thread_process_io_helper(struct thread_master *m, static int thread_process_io_helper(struct event_master *m,
struct event *thread, short state, struct event *thread, short state,
short actual_state, int pos) short actual_state, int pos)
{ {
@ -1625,7 +1623,7 @@ static int thread_process_io_helper(struct thread_master *m,
* @param m the thread master * @param m the thread master
* @param num the number of active file descriptors (return value of poll()) * @param num the number of active file descriptors (return value of poll())
*/ */
static void thread_process_io(struct thread_master *m, unsigned int num) static void thread_process_io(struct event_master *m, unsigned int num)
{ {
unsigned int ready = 0; unsigned int ready = 0;
struct pollfd *pfds = m->handler.copy; struct pollfd *pfds = m->handler.copy;
@ -1683,7 +1681,7 @@ static void thread_process_io(struct thread_master *m, unsigned int num)
} }
/* Add all timers that have popped to the ready list. */ /* Add all timers that have popped to the ready list. */
static unsigned int thread_process_timers(struct thread_master *m, static unsigned int thread_process_timers(struct event_master *m,
struct timeval *timenow) struct timeval *timenow)
{ {
struct timeval prev = *timenow; struct timeval prev = *timenow;
@ -1740,7 +1738,7 @@ static unsigned int thread_process(struct thread_list_head *list)
/* Fetch next ready thread. */ /* Fetch next ready thread. */
struct event *event_fetch(struct thread_master *m, struct event *fetch) struct event *event_fetch(struct event_master *m, struct event *fetch)
{ {
struct event *thread = NULL; struct event *thread = NULL;
struct timeval now; struct timeval now;
@ -2057,9 +2055,8 @@ void event_call(struct event *thread)
} }
/* Execute thread */ /* Execute thread */
void _event_execute(const struct xref_threadsched *xref, void _event_execute(const struct xref_threadsched *xref, struct event_master *m,
struct thread_master *m, void (*func)(struct event *), void (*func)(struct event *), void *arg, int val)
void *arg, int val)
{ {
struct event *thread; struct event *thread;

View file

@ -66,7 +66,7 @@ struct xref_threadsched {
}; };
/* Master of the theads. */ /* Master of the theads. */
struct thread_master { struct event_master {
char *name; char *name;
struct event **read; struct event **read;
@ -109,7 +109,7 @@ struct event {
struct thread_list_item threaditem; struct thread_list_item threaditem;
struct thread_timer_list_item timeritem; struct thread_timer_list_item timeritem;
struct event **ref; /* external reference (if given) */ struct event **ref; /* external reference (if given) */
struct thread_master *master; /* pointer to the struct thread_master */ struct event_master *master; /* pointer to the struct event_master */
void (*func)(struct event *); /* event function */ void (*func)(struct event *); /* event function */
void *arg; /* event argument */ void *arg; /* event argument */
union { union {
@ -209,57 +209,58 @@ struct cpu_thread_history {
}) /* end */ }) /* end */
/* Prototypes. */ /* Prototypes. */
extern struct thread_master *thread_master_create(const char *); extern struct event_master *thread_master_create(const char *name);
void thread_master_set_name(struct thread_master *master, const char *name); void thread_master_set_name(struct event_master *master, const char *name);
extern void thread_master_free(struct thread_master *); extern void thread_master_free(struct event_master *m);
extern void thread_master_free_unused(struct thread_master *); extern void thread_master_free_unused(struct event_master *m);
extern void _event_add_read_write(const struct xref_threadsched *xref, extern void _event_add_read_write(const struct xref_threadsched *xref,
struct thread_master *master, struct event_master *master,
void (*fn)(struct event *), void *arg, int fd, void (*fn)(struct event *), void *arg, int fd,
struct event **tref); struct event **tref);
extern void _event_add_timer(const struct xref_threadsched *xref, extern void _event_add_timer(const struct xref_threadsched *xref,
struct thread_master *master, struct event_master *master,
void (*fn)(struct event *), void *arg, long t, void (*fn)(struct event *), void *arg, long t,
struct event **tref); struct event **tref);
extern void _event_add_timer_msec(const struct xref_threadsched *xref, extern void _event_add_timer_msec(const struct xref_threadsched *xref,
struct thread_master *master, struct event_master *master,
void (*fn)(struct event *), void *arg, long t, void (*fn)(struct event *), void *arg, long t,
struct event **tref); struct event **tref);
extern void _event_add_timer_tv(const struct xref_threadsched *xref, extern void _event_add_timer_tv(const struct xref_threadsched *xref,
struct thread_master *master, struct event_master *master,
void (*fn)(struct event *), void *arg, void (*fn)(struct event *), void *arg,
struct timeval *tv, struct event **tref); struct timeval *tv, struct event **tref);
extern void _event_add_event(const struct xref_threadsched *xref, extern void _event_add_event(const struct xref_threadsched *xref,
struct thread_master *master, struct event_master *master,
void (*fn)(struct event *), void *arg, int val, void (*fn)(struct event *), void *arg, int val,
struct event **tref); struct event **tref);
extern void _event_execute(const struct xref_threadsched *xref, extern void _event_execute(const struct xref_threadsched *xref,
struct thread_master *master, struct event_master *master,
void (*fn)(struct event *), void *arg, int val); void (*fn)(struct event *), void *arg, int val);
extern void event_cancel(struct event **event); extern void event_cancel(struct event **event);
extern void event_cancel_async(struct thread_master *, struct event **, void *); extern void event_cancel_async(struct event_master *m, struct event **eptr,
void *data);
/* Cancel ready tasks with an arg matching 'arg' */ /* Cancel ready tasks with an arg matching 'arg' */
extern void event_cancel_event_ready(struct thread_master *m, void *arg); extern void event_cancel_event_ready(struct event_master *m, void *arg);
/* Cancel all tasks with an arg matching 'arg', including timers and io */ /* Cancel all tasks with an arg matching 'arg', including timers and io */
extern void event_cancel_event(struct thread_master *m, void *arg); extern void event_cancel_event(struct event_master *m, void *arg);
extern struct event *event_fetch(struct thread_master *, struct event *event); extern struct event *event_fetch(struct event_master *m, struct event *event);
extern void event_call(struct event *event); extern void event_call(struct event *event);
extern unsigned long event_timer_remain_second(struct event *event); extern unsigned long event_timer_remain_second(struct event *event);
extern struct timeval event_timer_remain(struct event *event); extern struct timeval event_timer_remain(struct event *event);
extern unsigned long event_timer_remain_msec(struct event *event); extern unsigned long event_timer_remain_msec(struct event *event);
extern int event_should_yield(struct event *event); extern int event_should_yield(struct event *event);
/* set yield time for thread */ /* set yield time for thread */
extern void event_set_yield_time(struct event *event, unsigned long); extern void event_set_yield_time(struct event *event, unsigned long ytime);
/* Internal libfrr exports */ /* Internal libfrr exports */
extern void event_getrusage(RUSAGE_T *); extern void event_getrusage(RUSAGE_T *r);
extern void event_cmd_init(void); extern void event_cmd_init(void);
/* Returns elapsed real (wall clock) time. */ /* Returns elapsed real (wall clock) time. */

View file

@ -41,7 +41,7 @@ struct frr_pthread {
struct rcu_thread *rcu_thread; struct rcu_thread *rcu_thread;
/* thread master for this pthread's thread.c event loop */ /* thread master for this pthread's thread.c event loop */
struct thread_master *master; struct event_master *master;
/* caller-specified data; start & stop funcs, name, id */ /* caller-specified data; start & stop funcs, name, id */
struct frr_pthread_attr attr; struct frr_pthread_attr attr;

View file

@ -150,7 +150,7 @@ out_err:
} }
int _frrzmq_event_add_read(const struct xref_threadsched *xref, int _frrzmq_event_add_read(const struct xref_threadsched *xref,
struct thread_master *master, struct event_master *master,
void (*msgfunc)(void *arg, void *zmqsock), void (*msgfunc)(void *arg, void *zmqsock),
void (*partfunc)(void *arg, void *zmqsock, void (*partfunc)(void *arg, void *zmqsock,
zmq_msg_t *msg, unsigned partnum), zmq_msg_t *msg, unsigned partnum),
@ -258,7 +258,7 @@ out_err:
} }
int _frrzmq_event_add_write(const struct xref_threadsched *xref, int _frrzmq_event_add_write(const struct xref_threadsched *xref,
struct thread_master *master, struct event_master *master,
void (*msgfunc)(void *arg, void *zmqsock), void (*msgfunc)(void *arg, void *zmqsock),
void (*errfunc)(void *arg, void *zmqsock), void (*errfunc)(void *arg, void *zmqsock),
void *arg, void *zmqsock, struct frrzmq_cb **cbp) 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)) if (zmq_getsockopt(cb->zmqsock, ZMQ_EVENTS, &events, &len))
return; return;
if ((events & event) && core->thread && !core->cancelled) { if ((events & event) && core->thread && !core->cancelled) {
struct thread_master *tm = core->thread->master; struct event_master *tm = core->thread->master;
event_cancel(&core->thread); event_cancel(&core->thread);

View file

@ -109,14 +109,14 @@ struct frrzmq_cb;
*/ */
extern int extern int
_frrzmq_event_add_read(const struct xref_threadsched *xref, _frrzmq_event_add_read(const struct xref_threadsched *xref,
struct thread_master *master, struct event_master *master,
void (*msgfunc)(void *arg, void *zmqsock), void (*msgfunc)(void *arg, void *zmqsock),
void (*partfunc)(void *arg, void *zmqsock, void (*partfunc)(void *arg, void *zmqsock,
zmq_msg_t *msg, unsigned partnum), zmq_msg_t *msg, unsigned partnum),
void (*errfunc)(void *arg, void *zmqsock), void *arg, void (*errfunc)(void *arg, void *zmqsock), void *arg,
void *zmqsock, struct frrzmq_cb **cb); void *zmqsock, struct frrzmq_cb **cb);
extern int _frrzmq_event_add_write(const struct xref_threadsched *xref, extern int _frrzmq_event_add_write(const struct xref_threadsched *xref,
struct thread_master *master, struct event_master *master,
void (*msgfunc)(void *arg, void *zmqsock), void (*msgfunc)(void *arg, void *zmqsock),
void (*errfunc)(void *arg, void *zmqsock), void (*errfunc)(void *arg, void *zmqsock),
void *arg, void *zmqsock, void *arg, void *zmqsock,

View file

@ -23,7 +23,7 @@ static void vty_do_exit(int isexit)
exit(0); exit(0);
} }
struct thread_master *master; struct event_master *master;
int main(int argc, char **argv) int main(int argc, char **argv)
{ {

View file

@ -33,10 +33,10 @@
#include "frrscript.h" #include "frrscript.h"
#include "systemd.h" #include "systemd.h"
DEFINE_HOOK(frr_early_init, (struct thread_master * tm), (tm)); DEFINE_HOOK(frr_early_init, (struct event_master * tm), (tm));
DEFINE_HOOK(frr_late_init, (struct thread_master * tm), (tm)); DEFINE_HOOK(frr_late_init, (struct event_master * tm), (tm));
DEFINE_HOOK(frr_config_pre, (struct thread_master * tm), (tm)); DEFINE_HOOK(frr_config_pre, (struct event_master * tm), (tm));
DEFINE_HOOK(frr_config_post, (struct thread_master * tm), (tm)); DEFINE_HOOK(frr_config_post, (struct event_master * tm), (tm));
DEFINE_KOOH(frr_early_fini, (), ()); DEFINE_KOOH(frr_early_fini, (), ());
DEFINE_KOOH(frr_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); fprintf(stderr, "%s: %s\n", prefix, errstr);
} }
static struct thread_master *master; static struct event_master *master;
struct thread_master *frr_init(void) struct event_master *frr_init(void)
{ {
struct option_chain *oc; struct option_chain *oc;
struct log_arg *log_arg; struct log_arg *log_arg;
@ -1139,7 +1139,7 @@ void frr_detach(void)
frr_check_detach(); frr_check_detach();
} }
void frr_run(struct thread_master *master) void frr_run(struct event_master *master)
{ {
char instanceinfo[64] = ""; char instanceinfo[64] = "";

View file

@ -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 __attribute__((__noreturn__)) void frr_help_exit(int status);
extern struct thread_master *frr_init(void); extern struct event_master *frr_init(void);
extern const char *frr_get_progname(void); extern const char *frr_get_progname(void);
extern enum frr_cli_mode frr_get_cli_mode(void); extern enum frr_cli_mode frr_get_cli_mode(void);
extern uint32_t frr_get_fd_limit(void); extern uint32_t frr_get_fd_limit(void);
extern bool frr_is_startup_fd(int fd); extern bool frr_is_startup_fd(int fd);
/* call order of these hooks is as ordered here */ /* call order of these hooks is as ordered here */
DECLARE_HOOK(frr_early_init, (struct thread_master * tm), (tm)); DECLARE_HOOK(frr_early_init, (struct event_master * tm), (tm));
DECLARE_HOOK(frr_late_init, (struct thread_master * tm), (tm)); DECLARE_HOOK(frr_late_init, (struct event_master * tm), (tm));
/* fork() happens between late_init and config_pre */ /* fork() happens between late_init and config_pre */
DECLARE_HOOK(frr_config_pre, (struct thread_master * tm), (tm)); DECLARE_HOOK(frr_config_pre, (struct event_master * tm), (tm));
DECLARE_HOOK(frr_config_post, (struct thread_master * tm), (tm)); DECLARE_HOOK(frr_config_post, (struct event_master * tm), (tm));
extern void frr_config_fork(void); extern void frr_config_fork(void);
extern void frr_run(struct thread_master *master); extern void frr_run(struct event_master *master);
extern void frr_detach(void); extern void frr_detach(void);
extern bool frr_zclient_addr(struct sockaddr_storage *sa, socklen_t *sa_len, extern bool frr_zclient_addr(struct sockaddr_storage *sa, socklen_t *sa_len,

View file

@ -73,7 +73,7 @@ TRACEPOINT_EVENT(
TRACEPOINT_LOGLEVEL(frr_libfrr, hash_release, TRACE_INFO) TRACEPOINT_LOGLEVEL(frr_libfrr, hash_release, TRACE_INFO)
#define THREAD_SCHEDULE_ARGS \ #define THREAD_SCHEDULE_ARGS \
TP_ARGS(struct thread_master *, master, const char *, funcname, \ TP_ARGS(struct event_master *, master, const char *, funcname, \
const char *, schedfrom, int, fromln, struct event **, \ const char *, schedfrom, int, fromln, struct event **, \
thread_ptr, int, fd, int, val, void *, arg, long, time) thread_ptr, int, fd, int, val, void *, arg, long, time)

View file

@ -105,7 +105,7 @@ DECLARE_LIST(mgmt_be_txns, struct mgmt_be_txn_ctx, list_linkage);
struct mgmt_be_client_ctx { struct mgmt_be_client_ctx {
int conn_fd; int conn_fd;
struct thread_master *tm; struct event_master *tm;
struct event *conn_retry_tmr; struct event *conn_retry_tmr;
struct event *conn_read_ev; struct event *conn_read_ev;
struct event *conn_write_ev; struct event *conn_write_ev;
@ -1106,7 +1106,7 @@ extern struct nb_config *running_config;
* Initialize library and try connecting with MGMTD. * Initialize library and try connecting with MGMTD.
*/ */
uintptr_t mgmt_be_client_lib_init(struct mgmt_be_client_params *params, uintptr_t mgmt_be_client_lib_init(struct mgmt_be_client_params *params,
struct thread_master *master_thread) struct event_master *master_thread)
{ {
assert(master_thread && params && strlen(params->name) assert(master_thread && params && strlen(params->name)
&& !mgmt_be_client_ctx.tm); && !mgmt_be_client_ctx.tm);

View file

@ -188,9 +188,8 @@ mgmt_be_client_name2id(const char *name)
* Returns: * Returns:
* Backend client lib handler (nothing but address of mgmt_be_client_ctx) * Backend client lib handler (nothing but address of mgmt_be_client_ctx)
*/ */
extern uintptr_t extern uintptr_t mgmt_be_client_lib_init(struct mgmt_be_client_params *params,
mgmt_be_client_lib_init(struct mgmt_be_client_params *params, struct event_master *master_thread);
struct thread_master *master_thread);
/* /*
* Subscribe with MGMTD for one or more YANG subtree(s). * Subscribe with MGMTD for one or more YANG subtree(s).

View file

@ -49,7 +49,7 @@ DEFINE_MTYPE_STATIC(LIB, MGMTD_FE_SESSION, "MGMTD Frontend session");
struct mgmt_fe_client_ctx { struct mgmt_fe_client_ctx {
int conn_fd; int conn_fd;
struct thread_master *tm; struct event_master *tm;
struct event *conn_retry_tmr; struct event *conn_retry_tmr;
struct event *conn_read_ev; struct event *conn_read_ev;
struct event *conn_write_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. * Initialize library and try connecting with MGMTD.
*/ */
uintptr_t mgmt_fe_client_lib_init(struct mgmt_fe_client_params *params, uintptr_t mgmt_fe_client_lib_init(struct mgmt_fe_client_params *params,
struct thread_master *master_thread) struct event_master *master_thread)
{ {
assert(master_thread && params && strlen(params->name) assert(master_thread && params && strlen(params->name)
&& !mgmt_fe_client_ctx.tm); && !mgmt_fe_client_ctx.tm);

View file

@ -130,9 +130,8 @@ struct mgmt_fe_client_params {
* Returns: * Returns:
* Frontend client lib handler (nothing but address of mgmt_fe_client_ctx) * Frontend client lib handler (nothing but address of mgmt_fe_client_ctx)
*/ */
extern uintptr_t extern uintptr_t mgmt_fe_client_lib_init(struct mgmt_fe_client_params *params,
mgmt_fe_client_lib_init(struct mgmt_fe_client_params *params, struct event_master *master_thread);
struct thread_master *master_thread);
/* /*
* Create a new Session for a Frontend Client connection. * Create a new Session for a Frontend Client connection.

View file

@ -2685,7 +2685,7 @@ void nb_validate_callbacks(void)
} }
void nb_init(struct thread_master *tm, void nb_init(struct event_master *tm,
const struct frr_yang_module_info *const modules[], const struct frr_yang_module_info *const modules[],
size_t nmodules, bool db_enabled) size_t nmodules, bool db_enabled)
{ {

View file

@ -1478,7 +1478,7 @@ void nb_validate_callbacks(void);
* db_enabled * db_enabled
* Set this to record the transactions in the transaction log. * Set this to record the transactions in the transaction log.
*/ */
extern void nb_init(struct thread_master *tm, extern void nb_init(struct event_master *tm,
const struct frr_yang_module_info *const modules[], const struct frr_yang_module_info *const modules[],
size_t nmodules, bool db_enabled); size_t nmodules, bool db_enabled);

View file

@ -29,7 +29,7 @@ struct debug nb_dbg_events = {0, "Northbound events"};
struct debug nb_dbg_libyang = {0, "libyang debugging"}; struct debug nb_dbg_libyang = {0, "libyang debugging"};
struct nb_config *vty_shared_candidate_config; struct nb_config *vty_shared_candidate_config;
static struct thread_master *master; static struct event_master *master;
static void vty_show_nb_errors(struct vty *vty, int error, const char *errmsg) 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 = yang_translator_autocomplete},
{.completions = NULL}}; {.completions = NULL}};
void nb_cli_init(struct thread_master *tm) void nb_cli_init(struct event_master *tm)
{ {
master = tm; master = tm;

View file

@ -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 void nb_cli_confirmed_commit_clean(struct vty *vty);
extern int nb_cli_confirmed_commit_rollback(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_install_default(int node);
extern void nb_cli_init(struct thread_master *tm); extern void nb_cli_init(struct event_master *tm);
extern void nb_cli_terminate(void); extern void nb_cli_terminate(void);
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -23,7 +23,7 @@ DEFINE_MTYPE_STATIC(LIB, CONFD, "ConfD module");
static struct debug nb_dbg_client_confd = {0, "Northbound client: ConfD"}; static struct debug nb_dbg_client_confd = {0, "Northbound client: ConfD"};
static struct thread_master *master; static struct event_master *master;
static struct sockaddr confd_addr; static struct sockaddr confd_addr;
static int cdb_sub_sock, dp_ctl_sock, dp_worker_sock; static int cdb_sub_sock, dp_ctl_sock, dp_worker_sock;
static struct event *t_cdb_sub, *t_dp_ctl, *t_dp_worker; static struct event *t_cdb_sub, *t_dp_ctl, *t_dp_worker;
@ -1465,7 +1465,7 @@ static int frr_confd_finish(void)
return 0; return 0;
} }
static int frr_confd_module_late_init(struct thread_master *tm) static int frr_confd_module_late_init(struct event_master *tm)
{ {
master = tm; master = tm;

View file

@ -38,7 +38,7 @@
*/ */
static bool nb_dbg_client_grpc = 0; static bool nb_dbg_client_grpc = 0;
static struct thread_master *main_master; static struct event_master *main_master;
static struct frr_pthread *fpt; static struct frr_pthread *fpt;
@ -1298,7 +1298,7 @@ error:
flog_err(EC_LIB_GRPC_INIT, "failed to initialize the gRPC module"); flog_err(EC_LIB_GRPC_INIT, "failed to initialize the gRPC module");
} }
static int frr_grpc_module_late_init(struct thread_master *tm) static int frr_grpc_module_late_init(struct event_master *tm)
{ {
main_master = tm; main_master = tm;
hook_register(frr_fini, frr_grpc_finish); hook_register(frr_fini, frr_grpc_finish);

View file

@ -23,7 +23,7 @@ DEFINE_MTYPE_STATIC(LIB, SYSREPO, "Sysrepo module");
static struct debug nb_dbg_client_sysrepo = {0, "Northbound client: Sysrepo"}; static struct debug nb_dbg_client_sysrepo = {0, "Northbound client: Sysrepo"};
static struct thread_master *master; static struct event_master *master;
static sr_session_ctx_t *session; static sr_session_ctx_t *session;
static sr_conn_ctx_t *connection; static sr_conn_ctx_t *connection;
static struct nb_transaction *transaction; static struct nb_transaction *transaction;
@ -721,7 +721,7 @@ static int frr_sr_finish(void)
return 0; return 0;
} }
static int frr_sr_module_config_loaded(struct thread_master *tm) static int frr_sr_module_config_loaded(struct event_master *tm)
{ {
master = tm; master = tm;
@ -736,7 +736,7 @@ static int frr_sr_module_config_loaded(struct thread_master *tm)
return 0; return 0;
} }
static int frr_sr_module_late_init(struct thread_master *tm) static int frr_sr_module_late_init(struct event_master *tm)
{ {
frr_sr_cli_init(); frr_sr_cli_init();

View file

@ -16,7 +16,7 @@
struct pullwr { struct pullwr {
int fd; int fd;
struct thread_master *tm; struct event_master *tm;
/* writer == NULL <=> we're idle */ /* writer == NULL <=> we're idle */
struct event *writer; struct event *writer;
@ -40,10 +40,9 @@ DEFINE_MTYPE_STATIC(LIB, PULLWR_BUF, "pull-driven write buffer");
static void pullwr_run(struct event *t); static void pullwr_run(struct event *t);
struct pullwr *_pullwr_new(struct thread_master *tm, int fd, struct pullwr *_pullwr_new(struct event_master *tm, int fd, void *arg,
void *arg, void (*fill)(void *, struct pullwr *),
void (*fill)(void *, struct pullwr *), void (*err)(void *, struct pullwr *, bool))
void (*err)(void *, struct pullwr *, bool))
{ {
struct pullwr *pullwr; struct pullwr *pullwr;

View file

@ -45,10 +45,10 @@ struct pullwr;
* and released with pullwr_del(). This can be done from inside the callback, * 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(). * the pullwr code holds no more references on it when calling err().
*/ */
extern struct pullwr *_pullwr_new(struct thread_master *tm, int fd, extern struct pullwr *_pullwr_new(struct event_master *tm, int fd, void *arg,
void *arg, void (*fill)(void *, struct pullwr *),
void (*fill)(void *, struct pullwr *), void (*err)(void *, struct pullwr *,
void (*err)(void *, struct pullwr *, bool eof)); bool eof));
extern void pullwr_del(struct pullwr *pullwr); extern void pullwr_del(struct pullwr *pullwr);
/* type-checking wrapper. makes sure fill() and err() take a first argument /* type-checking wrapper. makes sure fill() and err() take a first argument

View file

@ -23,7 +23,7 @@ XREF_SETUP();
struct resolver_state { struct resolver_state {
ares_channel channel; ares_channel channel;
struct thread_master *master; struct event_master *master;
struct event *timeout; struct event *timeout;
}; };
@ -314,7 +314,7 @@ static int resolver_config_write_debug(struct vty *vty)
} }
void resolver_init(struct thread_master *tm) void resolver_init(struct event_master *tm)
{ {
struct ares_options ares_opts; struct ares_options ares_opts;

View file

@ -22,7 +22,7 @@ struct resolver_query {
struct event *literal_cb; struct event *literal_cb;
}; };
void resolver_init(struct thread_master *tm); void resolver_init(struct event_master *tm);
void resolver_resolve(struct resolver_query *query, int af, vrf_id_t vrf_id, void resolver_resolve(struct resolver_query *query, int af, vrf_id_t vrf_id,
const char *hostname, const char *hostname,
void (*cb)(struct resolver_query *, const char *, int, void (*cb)(struct resolver_query *, const char *, int,

View file

@ -331,7 +331,7 @@ static void trap_default_signals(void)
} }
} }
void signal_init(struct thread_master *m, int sigc, void signal_init(struct event_master *m, int sigc,
struct frr_signal_t signals[]) struct frr_signal_t signals[])
{ {

View file

@ -25,12 +25,12 @@ struct frr_signal_t {
/* initialise sigevent system /* initialise sigevent system
* takes: * takes:
* - pointer to valid struct thread_master * - pointer to valid struct event_master
* - number of elements in passed in signals array * - number of elements in passed in signals array
* - array of frr_signal_t's describing signals to handle * - array of frr_signal_t's describing signals to handle
* and handlers to use for each signal * and handlers to use for each signal
*/ */
extern void signal_init(struct thread_master *m, int sigc, extern void signal_init(struct event_master *m, int sigc,
struct frr_signal_t *signals); struct frr_signal_t *signals);

View file

@ -99,7 +99,7 @@ struct index_oid {
*/ */
extern bool smux_enabled(void); extern bool smux_enabled(void);
extern void smux_init(struct thread_master *tm); extern void smux_init(struct event_master *tm);
extern void smux_agentx_enable(void); extern void smux_agentx_enable(void);
extern void smux_register_mib(const char *, struct variable *, size_t, int, extern void smux_register_mib(const char *, struct variable *, size_t, int,
oid[], size_t); oid[], size_t);

View file

@ -37,7 +37,7 @@ enum spf_backoff_state {
}; };
struct spf_backoff { struct spf_backoff {
struct thread_master *m; struct event_master *m;
/* Timers as per draft */ /* Timers as per draft */
long init_delay; long init_delay;
@ -70,7 +70,7 @@ static const char *spf_backoff_state2str(enum spf_backoff_state state)
return "???"; return "???";
} }
struct spf_backoff *spf_backoff_new(struct thread_master *m, const char *name, struct spf_backoff *spf_backoff_new(struct event_master *m, const char *name,
long init_delay, long short_delay, long init_delay, long short_delay,
long long_delay, long holddown, long long_delay, long holddown,
long timetolearn) long timetolearn)

View file

@ -18,10 +18,10 @@ extern "C" {
#endif #endif
struct spf_backoff; struct spf_backoff;
struct thread_master; struct event_master;
struct vty; struct vty;
struct spf_backoff *spf_backoff_new(struct thread_master *m, const char *name, struct spf_backoff *spf_backoff_new(struct event_master *m, const char *name,
long init_delay, long short_delay, long init_delay, long short_delay,
long long_delay, long holddown, long long_delay, long holddown,
long timetolearn); long timetolearn);

View file

@ -63,7 +63,7 @@ void systemd_send_stopping(void)
systemd_send_information("STOPPING=1"); systemd_send_information("STOPPING=1");
} }
static struct thread_master *systemd_master = NULL; static struct event_master *systemd_master = NULL;
static void systemd_send_watchdog(struct event *t) static void systemd_send_watchdog(struct event *t)
{ {
@ -74,7 +74,7 @@ static void systemd_send_watchdog(struct event *t)
watchdog_msec, NULL); watchdog_msec, NULL);
} }
void systemd_send_started(struct thread_master *m) void systemd_send_started(struct event_master *m)
{ {
assert(m != NULL); assert(m != NULL);

View file

@ -21,11 +21,11 @@ extern bool sd_stderr_is_journal;
void systemd_send_stopping(void); void systemd_send_stopping(void);
/* /*
* master - The struct thread_master * to use to schedule ourself * master - The struct event_master * to use to schedule ourself
* the_process - Should we send watchdog if we are not the requested * the_process - Should we send watchdog if we are not the requested
* process? * process?
*/ */
void systemd_send_started(struct thread_master *master); void systemd_send_started(struct event_master *master);
/* /*
* status - A status string to send to systemd * status - A status string to send to systemd

View file

@ -2801,7 +2801,7 @@ int vty_config_node_exit(struct vty *vty)
} }
/* Master of the threads. */ /* Master of the threads. */
static struct thread_master *vty_master; static struct event_master *vty_master;
static void vty_event_serv(enum vty_event event, struct vty_serv *vty_serv) 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. */ /* Install vty's own commands like `who' command. */
void vty_init(struct thread_master *master_thread, bool do_command_logging) void vty_init(struct event_master *master_thread, bool do_command_logging)
{ {
/* For further configuration read, preserve current directory. */ /* For further configuration read, preserve current directory. */
vty_save_cwd(); vty_save_cwd();

View file

@ -337,7 +337,7 @@ struct vty_arg {
extern struct nb_config *vty_mgmt_candidate_config; extern struct nb_config *vty_mgmt_candidate_config;
/* Prototypes. */ /* Prototypes. */
extern void vty_init(struct thread_master *, bool do_command_logging); extern void vty_init(struct event_master *m, bool do_command_logging);
extern void vty_init_vtysh(void); extern void vty_init_vtysh(void);
extern void vty_terminate(void); extern void vty_terminate(void);
extern void vty_reset(void); extern void vty_reset(void);

View file

@ -60,10 +60,10 @@ static void wheel_timer_thread(struct event *t)
event_execute(wheel->master, wheel_timer_thread_helper, wheel, 0); event_execute(wheel->master, wheel_timer_thread_helper, wheel, 0);
} }
struct timer_wheel *wheel_init(struct thread_master *master, int period, struct timer_wheel *wheel_init(struct event_master *master, int period,
size_t slots, unsigned int (*slot_key)(const void *), size_t slots,
void (*slot_run)(void *), unsigned int (*slot_key)(const void *),
const char *run_name) void (*slot_run)(void *), const char *run_name)
{ {
struct timer_wheel *wheel; struct timer_wheel *wheel;
size_t i; size_t i;

View file

@ -13,7 +13,7 @@ extern "C" {
struct timer_wheel { struct timer_wheel {
char *name; char *name;
struct thread_master *master; struct event_master *master;
int slots; int slots;
long long curr_slot; long long curr_slot;
unsigned int period; unsigned int period;
@ -66,7 +66,7 @@ struct timer_wheel {
* and cause significant amount of time handling thread events instead * and cause significant amount of time handling thread events instead
* of running your code. * of running your code.
*/ */
struct timer_wheel *wheel_init(struct thread_master *master, int period, struct timer_wheel *wheel_init(struct event_master *master, int period,
size_t slots, size_t slots,
unsigned int (*slot_key)(const void *), unsigned int (*slot_key)(const void *),
void (*slot_run)(void *), const char *run_name); void (*slot_run)(void *), const char *run_name);

View file

@ -59,7 +59,7 @@ static void work_queue_item_remove(struct work_queue *wq,
} }
/* create new work queue */ /* create new work queue */
struct work_queue *work_queue_new(struct thread_master *m, struct work_queue *work_queue_new(struct event_master *m,
const char *queue_name) const char *queue_name)
{ {
struct work_queue *new; struct work_queue *new;

View file

@ -47,7 +47,7 @@ struct work_queue {
/* Everything but the specification struct is private /* Everything but the specification struct is private
* the following may be read * the following may be read
*/ */
struct thread_master *master; /* thread master */ struct event_master *master; /* thread master */
struct event *thread; /* thread, if one is active */ struct event *thread; /* thread, if one is active */
char *name; /* work queue name */ 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 * user must fill in the spec of the returned work queue before adding
* anything to it * anything to it
*/ */
extern struct work_queue *work_queue_new(struct thread_master *m, extern struct work_queue *work_queue_new(struct event_master *m,
const char *queue_name); const char *queue_name);
/* destroy work queue */ /* destroy work queue */

View file

@ -51,7 +51,7 @@ socklen_t zclient_addr_len;
static int zclient_debug; static int zclient_debug;
/* Allocate zclient structure. */ /* Allocate zclient structure. */
struct zclient *zclient_new(struct thread_master *master, struct zclient *zclient_new(struct event_master *master,
struct zclient_options *opt, struct zclient_options *opt,
zclient_handler *const *handlers, size_t n_handlers) zclient_handler *const *handlers, size_t n_handlers)
{ {

View file

@ -290,7 +290,7 @@ typedef int (zclient_handler)(ZAPI_CALLBACK_ARGS);
/* Structure for the zebra client. */ /* Structure for the zebra client. */
struct zclient { struct zclient {
/* The thread master we schedule ourselves on */ /* The thread master we schedule ourselves on */
struct thread_master *master; struct event_master *master;
/* Privileges to change socket values */ /* Privileges to change socket values */
struct zebra_privs_t *privs; 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 uint32_t zclient_get_nhg_start(uint32_t proto);
extern struct zclient *zclient_new(struct thread_master *m, extern struct zclient *zclient_new(struct event_master *m,
struct zclient_options *opt, struct zclient_options *opt,
zclient_handler *const *handlers, zclient_handler *const *handlers,
size_t n_handlers); size_t n_handlers);

View file

@ -14,7 +14,7 @@
#include "qobj.h" #include "qobj.h"
struct event; struct event;
struct thread_master; struct event_master;
enum zlog_5424_dst { enum zlog_5424_dst {
/* can be used to disable a target temporarily */ /* can be used to disable a target temporarily */
@ -78,7 +78,7 @@ struct zlog_cfg_5424 {
*/ */
/* sockets only - read handler to reconnect on errors */ /* sockets only - read handler to reconnect on errors */
struct thread_master *master; struct event_master *master;
struct event *t_reconnect; struct event *t_reconnect;
unsigned int reconn_backoff, reconn_backoff_cur, reconn_backoff_max; unsigned int reconn_backoff, reconn_backoff_cur, reconn_backoff_max;
int sock_type; int sock_type;

View file

@ -28,7 +28,7 @@ DECLARE_RBTREE_UNIQ(targets, struct zlog_cfg_5424_user, targets_item,
DEFINE_QOBJ_TYPE(zlog_cfg_5424_user); DEFINE_QOBJ_TYPE(zlog_cfg_5424_user);
static struct targets_head targets = INIT_RBTREE_UNIQ(targets); static struct targets_head targets = INIT_RBTREE_UNIQ(targets);
static struct thread_master *log_5424_master; static struct event_master *log_5424_master;
static void clear_dst(struct zlog_cfg_5424_user *cfg); static void clear_dst(struct zlog_cfg_5424_user *cfg);
@ -948,7 +948,7 @@ void log_5424_cmd_init(void)
/* hooks */ /* hooks */
static int log_5424_early_init(struct thread_master *master); static int log_5424_early_init(struct event_master *master);
static int log_5424_rotate(void); static int log_5424_rotate(void);
static int log_5424_fini(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); hook_register(frr_fini, log_5424_fini);
} }
static int log_5424_early_init(struct thread_master *master) static int log_5424_early_init(struct event_master *master)
{ {
log_5424_master = master; log_5424_master = master;

View file

@ -27,7 +27,7 @@ static struct mgmt_master mgmt_master;
/* MGMTD process wide configuration pointer to export. */ /* MGMTD process wide configuration pointer to export. */
struct mgmt_master *mm; struct mgmt_master *mm;
void mgmt_master_init(struct thread_master *master, const int buffer_size) void mgmt_master_init(struct event_master *master, const int buffer_size)
{ {
memset(&mgmt_master, 0, sizeof(struct mgmt_master)); memset(&mgmt_master, 0, sizeof(struct mgmt_master));

View file

@ -34,7 +34,7 @@ struct mgmt_txn_ctx;
* MGMTD master for system wide configurations and variables. * MGMTD master for system wide configurations and variables.
*/ */
struct mgmt_master { struct mgmt_master {
struct thread_master *master; struct event_master *master;
/* How big should we set the socket buffer size */ /* How big should we set the socket buffer size */
uint32_t socket_buffer; uint32_t socket_buffer;
@ -95,7 +95,7 @@ extern time_t mgmt_clock(void);
extern int mgmt_config_write(struct vty *vty); extern int mgmt_config_write(struct vty *vty);
extern void mgmt_master_init(struct thread_master *master, extern void mgmt_master_init(struct event_master *master,
const int buffer_size); const int buffer_size);
extern void mgmt_init(void); extern void mgmt_init(void);

View file

@ -106,7 +106,7 @@ static struct mgmt_be_xpath_regexp_map
mgmt_xpath_map[MGMTD_BE_MAX_NUM_XPATH_MAP]; mgmt_xpath_map[MGMTD_BE_MAX_NUM_XPATH_MAP];
static int mgmt_num_xpath_maps; static int mgmt_num_xpath_maps;
static struct thread_master *mgmt_be_adapter_tm; static struct event_master *mgmt_be_adapter_tm;
static struct mgmt_be_adapters_head mgmt_be_adapters; static struct mgmt_be_adapters_head mgmt_be_adapters;
@ -805,7 +805,7 @@ extern void mgmt_be_adapter_unlock(struct mgmt_be_client_adapter **adapter)
*adapter = NULL; *adapter = NULL;
} }
int mgmt_be_adapter_init(struct thread_master *tm) int mgmt_be_adapter_init(struct event_master *tm)
{ {
if (!mgmt_be_adapter_tm) { if (!mgmt_be_adapter_tm) {
mgmt_be_adapter_tm = tm; mgmt_be_adapter_tm = tm;

View file

@ -92,7 +92,7 @@ struct mgmt_be_client_subscr_info {
}; };
/* Initialise backend adapter module. */ /* Initialise backend adapter module. */
extern int mgmt_be_adapter_init(struct thread_master *tm); extern int mgmt_be_adapter_init(struct event_master *tm);
/* Destroy the backend adapter module. */ /* Destroy the backend adapter module. */
extern void mgmt_be_adapter_destroy(void); extern void mgmt_be_adapter_destroy(void);

View file

@ -29,7 +29,7 @@
#endif /* REDIRECT_DEBUG_TO_STDERR */ #endif /* REDIRECT_DEBUG_TO_STDERR */
static int mgmt_be_listen_fd = -1; static int mgmt_be_listen_fd = -1;
static struct thread_master *mgmt_be_listen_tm; static struct event_master *mgmt_be_listen_tm;
static struct event *mgmt_be_listen_ev; static struct event *mgmt_be_listen_ev;
static void mgmt_be_server_register_event(enum mgmt_be_event event); static void mgmt_be_server_register_event(enum mgmt_be_event event);
@ -126,7 +126,7 @@ mgmt_be_server_start_failed:
exit(-1); exit(-1);
} }
int mgmt_be_server_init(struct thread_master *master) int mgmt_be_server_init(struct event_master *master)
{ {
if (mgmt_be_listen_tm) { if (mgmt_be_listen_tm) {
MGMTD_BE_SRVR_DBG("MGMTD Backend Server already running!"); MGMTD_BE_SRVR_DBG("MGMTD Backend Server already running!");

View file

@ -12,7 +12,7 @@
#define MGMTD_BE_MAX_CONN 32 #define MGMTD_BE_MAX_CONN 32
/* Initialise backend server */ /* Initialise backend server */
extern int mgmt_be_server_init(struct thread_master *master); extern int mgmt_be_server_init(struct event_master *master);
/* Destroy backend server */ /* Destroy backend server */
extern void mgmt_be_server_destroy(void); extern void mgmt_be_server_destroy(void);

View file

@ -62,7 +62,7 @@ DECLARE_LIST(mgmt_fe_sessions, struct mgmt_fe_session_ctx, list_linkage);
#define FOREACH_SESSION_IN_LIST(adapter, session) \ #define FOREACH_SESSION_IN_LIST(adapter, session) \
frr_each_safe (mgmt_fe_sessions, &(adapter)->fe_sessions, (session)) frr_each_safe (mgmt_fe_sessions, &(adapter)->fe_sessions, (session))
static struct thread_master *mgmt_fe_adapter_tm; static struct event_master *mgmt_fe_adapter_tm;
static struct mgmt_master *mgmt_fe_adapter_mm; static struct mgmt_master *mgmt_fe_adapter_mm;
static struct mgmt_fe_adapters_head mgmt_fe_adapters; static struct mgmt_fe_adapters_head mgmt_fe_adapters;
@ -1549,7 +1549,7 @@ mgmt_fe_adapter_unlock(struct mgmt_fe_client_adapter **adapter)
*adapter = NULL; *adapter = NULL;
} }
int mgmt_fe_adapter_init(struct thread_master *tm, struct mgmt_master *mm) int mgmt_fe_adapter_init(struct event_master *tm, struct mgmt_master *mm)
{ {
if (!mgmt_fe_adapter_tm) { if (!mgmt_fe_adapter_tm) {
mgmt_fe_adapter_tm = tm; mgmt_fe_adapter_tm = tm;

View file

@ -82,7 +82,7 @@ struct mgmt_fe_client_adapter {
DECLARE_LIST(mgmt_fe_adapters, struct mgmt_fe_client_adapter, list_linkage); DECLARE_LIST(mgmt_fe_adapters, struct mgmt_fe_client_adapter, list_linkage);
/* Initialise frontend adapter module */ /* Initialise frontend adapter module */
extern int mgmt_fe_adapter_init(struct thread_master *tm, extern int mgmt_fe_adapter_init(struct event_master *tm,
struct mgmt_master *cm); struct mgmt_master *cm);
/* Destroy frontend adapter module */ /* Destroy frontend adapter module */

View file

@ -29,7 +29,7 @@
#endif /* REDIRECT_DEBUG_TO_STDERR */ #endif /* REDIRECT_DEBUG_TO_STDERR */
static int mgmt_fe_listen_fd = -1; static int mgmt_fe_listen_fd = -1;
static struct thread_master *mgmt_fe_listen_tm; static struct event_master *mgmt_fe_listen_tm;
static struct event *mgmt_fe_listen_ev; static struct event *mgmt_fe_listen_ev;
static void mgmt_fe_server_register_event(enum mgmt_fe_event event); static void mgmt_fe_server_register_event(enum mgmt_fe_event event);
@ -126,7 +126,7 @@ mgmt_fe_server_start_failed:
exit(-1); exit(-1);
} }
int mgmt_fe_server_init(struct thread_master *master) int mgmt_fe_server_init(struct event_master *master)
{ {
if (mgmt_fe_listen_tm) { if (mgmt_fe_listen_tm) {
MGMTD_FE_SRVR_DBG("MGMTD Frontend Server already running!"); MGMTD_FE_SRVR_DBG("MGMTD Frontend Server already running!");

View file

@ -12,7 +12,7 @@
#define MGMTD_FE_MAX_CONN 32 #define MGMTD_FE_MAX_CONN 32
/* Initialise frontend server */ /* Initialise frontend server */
extern int mgmt_fe_server_init(struct thread_master *master); extern int mgmt_fe_server_init(struct event_master *master);
/* Destroy frontend server */ /* Destroy frontend server */
extern void mgmt_fe_server_destroy(void); extern void mgmt_fe_server_destroy(void);

View file

@ -286,7 +286,7 @@ static int
mgmt_txn_send_be_txn_delete(struct mgmt_txn_ctx *txn, mgmt_txn_send_be_txn_delete(struct mgmt_txn_ctx *txn,
struct mgmt_be_client_adapter *adapter); struct mgmt_be_client_adapter *adapter);
static struct thread_master *mgmt_txn_tm; static struct event_master *mgmt_txn_tm;
static struct mgmt_master *mgmt_txn_mm; static struct mgmt_master *mgmt_txn_mm;
static void mgmt_txn_register_event(struct mgmt_txn_ctx *txn, static void mgmt_txn_register_event(struct mgmt_txn_ctx *txn,
@ -2260,7 +2260,7 @@ static void mgmt_txn_register_event(struct mgmt_txn_ctx *txn,
} }
} }
int mgmt_txn_init(struct mgmt_master *mm, struct thread_master *tm) int mgmt_txn_init(struct mgmt_master *mm, struct event_master *tm)
{ {
if (mgmt_txn_mm || mgmt_txn_tm) if (mgmt_txn_mm || mgmt_txn_tm)
assert(!"MGMTD TXN: Call txn_init() only once"); assert(!"MGMTD TXN: Call txn_init() only once");

View file

@ -65,7 +65,7 @@ static inline const char *mgmt_txn_type2str(enum mgmt_txn_type type)
} }
/* Initialise transaction module. */ /* Initialise transaction module. */
extern int mgmt_txn_init(struct mgmt_master *cm, struct thread_master *tm); extern int mgmt_txn_init(struct mgmt_master *cm, struct event_master *tm);
/* Destroy the transaction module. */ /* Destroy the transaction module. */
extern void mgmt_txn_destroy(void); extern void mgmt_txn_destroy(void);

View file

@ -28,7 +28,7 @@ DEFINE_MGROUP(NHRPD, "NHRP");
unsigned int debug_flags = 0; unsigned int debug_flags = 0;
struct thread_master *master; struct event_master *master;
struct timeval current_time; struct timeval current_time;
/* nhrpd options. */ /* nhrpd options. */

View file

@ -19,7 +19,7 @@ DECLARE_MGROUP(NHRPD);
#define NHRP_VTY_PORT 2610 #define NHRP_VTY_PORT 2610
#define NHRP_DEFAULT_CONFIG "nhrpd.conf" #define NHRP_DEFAULT_CONFIG "nhrpd.conf"
extern struct thread_master *master; extern struct event_master *master;
enum { NHRP_OK = 0, enum { NHRP_OK = 0,
NHRP_ERR_FAIL, NHRP_ERR_FAIL,

View file

@ -62,7 +62,7 @@ struct zebra_privs_t ospf6d_privs = {
struct option longopts[] = {{0}}; struct option longopts[] = {{0}};
/* Master of threads. */ /* Master of threads. */
struct thread_master *master; struct event_master *master;
static void __attribute__((noreturn)) ospf6_exit(int status) static void __attribute__((noreturn)) ospf6_exit(int status)
{ {

View file

@ -1383,7 +1383,7 @@ static int ospf6TrapIfStateChange(struct ospf6_interface *oi, int next_state,
} }
/* Register OSPFv3-MIB. */ /* Register OSPFv3-MIB. */
static int ospf6_snmp_init(struct thread_master *master) static int ospf6_snmp_init(struct event_master *master)
{ {
smux_init(master); smux_init(master);
REGISTER_MIB("OSPFv3MIB", ospfv3_variables, variable, ospfv3_oid); REGISTER_MIB("OSPFv3MIB", ospfv3_variables, variable, ospfv3_oid);

Some files were not shown because too many files have changed in this diff Show more