Skip to content

Commit

Permalink
*: Rename struct thread to struct event
Browse files Browse the repository at this point in the history
Effectively a massive search and replace of
`struct thread` to `struct event`.  Using the
term `thread` gives people the thought that
this event system is a pthread when it is not

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
  • Loading branch information
donaldsharp committed Mar 24, 2023
1 parent cb37cb3 commit e668514
Show file tree
Hide file tree
Showing 299 changed files with 1,245 additions and 1,250 deletions.
12 changes: 6 additions & 6 deletions babeld/babeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
DEFINE_MGROUP(BABELD, "babeld");
DEFINE_MTYPE_STATIC(BABELD, BABEL, "Babel Structure");

static void babel_init_routing_process(struct thread *thread);
static void babel_init_routing_process(struct event *thread);
static void babel_get_myid(void);
static void babel_initial_noise(void);
static void babel_read_protocol(struct thread *thread);
static void babel_main_loop(struct thread *thread);
static void babel_read_protocol(struct event *thread);
static void babel_main_loop(struct event *thread);
static void babel_set_timer(struct timeval *timeout);
static void babel_fill_with_next_timeout(struct timeval *tv);
static void
Expand Down Expand Up @@ -163,7 +163,7 @@ babel_create_routing_process (void)
}

/* thread reading entries form others babel daemons */
static void babel_read_protocol(struct thread *thread)
static void babel_read_protocol(struct event *thread)
{
int rc;
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
Expand Down Expand Up @@ -199,7 +199,7 @@ static void babel_read_protocol(struct thread *thread)
/* Zebra will give some information, especially about interfaces. This function
must be call with a litte timeout wich may give zebra the time to do his job,
making these inits have sense. */
static void babel_init_routing_process(struct thread *thread)
static void babel_init_routing_process(struct event *thread)
{
myseqno = (frr_weak_random() & 0xFFFF);
babel_get_myid();
Expand Down Expand Up @@ -311,7 +311,7 @@ babel_clean_routing_process(void)
}

/* Function used with timeout. */
static void babel_main_loop(struct thread *thread)
static void babel_main_loop(struct event *thread)
{
struct timeval tv;
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
Expand Down
4 changes: 2 additions & 2 deletions babeld/babeld.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
struct babel
{
/* Babel threads. */
struct thread *t_read; /* on Babel protocol's socket */
struct thread *t_update; /* timers */
struct event *t_read; /* on Babel protocol's socket */
struct event *t_update; /* timers */
/* distribute_ctx */
struct distribute_ctx *distribute_ctx;
};
Expand Down
8 changes: 4 additions & 4 deletions bfdd/bfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,14 +618,14 @@ struct bfd_session *ptm_bfd_sess_find(struct bfd_pkt *cp,
return bfd_key_lookup(key);
}

void bfd_xmt_cb(struct thread *t)
void bfd_xmt_cb(struct event *t)
{
struct bfd_session *bs = THREAD_ARG(t);

ptm_bfd_xmt_TO(bs, 0);
}

void bfd_echo_xmt_cb(struct thread *t)
void bfd_echo_xmt_cb(struct event *t)
{
struct bfd_session *bs = THREAD_ARG(t);

Expand All @@ -634,7 +634,7 @@ void bfd_echo_xmt_cb(struct thread *t)
}

/* Was ptm_bfd_detect_TO() */
void bfd_recvtimer_cb(struct thread *t)
void bfd_recvtimer_cb(struct event *t)
{
struct bfd_session *bs = THREAD_ARG(t);

Expand All @@ -647,7 +647,7 @@ void bfd_recvtimer_cb(struct thread *t)
}

/* Was ptm_bfd_echo_detect_TO() */
void bfd_echo_recvtimer_cb(struct thread *t)
void bfd_echo_recvtimer_cb(struct event *t)
{
struct bfd_session *bs = THREAD_ARG(t);

Expand Down
32 changes: 16 additions & 16 deletions bfdd/bfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,12 @@ struct bfd_session {
struct bfd_config_timers timers;
struct bfd_timers cur_timers;
uint64_t detect_TO;
struct thread *echo_recvtimer_ev;
struct thread *recvtimer_ev;
struct event *echo_recvtimer_ev;
struct event *recvtimer_ev;
uint64_t xmt_TO;
uint64_t echo_xmt_TO;
struct thread *xmttimer_ev;
struct thread *echo_xmttimer_ev;
struct event *xmttimer_ev;
struct event *echo_xmttimer_ev;
uint64_t echo_detect_TO;

/* software object state */
Expand Down Expand Up @@ -401,8 +401,8 @@ struct bfd_control_socket {
TAILQ_ENTRY(bfd_control_socket) bcs_entry;

int bcs_sd;
struct thread *bcs_ev;
struct thread *bcs_outev;
struct event *bcs_ev;
struct event *bcs_outev;
struct bcqueue bcs_bcqueue;

/* Notification data */
Expand All @@ -422,7 +422,7 @@ int control_init(const char *path);
void control_shutdown(void);
int control_notify(struct bfd_session *bs, uint8_t notify_state);
int control_notify_config(const char *op, struct bfd_session *bs);
void control_accept(struct thread *t);
void control_accept(struct event *t);


/*
Expand All @@ -439,7 +439,7 @@ struct bfd_vrf_global {
int bg_echov6;
struct vrf *vrf;

struct thread *bg_ev[6];
struct event *bg_ev[6];
};

/* Forward declaration of data plane context struct. */
Expand All @@ -448,7 +448,7 @@ TAILQ_HEAD(dplane_queue, bfd_dplane_ctx);

struct bfd_global {
int bg_csock;
struct thread *bg_csockev;
struct event *bg_csockev;
struct bcslist bg_bcslist;

struct pllist bg_pllist;
Expand All @@ -466,7 +466,7 @@ struct bfd_global {
/* Distributed BFD items. */
bool bg_use_dplane;
int bg_dplane_sock;
struct thread *bg_dplane_sockev;
struct event *bg_dplane_sockev;
struct dplane_queue bg_dplaneq;

/* Debug options. */
Expand Down Expand Up @@ -553,15 +553,15 @@ void ptm_bfd_snd(struct bfd_session *bfd, int fbit);
void ptm_bfd_echo_snd(struct bfd_session *bfd);
void ptm_bfd_echo_fp_snd(struct bfd_session *bfd);

void bfd_recv_cb(struct thread *t);
void bfd_recv_cb(struct event *t);


/*
* event.c
*
* Contains the code related with event loop.
*/
typedef void (*bfd_ev_cb)(struct thread *t);
typedef void (*bfd_ev_cb)(struct event *t);

void bfd_recvtimer_update(struct bfd_session *bs);
void bfd_echo_recvtimer_update(struct bfd_session *bs);
Expand Down Expand Up @@ -688,10 +688,10 @@ unsigned long bfd_get_session_count(void);
/* Export callback functions for `event.c`. */
extern struct thread_master *master;

void bfd_recvtimer_cb(struct thread *t);
void bfd_echo_recvtimer_cb(struct thread *t);
void bfd_xmt_cb(struct thread *t);
void bfd_echo_xmt_cb(struct thread *t);
void bfd_recvtimer_cb(struct event *t);
void bfd_echo_recvtimer_cb(struct event *t);
void bfd_xmt_cb(struct event *t);
void bfd_echo_xmt_cb(struct event *t);

extern struct in6_addr zero_addr;

Expand Down
2 changes: 1 addition & 1 deletion bfdd/bfd_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ static void cp_debug(bool mhop, struct sockaddr_any *peer,
mhop ? "yes" : "no", peerstr, localstr, portstr, vrfstr);
}

void bfd_recv_cb(struct thread *t)
void bfd_recv_cb(struct event *t)
{
int sd = THREAD_FD(t);
struct bfd_session *bfd;
Expand Down
10 changes: 5 additions & 5 deletions bfdd/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ struct bfd_notify_peer *control_notifypeer_find(struct bfd_control_socket *bcs,
struct bfd_control_socket *control_new(int sd);
static void control_free(struct bfd_control_socket *bcs);
static void control_reset_buf(struct bfd_control_buffer *bcb);
static void control_read(struct thread *t);
static void control_write(struct thread *t);
static void control_read(struct event *t);
static void control_write(struct event *t);

static void control_handle_request_add(struct bfd_control_socket *bcs,
struct bfd_control_msg *bcm);
Expand Down Expand Up @@ -142,7 +142,7 @@ void control_shutdown(void)
}
}

void control_accept(struct thread *t)
void control_accept(struct event *t)
{
int csock, sd = THREAD_FD(t);

Expand Down Expand Up @@ -379,7 +379,7 @@ static void control_reset_buf(struct bfd_control_buffer *bcb)
bcb->bcb_left = 0;
}

static void control_read(struct thread *t)
static void control_read(struct event *t)
{
struct bfd_control_socket *bcs = THREAD_ARG(t);
struct bfd_control_buffer *bcb = &bcs->bcs_bin;
Expand Down Expand Up @@ -514,7 +514,7 @@ static void control_read(struct thread *t)
thread_add_read(master, control_read, bcs, sd, &bcs->bcs_ev);
}

static void control_write(struct thread *t)
static void control_write(struct event *t)
{
struct bfd_control_socket *bcs = THREAD_ARG(t);
struct bfd_control_buffer *bcb = bcs->bcs_bout;
Expand Down
16 changes: 8 additions & 8 deletions bfdd/dplane.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ struct bfd_dplane_ctx {
/** Output buffer data. */
struct stream *outbuf;
/** Input event data. */
struct thread *inbufev;
struct event *inbufev;
/** Output event data. */
struct thread *outbufev;
struct event *outbufev;
/** Connection event. */
struct thread *connectev;
struct event *connectev;

/** Amount of bytes read. */
uint64_t in_bytes;
Expand All @@ -94,7 +94,7 @@ struct bfd_dplane_ctx {
*/
typedef void (*bfd_dplane_expect_cb)(struct bfddp_message *msg, void *arg);

static void bfd_dplane_client_connect(struct thread *t);
static void bfd_dplane_client_connect(struct event *t);
static bool bfd_dplane_client_connecting(struct bfd_dplane_ctx *bdc);
static void bfd_dplane_ctx_free(struct bfd_dplane_ctx *bdc);
static int _bfd_dplane_add_session(struct bfd_dplane_ctx *bdc,
Expand Down Expand Up @@ -312,7 +312,7 @@ static ssize_t bfd_dplane_flush(struct bfd_dplane_ctx *bdc)
return total;
}

static void bfd_dplane_write(struct thread *t)
static void bfd_dplane_write(struct event *t)
{
struct bfd_dplane_ctx *bdc = THREAD_ARG(t);

Expand Down Expand Up @@ -599,7 +599,7 @@ static int bfd_dplane_expect(struct bfd_dplane_ctx *bdc, uint16_t id,
return 0;
}

static void bfd_dplane_read(struct thread *t)
static void bfd_dplane_read(struct event *t)
{
struct bfd_dplane_ctx *bdc = THREAD_ARG(t);
int rv;
Expand Down Expand Up @@ -819,7 +819,7 @@ static uint16_t bfd_dplane_request_counters(const struct bfd_session *bs)
/*
* Data plane listening socket.
*/
static void bfd_dplane_accept(struct thread *t)
static void bfd_dplane_accept(struct event *t)
{
struct bfd_global *bg = THREAD_ARG(t);
struct bfd_dplane_ctx *bdc;
Expand Down Expand Up @@ -899,7 +899,7 @@ static bool bfd_dplane_client_connecting(struct bfd_dplane_ctx *bdc)
}
}

static void bfd_dplane_client_connect(struct thread *t)
static void bfd_dplane_client_connect(struct event *t)
{
struct bfd_dplane_ctx *bdc = THREAD_ARG(t);
int rv, sock;
Expand Down
8 changes: 4 additions & 4 deletions bgpd/bgp_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ static void bmp_stat_put_u32(struct stream *s, size_t *cnt, uint16_t type,
(*cnt)++;
}

static void bmp_stats(struct thread *thread)
static void bmp_stats(struct event *thread)
{
struct bmp_targets *bt = THREAD_ARG(thread);
struct stream *s;
Expand Down Expand Up @@ -1388,7 +1388,7 @@ static void bmp_stats(struct thread *thread)
}

/* read from the BMP socket to detect session termination */
static void bmp_read(struct thread *t)
static void bmp_read(struct event *t)
{
struct bmp *bmp = THREAD_ARG(t);
char buf[1024];
Expand Down Expand Up @@ -1492,7 +1492,7 @@ static struct bmp *bmp_open(struct bmp_targets *bt, int bmp_sock)
}

/* Accept BMP connection. */
static void bmp_accept(struct thread *thread)
static void bmp_accept(struct event *thread)
{
union sockunion su;
struct bmp_listener *bl = THREAD_ARG(thread);
Expand Down Expand Up @@ -1902,7 +1902,7 @@ static void bmp_active_resolved(struct resolver_query *resq, const char *errstr,
bmp_active_connect(ba);
}

static void bmp_active_thread(struct thread *t)
static void bmp_active_thread(struct event *t)
{
struct bmp_active *ba = THREAD_ARG(t);
socklen_t slen;
Expand Down
8 changes: 4 additions & 4 deletions bgpd/bgp_bmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ struct bmp {

int socket;
char remote[SU_ADDRSTRLEN + 6];
struct thread *t_read;
struct event *t_read;

struct pullwr *pullwr;

Expand Down Expand Up @@ -176,7 +176,7 @@ struct bmp_active {
union sockunion addrs[8];
int socket;
const char *last_err;
struct thread *t_timer, *t_read, *t_write;
struct event *t_timer, *t_read, *t_write;
};

/* config & state for passive / listening sockets */
Expand All @@ -190,7 +190,7 @@ struct bmp_listener {
union sockunion addr;
int port;

struct thread *t_accept;
struct event *t_accept;
int sock;
};

Expand Down Expand Up @@ -226,7 +226,7 @@ struct bmp_targets {

struct bmp_actives_head actives;

struct thread *t_stats;
struct event *t_stats;
struct bmp_session_head sessions;

struct bmp_qhash_head updhash;
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_conditional_adv.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static void bgp_conditional_adv_routes(struct peer *peer, afi_t afi,
/* Handler of conditional advertisement timer event.
* Each route in the condition-map is evaluated.
*/
static void bgp_conditional_adv_timer(struct thread *t)
static void bgp_conditional_adv_timer(struct event *t)
{
afi_t afi;
safi_t safi;
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_damp.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int bgp_damp_decay(time_t tdiff, int penalty, struct bgp_damp_config *bdc)

/* Handler of reuse timer event. Each route in the current reuse-list
is evaluated. RFC2439 Section 4.8.7. */
static void bgp_reuse_timer(struct thread *t)
static void bgp_reuse_timer(struct event *t)
{
struct bgp_damp_info *bdi;
struct bgp_damp_info *next;
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_damp.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct bgp_damp_config {
struct bgp_damp_info *no_reuse_list;

/* Reuse timer thread per-set base. */
struct thread *t_reuse;
struct event *t_reuse;

afi_t afi;
safi_t safi;
Expand Down
Loading

0 comments on commit e668514

Please sign in to comment.