Skip to content

Commit

Permalink
*: Convert struct event_master to struct event_loop
Browse files Browse the repository at this point in the history
Let's find a better name for it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
  • Loading branch information
donaldsharp committed Mar 24, 2023
1 parent ce50d11 commit cd9d053
Show file tree
Hide file tree
Showing 197 changed files with 330 additions and 338 deletions.
2 changes: 1 addition & 1 deletion babeld/babel_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static void babel_exit_properly(void);
static void babel_save_state_file(void);


struct event_master *master; /* quagga's threads handler */
struct event_loop *master; /* quagga's threads handler */
struct timeval babel_now; /* current time */

unsigned char myid[8]; /* unique id (mac address of an interface) */
Expand Down
2 changes: 1 addition & 1 deletion babeld/babel_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
#include "vty.h"

extern struct timeval babel_now; /* current time */
extern struct event_master *master; /* quagga's threads handler */
extern struct event_loop *master; /* quagga's threads handler */
extern int debug;
extern int resend_delay;

Expand Down
2 changes: 1 addition & 1 deletion bfdd/bfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ void bfd_key_iterate(hash_iter_func hif, void *arg);
unsigned long bfd_get_session_count(void);

/* Export callback functions for `event.c`. */
extern struct event_master *master;
extern struct event_loop *master;

void bfd_recvtimer_cb(struct event *t);
void bfd_echo_recvtimer_cb(struct event *t);
Expand Down
2 changes: 1 addition & 1 deletion bfdd/bfdd.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DEFINE_MTYPE(BFDD, BFDD_CONTROL, "long-lived control socket memory");
DEFINE_MTYPE(BFDD, BFDD_NOTIFICATION, "short-lived control notification data");

/* Master of threads. */
struct event_master *master;
struct event_loop *master;

/* BFDd privileges */
static zebra_capabilities_t _caps_p[] = {ZCAP_BIND, ZCAP_SYS_ADMIN, ZCAP_NET_RAW};
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_bfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ DEFUN(no_neighbor_bfd_profile, no_neighbor_bfd_profile_cmd,
}
#endif /* HAVE_BFDD */

void bgp_bfd_init(struct event_master *tm)
void bgp_bfd_init(struct event_loop *tm)
{
/* Initialize BFD client functions */
bfd_protocol_integration_init(zclient, tm);
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_bfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
((((peer)->sort == BGP_PEER_IBGP) && !(peer)->shared_network) \
|| is_ebgp_multihop_configured((peer)))

extern void bgp_bfd_init(struct event_master *tm);
extern void bgp_bfd_init(struct event_loop *tm);

extern void bgp_bfd_peer_config_write(struct vty *vty, const struct peer *peer,
const char *addr);
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2526,7 +2526,7 @@ static int bmp_config_write(struct bgp *bgp, struct vty *vty)
return 0;
}

static int bgp_bmp_init(struct event_master *tm)
static int bgp_bmp_init(struct event_loop *tm)
{
install_node(&bmp_node);
install_default(BMP_NODE);
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_labelpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static void lp_chunk_free(void *goner)
XFREE(MTYPE_BGP_LABEL_CHUNK, goner);
}

void bgp_lp_init(struct event_master *master, struct labelpool *pool)
void bgp_lp_init(struct event_loop *master, struct labelpool *pool)
{
if (BGP_DEBUG(labelpool, LABELPOOL))
zlog_debug("%s: entry", __func__);
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_labelpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct labelpool {
uint32_t next_chunksize; /* request this many labels */
};

extern void bgp_lp_init(struct event_master *master, struct labelpool *pool);
extern void bgp_lp_init(struct event_loop *master, struct labelpool *pool);
extern void bgp_lp_finish(void);
extern void bgp_lp_get(int type, void *labelid,
int (*cbfunc)(mpls_label_t label, void *labelid, bool allocated));
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_rpki.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ static void rpki_init_sync_socket(void)

}

static int bgp_rpki_init(struct event_master *master)
static int bgp_rpki_init(struct event_loop *master)
{
rpki_debug = false;
rtr_is_running = false;
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "bgpd/bgp_snmp_bgp4v2.h"
#include "bgpd/bgp_mplsvpn_snmp.h"

static int bgp_snmp_init(struct event_master *tm)
static int bgp_snmp_init(struct event_loop *tm)
{
smux_init(tm);
bgp_snmp_bgp4_init(tm);
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_snmp_bgp4.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ int bgpTrapBackwardTransition(struct peer *peer)
return 0;
}

int bgp_snmp_bgp4_init(struct event_master *tm)
int bgp_snmp_bgp4_init(struct event_loop *tm)
{
REGISTER_MIB("mibII/bgp", bgp_variables, variable, bgp_oid);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_snmp_bgp4.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@

extern int bgpTrapEstablished(struct peer *peer);
extern int bgpTrapBackwardTransition(struct peer *peer);
extern int bgp_snmp_bgp4_init(struct event_master *tm);
extern int bgp_snmp_bgp4_init(struct event_loop *tm);

#endif /* _FRR_BGP_SNMP_BGP4_H_ */
2 changes: 1 addition & 1 deletion bgpd/bgp_snmp_bgp4v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ static struct variable bgpv2_variables[] = {
{1, 9, 1, BGP4V2_NLRI_PATH_ATTR_UNKNOWN, 2, 16}},
};

int bgp_snmp_bgp4v2_init(struct event_master *tm)
int bgp_snmp_bgp4v2_init(struct event_loop *tm)
{
REGISTER_MIB("mibII/bgpv2", bgpv2_variables, variable, bgpv2_oid);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_snmp_bgp4v2.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@
#define BGP4V2_ESTABLISHED_NOTIFICATION 1
#define BGP4V2_BACKWARD_TRANSITION_NOTIFICATION 2

extern int bgp_snmp_bgp4v2_init(struct event_master *tm);
extern int bgp_snmp_bgp4v2_init(struct event_loop *tm);

#endif /* _FRR_BGP_SNMP_BGP4V2_H_ */
2 changes: 1 addition & 1 deletion bgpd/bgp_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -3443,7 +3443,7 @@ void bgp_if_init(void)
hook_register_prio(if_del, 0, bgp_if_delete_hook);
}

void bgp_zebra_init(struct event_master *master, unsigned short instance)
void bgp_zebra_init(struct event_loop *master, unsigned short instance)
{
zclient_num_connects = 0;

Expand Down
3 changes: 1 addition & 2 deletions bgpd/bgp_zebra.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
/* Default weight for next hop, if doing weighted ECMP. */
#define BGP_ZEBRA_DEFAULT_NHOP_WEIGHT 1

extern void bgp_zebra_init(struct event_master *master,
unsigned short instance);
extern void bgp_zebra_init(struct event_loop *master, unsigned short instance);
extern void bgp_if_init(void);
extern void bgp_zebra_init_tm_connect(struct bgp *bgp);
extern uint32_t bgp_zebra_tm_get_id(void);
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -8010,7 +8010,7 @@ char *peer_uptime(time_t uptime2, char *buf, size_t len, bool use_json,
return buf;
}

void bgp_master_init(struct event_master *master, const int buffer_size,
void bgp_master_init(struct event_loop *master, const int buffer_size,
struct list *addresses)
{
qobj_init();
Expand Down
4 changes: 2 additions & 2 deletions bgpd/bgpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ struct bgp_master {
struct list *bgp;

/* BGP thread master. */
struct event_master *master;
struct event_loop *master;

/* Listening sockets */
struct list *listen_sockets;
Expand Down Expand Up @@ -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 void bgp_master_init(struct event_master *master, const int buffer_size,
extern void bgp_master_init(struct event_loop *master, const int buffer_size,
struct list *addresses);

extern void bgp_init(unsigned short instance);
Expand Down
2 changes: 1 addition & 1 deletion bgpd/rfapi/rfapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ struct rfapi_rfp_cfg {
* return value:
* rfp_start_val rfp returned value passed on rfp_stop and other rfapi calls
--------------------------------------------*/
extern void *rfp_start(struct event_master *master, struct rfapi_rfp_cfg **cfgp,
extern void *rfp_start(struct event_loop *master, struct rfapi_rfp_cfg **cfgp,
struct rfapi_rfp_cb_methods **cbmp);

/*------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion bgpd/rfapi/rfapi_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "bgpd/bgp_nexthop.h"

extern void rfapi_init(void);
extern void vnc_zebra_init(struct event_master *master);
extern void vnc_zebra_init(struct event_loop *master);
extern void vnc_zebra_destroy(void);

extern void rfapi_delete(struct bgp *);
Expand Down
2 changes: 1 addition & 1 deletion bgpd/rfapi/vnc_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ static zclient_handler *const vnc_handlers[] = {
* Modeled after bgp_zebra.c'bgp_zebra_init()
* Charriere asks, "Is it possible to carry two?"
*/
void vnc_zebra_init(struct event_master *master)
void vnc_zebra_init(struct event_loop *master)
{
/* Set default values. */
zclient_vnc = zclient_new(master, &zclient_options_default,
Expand Down
4 changes: 2 additions & 2 deletions bgpd/rfp-example/librfp/rfp_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
struct rfp_instance_t {
struct rfapi_rfp_cfg rfapi_config;
struct rfapi_rfp_cb_methods rfapi_callbacks;
struct event_master *master;
struct event_loop *master;
uint32_t config_var;
};

Expand Down Expand Up @@ -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
*
--------------------------------------------*/
void *rfp_start(struct event_master *master, struct rfapi_rfp_cfg **cfgp,
void *rfp_start(struct event_loop *master, struct rfapi_rfp_cfg **cfgp,
struct rfapi_rfp_cb_methods **cbmp)
{
memset(&global_rfi, 0, sizeof(global_rfi));
Expand Down
2 changes: 1 addition & 1 deletion doc/developer/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Basic boilerplate:
#include "libfrr.h"
#include "event.h"

static int module_late_init(struct event_master *master)
static int module_late_init(struct event_loop *master)
{
/* Do initialization stuff here */
return 0;
Expand Down
4 changes: 2 additions & 2 deletions doc/developer/process-architecture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ section. For now it provides basic information necessary to understand the
interplay between the event system and kernel threads.

The core event system is implemented in :file:`lib/thread.[ch]`. The primary
structure is ``struct event_master``, hereafter referred to as a
structure is ``struct event_loop``, hereafter referred to as a
``threadmaster``. A ``threadmaster`` is a global state object, or context, that
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
Expand Down Expand Up @@ -95,7 +95,7 @@ irrelevant for the time being) for the specific type. For example, to add a

::

event_add_read(struct event_master *master, int (*handler)(struct event *), void *arg, int fd, struct event **ref);
event_add_read(struct event_loop *master, int (*handler)(struct event *), void *arg, int fd, struct event **ref);

The ``struct event`` is then created and added to the appropriate internal
datastructure within the ``threadmaster``. Note that the ``READ`` and
Expand Down
2 changes: 1 addition & 1 deletion eigrpd/eigrp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct zebra_privs_t eigrpd_privs = {
struct option longopts[] = {{0}};

/* Master of threads. */
struct event_master *master;
struct event_loop *master;

/* Forward declaration of daemon info structure. */
static struct frr_daemon_info eigrpd_di;
Expand Down
2 changes: 1 addition & 1 deletion eigrpd/eigrp_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS);
struct zclient *zclient = NULL;

/* For registering threads. */
extern struct event_master *master;
extern struct event_loop *master;
struct in_addr router_id_zebra;

/* Router-id update message from zebra. */
Expand Down
4 changes: 2 additions & 2 deletions eigrpd/eigrpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct eigrp_master {
struct list *eigrp;

/* EIGRP thread master. */
struct event_master *master;
struct event_loop *master;

/* Zebra interface list. */
struct list *iflist;
Expand All @@ -51,7 +51,7 @@ struct eigrp_master {

/* Extern variables. */
extern struct zclient *zclient;
extern struct event_master *master;
extern struct event_loop *master;
extern struct eigrp_master *eigrp_om;
extern struct zebra_privs_t eigrpd_privs;

Expand Down
2 changes: 1 addition & 1 deletion isisd/isis_bfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ static int bfd_handle_circuit_add_addr(struct isis_circuit *circuit)
return 0;
}

void isis_bfd_init(struct event_master *tm)
void isis_bfd_init(struct event_loop *tm)
{
bfd_protocol_integration_init(zclient, tm);

Expand Down
4 changes: 2 additions & 2 deletions isisd/isis_bfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#define ISIS_BFD_H

struct isis_circuit;
struct event_master;
struct event_loop;

void isis_bfd_circuit_cmd(struct isis_circuit *circuit);
void isis_bfd_init(struct event_master *tm);
void isis_bfd_init(struct event_loop *tm);

#endif

2 changes: 1 addition & 1 deletion isisd/isis_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static const struct option longopts[] = {
{0}};

/* Master of threads. */
struct event_master *master;
struct event_loop *master;

/*
* Prototypes.
Expand Down
2 changes: 1 addition & 1 deletion isisd/isis_snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2797,7 +2797,7 @@ static uint8_t *isis_snmp_find_isadj_prot_supp(struct variable *v, oid *name,


/* Register ISIS-MIB. */
static int isis_snmp_init(struct event_master *tm)
static int isis_snmp_init(struct event_loop *tm)
{
struct isis_func_to_prefix *h2f = isis_func_to_prefix_arr;
struct variable *v;
Expand Down
2 changes: 1 addition & 1 deletion isisd/isis_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ static zclient_handler *const isis_handlers[] = {
[ZEBRA_CLIENT_CLOSE_NOTIFY] = isis_zebra_client_close_notify,
};

void isis_zebra_init(struct event_master *master, int instance)
void isis_zebra_init(struct event_loop *master, int instance)
{
/* Initialize asynchronous zclient. */
zclient = zclient_new(master, &zclient_options_default, isis_handlers,
Expand Down
2 changes: 1 addition & 1 deletion isisd/isis_zebra.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct label_chunk {
};
#define CHUNK_SIZE 64

void isis_zebra_init(struct event_master *master, int instance);
void isis_zebra_init(struct event_loop *master, int instance);
void isis_zebra_stop(void);

struct isis_route_info;
Expand Down
2 changes: 1 addition & 1 deletion isisd/isisd.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ struct isis *isis_lookup_by_sysid(const uint8_t *sysid)
return NULL;
}

void isis_master_init(struct event_master *master)
void isis_master_init(struct event_loop *master)
{
memset(&isis_master, 0, sizeof(isis_master));
im = &isis_master;
Expand Down
6 changes: 3 additions & 3 deletions isisd/isisd.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct isis_master {
/* ISIS instance. */
struct list *isis;
/* ISIS thread master. */
struct event_master *master;
struct event_loop *master;
uint8_t options;
};
#define F_ISIS_UNIT_TEST 0x01
Expand Down Expand Up @@ -252,7 +252,7 @@ DECLARE_MTYPE(ISIS_PLIST_NAME);
DECLARE_HOOK(isis_area_overload_bit_update, (struct isis_area * area), (area));

void isis_terminate(void);
void isis_master_init(struct event_master *master);
void isis_master_init(struct event_loop *master);
void isis_vrf_link(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);
Expand Down Expand Up @@ -329,7 +329,7 @@ void config_end_lsp_generate(struct isis_area *area);
#define ISIS_SR "/frr-isisd:isis/instance/segment-routing"

/* Master of threads. */
extern struct event_master *master;
extern struct event_loop *master;

extern unsigned long debug_adj_pkt;
extern unsigned long debug_snp_pkt;
Expand Down
4 changes: 2 additions & 2 deletions ldpd/ldp_snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ static int ldp_snmp_nbr_state_change(struct nbr * nbr, int old_state)
return 0;
}

static int ldp_snmp_init(struct event_master *tm)
static int ldp_snmp_init(struct event_loop *tm)
{
hook_register(agentx_enabled, ldp_snmp_agentx_enabled);

Expand All @@ -1182,7 +1182,7 @@ static int ldp_snmp_init(struct event_master *tm)
return 0;
}

static int ldp_snmp_register_mib(struct event_master *tm)
static int ldp_snmp_register_mib(struct event_loop *tm)
{
static int registered = 0;

Expand Down
Loading

0 comments on commit cd9d053

Please sign in to comment.