diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2022-12-05 11:43:57 -0500 |
|---|---|---|
| committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2023-03-20 08:33:36 +0000 |
| commit | 73850c562f7644cc3df339607f0a592940c64d2c (patch) | |
| tree | f917787711c0d7b1c513d55ff08a858424d4a904 | |
| parent | d6cbd7f85c580ea914e76eb3e6170984178bbf88 (diff) | |
ospfd: Remove MTYPE_TMP
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 29a1a53d6c3023841b8289f9ff7b15219ec0b05c)
| -rw-r--r-- | ospfd/ospf_apiserver.c | 31 | ||||
| -rw-r--r-- | ospfd/ospf_apiserver.h | 4 | ||||
| -rw-r--r-- | ospfd/ospf_snmp.c | 6 |
3 files changed, 21 insertions, 20 deletions
diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c index a5fb42b851..6415fda1fc 100644 --- a/ospfd/ospf_apiserver.c +++ b/ospfd/ospf_apiserver.c @@ -56,10 +56,14 @@ #include "ospfd/ospf_ase.h" #include "ospfd/ospf_zebra.h" #include "ospfd/ospf_errors.h" +#include "ospfd/ospf_memory.h" #include "ospfd/ospf_api.h" #include "ospfd/ospf_apiserver.h" +DEFINE_MTYPE_STATIC(OSPFD, APISERVER, "API Server"); +DEFINE_MTYPE_STATIC(OSPFD, APISERVER_MSGFILTER, "API Server Message Filter"); + /* This is an implementation of an API to the OSPF daemon that allows * external applications to access the OSPF daemon through socket * connections. The application can use this API to inject its own @@ -250,9 +254,9 @@ static int ospf_apiserver_del_lsa_hook(struct ospf_lsa *lsa) struct ospf_apiserver *ospf_apiserver_new(int fd_sync, int fd_async) { struct ospf_apiserver *new = - XMALLOC(MTYPE_OSPF_APISERVER, sizeof(struct ospf_apiserver)); + XMALLOC(MTYPE_APISERVER, sizeof(struct ospf_apiserver)); - new->filter = XMALLOC(MTYPE_OSPF_APISERVER_MSGFILTER, + new->filter = XMALLOC(MTYPE_APISERVER_MSGFILTER, sizeof(struct lsa_filter_type)); new->fd_sync = fd_sync; @@ -368,7 +372,7 @@ void ospf_apiserver_free(struct ospf_apiserver *apiserv) (void *)apiserv, apiserver_list->count); /* And free instance. */ - XFREE(MTYPE_OSPF_APISERVER, apiserv); + XFREE(MTYPE_APISERVER, apiserv); } void ospf_apiserver_read(struct thread *thread) @@ -870,8 +874,8 @@ int ospf_apiserver_register_opaque_type(struct ospf_apiserver *apiserv, connection shuts down, we can flush all LSAs of this opaque type. */ - regtype = XCALLOC(MTYPE_OSPF_APISERVER, - sizeof(struct registered_opaque_type)); + regtype = + XCALLOC(MTYPE_APISERVER, sizeof(struct registered_opaque_type)); regtype->lsa_type = lsa_type; regtype->opaque_type = opaque_type; @@ -1164,12 +1168,12 @@ int ospf_apiserver_handle_register_event(struct ospf_apiserver *apiserv, seqnum = msg_get_seq(msg); /* Free existing filter in apiserv. */ - XFREE(MTYPE_OSPF_APISERVER_MSGFILTER, apiserv->filter); + XFREE(MTYPE_APISERVER_MSGFILTER, apiserv->filter); /* Alloc new space for filter. */ size = ntohs(msg->hdr.msglen); if (size < OSPF_MAX_LSA_SIZE) { - apiserv->filter = XMALLOC(MTYPE_OSPF_APISERVER_MSGFILTER, size); + apiserv->filter = XMALLOC(MTYPE_APISERVER_MSGFILTER, size); /* copy it over. */ memcpy(apiserv->filter, &rmsg->filter, size); @@ -1374,8 +1378,7 @@ int ospf_apiserver_handle_sync_reachable(struct ospf_apiserver *apiserv, goto out; /* send all adds based on current reachable routers */ - a = abuf = XCALLOC(MTYPE_OSPF_APISERVER, - sizeof(struct in_addr) * rt->count); + a = abuf = XCALLOC(MTYPE_APISERVER, sizeof(struct in_addr) * rt->count); for (struct route_node *rn = route_top(rt); rn; rn = route_next(rn)) if (listhead((struct list *)rn->info)) *a++ = rn->p.u.prefix4; @@ -1394,7 +1397,7 @@ int ospf_apiserver_handle_sync_reachable(struct ospf_apiserver *apiserv, rc = ospf_apiserver_send_msg(apiserv, amsg); msg_free(amsg); } - XFREE(MTYPE_OSPF_APISERVER, abuf); + XFREE(MTYPE_APISERVER, abuf); out: /* Send a reply back to client with return code */ @@ -2628,9 +2631,9 @@ void ospf_apiserver_notify_reachable(struct route_table *ort, return; } if (nrt && nrt->count) - a = abuf = XCALLOC(MTYPE_OSPF_APISERVER, insz * nrt->count); + a = abuf = XCALLOC(MTYPE_APISERVER, insz * nrt->count); if (ort && ort->count) - d = dbuf = XCALLOC(MTYPE_OSPF_APISERVER, insz * ort->count); + d = dbuf = XCALLOC(MTYPE_APISERVER, insz * ort->count); /* walk both tables */ orn = ort ? route_top(ort) : NULL; @@ -2695,9 +2698,9 @@ void ospf_apiserver_notify_reachable(struct route_table *ort, msg_free(msg); } if (abuf) - XFREE(MTYPE_OSPF_APISERVER, abuf); + XFREE(MTYPE_APISERVER, abuf); if (dbuf) - XFREE(MTYPE_OSPF_APISERVER, dbuf); + XFREE(MTYPE_APISERVER, dbuf); } diff --git a/ospfd/ospf_apiserver.h b/ospfd/ospf_apiserver.h index e28202e46f..0a6b7319a0 100644 --- a/ospfd/ospf_apiserver.h +++ b/ospfd/ospf_apiserver.h @@ -26,10 +26,6 @@ #include "ospf_api.h" #include "ospf_lsdb.h" -/* MTYPE definition is not reflected to "memory.h". */ -#define MTYPE_OSPF_APISERVER MTYPE_TMP -#define MTYPE_OSPF_APISERVER_MSGFILTER MTYPE_TMP - /* List of opaque types that application registered */ struct registered_opaque_type { uint8_t lsa_type; diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c index 9727c7039c..f1b876cfbe 100644 --- a/ospfd/ospf_snmp.c +++ b/ospfd/ospf_snmp.c @@ -50,6 +50,8 @@ #include "ospfd/ospf_route.h" #include "ospfd/ospf_zebra.h" +DEFINE_MTYPE_STATIC(OSPFD, SNMP, "OSPF SNMP"); + /* OSPF2-MIB. */ #define OSPF2MIB 1,3,6,1,2,1,14 @@ -1321,12 +1323,12 @@ struct ospf_snmp_if { static struct ospf_snmp_if *ospf_snmp_if_new(void) { - return XCALLOC(MTYPE_TMP, sizeof(struct ospf_snmp_if)); + return XCALLOC(MTYPE_SNMP, sizeof(struct ospf_snmp_if)); } static void ospf_snmp_if_free(struct ospf_snmp_if *osif) { - XFREE(MTYPE_TMP, osif); + XFREE(MTYPE_SNMP, osif); } static int ospf_snmp_if_delete(struct interface *ifp) |
