Replace rw_init/rw_destroy with corresponding macros.

Obtained from:	Yandex LLC
This commit is contained in:
ae 2016-10-06 14:42:06 +00:00
parent b93ca512d5
commit 1037184c10
2 changed files with 4 additions and 2 deletions

View File

@ -352,7 +352,7 @@ rt_table_init(int offset)
rh->head.rnh_masks = &rh->rmhead;
/* Init locks */
rw_init(&rh->rib_lock, "rib head lock");
RIB_LOCK_INIT(rh);
/* Finally, set base callbacks */
rh->rnh_addaddr = rn_addroute;
@ -384,7 +384,7 @@ rt_table_destroy(struct rib_head *rh)
rn_walktree(&rh->rmhead.head, rt_freeentry, &rh->rmhead.head);
/* Assume table is already empty */
rw_destroy(&rh->rib_lock);
RIB_LOCK_DESTROY(rh);
free(rh, M_RTABLE);
}

View File

@ -48,6 +48,8 @@ struct rib_head {
struct radix_mask_head rmhead; /* masks radix head */
};
#define RIB_LOCK_INIT(rh) rw_init(&(rh)->rib_lock, "rib head lock")
#define RIB_LOCK_DESTROY(rh) rw_destroy(&(rh)->rib_lock)
#define RIB_RLOCK(rh) rw_rlock(&(rh)->rib_lock)
#define RIB_RUNLOCK(rh) rw_runlock(&(rh)->rib_lock)
#define RIB_WLOCK(rh) rw_wlock(&(rh)->rib_lock)