Skip to content

Commit

Permalink
*: Change thread->func to return void instead of int
Browse files Browse the repository at this point in the history
The int return value is never used.  Modify the code
base to just return a void instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
  • Loading branch information
donaldsharp committed Feb 24, 2022
1 parent eaba619 commit cc9f21d
Show file tree
Hide file tree
Showing 207 changed files with 1,109 additions and 1,834 deletions.
22 changes: 8 additions & 14 deletions babeld/babeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ THE SOFTWARE.
DEFINE_MGROUP(BABELD, "babeld");
DEFINE_MTYPE_STATIC(BABELD, BABEL, "Babel Structure");

static int babel_init_routing_process(struct thread *thread);
static void babel_init_routing_process(struct thread *thread);
static void babel_get_myid(void);
static void babel_initial_noise(void);
static int babel_read_protocol (struct thread *thread);
static int babel_main_loop(struct thread *thread);
static void babel_read_protocol(struct thread *thread);
static void babel_main_loop(struct thread *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 @@ -175,8 +175,7 @@ babel_create_routing_process (void)
}

/* thread reading entries form others babel daemons */
static int
babel_read_protocol (struct thread *thread)
static void babel_read_protocol(struct thread *thread)
{
int rc;
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
Expand Down Expand Up @@ -207,22 +206,19 @@ babel_read_protocol (struct thread *thread)

/* re-add thread */
thread_add_read(master, &babel_read_protocol, NULL, protocol_socket, &babel_routing_process->t_read);
return 0;
}

/* 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 int
babel_init_routing_process(struct thread *thread)
static void babel_init_routing_process(struct thread *thread)
{
myseqno = (frr_weak_random() & 0xFFFF);
babel_get_myid();
babel_load_state_file();
debugf(BABEL_DEBUG_COMMON, "My ID is : %s.", format_eui64(myid));
babel_initial_noise();
babel_main_loop(thread);/* this function self-add to the t_update thread */
return 0;
}

/* fill "myid" with an unique id (only if myid != {0}). */
Expand Down Expand Up @@ -327,8 +323,7 @@ babel_clean_routing_process(void)
}

/* Function used with timeout. */
static int
babel_main_loop(struct thread *thread)
static void babel_main_loop(struct thread *thread)
{
struct timeval tv;
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
Expand All @@ -348,8 +343,8 @@ babel_main_loop(struct thread *thread)
/* it happens often to have less than 1 ms, it's bad. */
timeval_add_msec(&tv, &tv, 300);
babel_set_timer(&tv);
return 0;
}
return;
}

gettime(&babel_now);

Expand Down Expand Up @@ -410,7 +405,6 @@ babel_main_loop(struct thread *thread)
}

assert(0); /* this line should never be reach */
return 0;
}

static void
Expand Down
16 changes: 4 additions & 12 deletions bfdd/bfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,27 +609,23 @@ struct bfd_session *ptm_bfd_sess_find(struct bfd_pkt *cp,
return bfd_key_lookup(key);
}

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

ptm_bfd_xmt_TO(bs, 0);

return 0;
}

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

if (bs->echo_xmt_TO > 0)
ptm_bfd_echo_xmt_TO(bs);

return 0;
}

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

Expand All @@ -639,12 +635,10 @@ int bfd_recvtimer_cb(struct thread *t)
ptm_bfd_sess_dn(bs, BD_CONTROL_EXPIRED);
break;
}

return 0;
}

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

Expand All @@ -654,8 +648,6 @@ int bfd_echo_recvtimer_cb(struct thread *t)
ptm_bfd_sess_dn(bs, BD_ECHO_FAILED);
break;
}

return 0;
}

struct bfd_session *bfd_session_new(void)
Expand Down
12 changes: 6 additions & 6 deletions bfdd/bfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,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);
int control_accept(struct thread *t);
void control_accept(struct thread *t);


/*
Expand Down Expand Up @@ -556,7 +556,7 @@ int bp_echov6_socket(const struct vrf *vrf);
void ptm_bfd_snd(struct bfd_session *bfd, int fbit);
void ptm_bfd_echo_snd(struct bfd_session *bfd);

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


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

int bfd_recvtimer_cb(struct thread *t);
int bfd_echo_recvtimer_cb(struct thread *t);
int bfd_xmt_cb(struct thread *t);
int bfd_echo_xmt_cb(struct thread *t);
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);

extern struct in6_addr zero_addr;

Expand Down
22 changes: 10 additions & 12 deletions bfdd/bfd_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ static void cp_debug(bool mhop, struct sockaddr_any *peer,
mhop ? "yes" : "no", peerstr, localstr, portstr, vrfstr);
}

int bfd_recv_cb(struct thread *t)
void bfd_recv_cb(struct thread *t)
{
int sd = THREAD_FD(t);
struct bfd_session *bfd;
Expand All @@ -552,7 +552,7 @@ int bfd_recv_cb(struct thread *t)
/* Handle echo packets. */
if (sd == bvrf->bg_echo || sd == bvrf->bg_echov6) {
ptm_bfd_process_echo_pkt(bvrf, sd);
return 0;
return;
}

/* Sanitize input/output. */
Expand Down Expand Up @@ -590,14 +590,14 @@ int bfd_recv_cb(struct thread *t)
if (mlen < BFD_PKT_LEN) {
cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
"too small (%ld bytes)", mlen);
return 0;
return;
}

/* Validate single hop packet TTL. */
if ((!is_mhop) && (ttl != BFD_TTL_VAL)) {
cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
"invalid TTL: %d expected %d", ttl, BFD_TTL_VAL);
return 0;
return;
}

/*
Expand All @@ -611,32 +611,32 @@ int bfd_recv_cb(struct thread *t)
if (BFD_GETVER(cp->diag) != BFD_VERSION) {
cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
"bad version %d", BFD_GETVER(cp->diag));
return 0;
return;
}

if (cp->detect_mult == 0) {
cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
"detect multiplier set to zero");
return 0;
return;
}

if ((cp->len < BFD_PKT_LEN) || (cp->len > mlen)) {
cp_debug(is_mhop, &peer, &local, ifindex, vrfid, "too small");
return 0;
return;
}

if (cp->discrs.my_discr == 0) {
cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
"'my discriminator' is zero");
return 0;
return;
}

/* Find the session that this packet belongs. */
bfd = ptm_bfd_sess_find(cp, &peer, &local, ifp, vrfid, is_mhop);
if (bfd == NULL) {
cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
"no session found");
return 0;
return;
}

/*
Expand All @@ -648,7 +648,7 @@ int bfd_recv_cb(struct thread *t)
cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
"exceeded max hop count (expected %d, got %d)",
bfd->mh_ttl, ttl);
return 0;
return;
}
} else if (bfd->local_address.sa_sin.sin_family == AF_UNSPEC) {
bfd->local_address = local;
Expand Down Expand Up @@ -733,8 +733,6 @@ int bfd_recv_cb(struct thread *t)
/* Send the control packet with the final bit immediately. */
ptm_bfd_snd(bfd, 1);
}

return 0;
}

/*
Expand Down
Loading

0 comments on commit cc9f21d

Please sign in to comment.