lib, vrrpd: Use THREAD_ARG

Don't auto set the thread->arg pointer.  It is private
and should be only accessed through the THREAD_ARG pointer.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2022-06-03 11:38:15 -04:00
parent c3aaa89a44
commit b8551584ee
3 changed files with 6 additions and 6 deletions

View File

@ -146,9 +146,9 @@ static void agentx_events_update(void)
else if (FD_ISSET(fd, &fds)) {
struct listnode *newln;
thr = XCALLOC(MTYPE_TMP, sizeof(struct thread *));
thread_add_read(agentx_tm, agentx_read, NULL, fd, thr);
newln = listnode_add_before(events, ln, thr);
(*thr)->arg = newln;
thread_add_read(agentx_tm, agentx_read, newln, fd, thr);
}
}

View File

@ -198,7 +198,7 @@ class RpcStateBase
static void c_callback(struct thread *thread)
{
auto _tag = static_cast<RpcStateBase *>(thread->arg);
auto _tag = static_cast<RpcStateBase *>(THREAD_ARG(thread));
/*
* We hold the lock until the callback finishes and has updated
* _tag->state, then we signal done and release.

View File

@ -985,7 +985,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src,
*/
static void vrrp_read(struct thread *thread)
{
struct vrrp_router *r = thread->arg;
struct vrrp_router *r = THREAD_ARG(thread);
struct vrrp_pkt *pkt;
ssize_t pktsize;
@ -1480,7 +1480,7 @@ static void vrrp_change_state(struct vrrp_router *r, int to)
*/
static void vrrp_adver_timer_expire(struct thread *thread)
{
struct vrrp_router *r = thread->arg;
struct vrrp_router *r = THREAD_ARG(thread);
DEBUGD(&vrrp_dbg_proto,
VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
@ -1508,7 +1508,7 @@ static void vrrp_adver_timer_expire(struct thread *thread)
*/
static void vrrp_master_down_timer_expire(struct thread *thread)
{
struct vrrp_router *r = thread->arg;
struct vrrp_router *r = THREAD_ARG(thread);
zlog_info(VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
"Master_Down_Timer expired",