]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Make bgp_keepalives.c not use MTYPE_TMP 12445/head
authorDonald Sharp <sharpd@nvidia.com>
Mon, 5 Dec 2022 17:17:00 +0000 (12:17 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Mon, 5 Dec 2022 17:17:00 +0000 (12:17 -0500)
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_keepalives.c

index b39a7daa1dc6596784ca26dfc1e379f89c545080..0e83157ecdd5f8fa193f7718e1a8327c5df74a85 100644 (file)
 #include "bgpd/bgp_keepalives.h"
 /* clang-format on */
 
+DEFINE_MTYPE_STATIC(BGPD, BGP_PKAT, "Peer KeepAlive Timer");
+DEFINE_MTYPE_STATIC(BGPD, BGP_COND, "BGP Peer pthread Conditional");
+DEFINE_MTYPE_STATIC(BGPD, BGP_MUTEX, "BGP Peer pthread Mutex");
+
 /*
  * Peer KeepAlive Timer.
  * Associates a peer with the time of its last keepalive.
@@ -54,7 +58,7 @@ static struct hash *peerhash;
 
 static struct pkat *pkat_new(struct peer *peer)
 {
-       struct pkat *pkat = XMALLOC(MTYPE_TMP, sizeof(struct pkat));
+       struct pkat *pkat = XMALLOC(MTYPE_BGP_PKAT, sizeof(struct pkat));
        pkat->peer = peer;
        monotime(&pkat->last);
        return pkat;
@@ -62,7 +66,7 @@ static struct pkat *pkat_new(struct peer *peer)
 
 static void pkat_del(void *pkat)
 {
-       XFREE(MTYPE_TMP, pkat);
+       XFREE(MTYPE_BGP_PKAT, pkat);
 }
 
 
@@ -158,8 +162,8 @@ static void bgp_keepalives_finish(void *arg)
        pthread_mutex_destroy(peerhash_mtx);
        pthread_cond_destroy(peerhash_cond);
 
-       XFREE(MTYPE_TMP, peerhash_mtx);
-       XFREE(MTYPE_TMP, peerhash_cond);
+       XFREE(MTYPE_BGP_MUTEX, peerhash_mtx);
+       XFREE(MTYPE_BGP_COND, peerhash_cond);
 }
 
 /*
@@ -184,8 +188,8 @@ void *bgp_keepalives_start(void *arg)
         */
        rcu_read_unlock();
 
-       peerhash_mtx = XCALLOC(MTYPE_TMP, sizeof(pthread_mutex_t));
-       peerhash_cond = XCALLOC(MTYPE_TMP, sizeof(pthread_cond_t));
+       peerhash_mtx = XCALLOC(MTYPE_BGP_MUTEX, sizeof(pthread_mutex_t));
+       peerhash_cond = XCALLOC(MTYPE_BGP_COND, sizeof(pthread_cond_t));
 
        /* initialize mutex */
        pthread_mutex_init(peerhash_mtx, NULL);