From c7479286aef294af8fb13c7690e4ff93fc8f8a1e Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Mon, 22 Mar 2021 18:53:23 +0100 Subject: [PATCH] pathd: kill *_memory.[ch] Ouch, MTYPE_PCEP is used in 81 places :( Signed-off-by: David Lamparter --- pathd/path_cli.c | 2 +- pathd/path_memory.c | 25 ------------------------- pathd/path_memory.h | 26 -------------------------- pathd/path_pcep.c | 3 ++- pathd/path_pcep.h | 4 +++- pathd/path_pcep_cli.c | 1 - pathd/path_pcep_lib.c | 7 +++++-- pathd/path_pcep_memory.c | 27 --------------------------- pathd/path_pcep_memory.h | 28 ---------------------------- pathd/path_pcep_pcc.c | 1 - pathd/pathd.c | 3 ++- pathd/pathd.h | 3 +++ pathd/subdir.am | 4 ---- 13 files changed, 16 insertions(+), 118 deletions(-) delete mode 100644 pathd/path_memory.c delete mode 100644 pathd/path_memory.h delete mode 100644 pathd/path_pcep_memory.c delete mode 100644 pathd/path_pcep_memory.h diff --git a/pathd/path_cli.c b/pathd/path_cli.c index a46ec5fac4..cf14aa8c61 100644 --- a/pathd/path_cli.c +++ b/pathd/path_cli.c @@ -20,6 +20,7 @@ #include #include +#include "memory.h" #include "log.h" #include "command.h" #include "mpls.h" @@ -28,7 +29,6 @@ #include "pathd/pathd.h" #include "pathd/path_nb.h" -#include "pathd/path_memory.h" #ifndef VTYSH_EXTRACT_PL #include "pathd/path_cli_clippy.c" #endif diff --git a/pathd/path_memory.c b/pathd/path_memory.c deleted file mode 100644 index 7a78c09cf9..0000000000 --- a/pathd/path_memory.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2020 NetDEF, Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; see the file COPYING; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include - -#include "pathd/path_memory.h" - -DEFINE_MGROUP(PATHD, "pathd"); diff --git a/pathd/path_memory.h b/pathd/path_memory.h deleted file mode 100644 index a0896cdad8..0000000000 --- a/pathd/path_memory.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2020 NetDEF, Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; see the file COPYING; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef _FRR_PATH_MEMORY_H_ -#define _FRR_PATH_MEMORY_H_ - -#include "memory.h" - -DECLARE_MGROUP(PATHD); - -#endif /* _FRR_PATH_MEMORY_H_ */ diff --git a/pathd/path_pcep.c b/pathd/path_pcep.c index 5dcba965a2..d6cd48ecdb 100644 --- a/pathd/path_pcep.c +++ b/pathd/path_pcep.c @@ -19,6 +19,7 @@ #include #include "pceplib/pcep_utils_counters.h" +#include "memory.h" #include "log.h" #include "command.h" #include "libfrr.h" @@ -31,13 +32,13 @@ #include "pathd/pathd.h" #include "pathd/path_errors.h" -#include "pathd/path_pcep_memory.h" #include "pathd/path_pcep.h" #include "pathd/path_pcep_cli.h" #include "pathd/path_pcep_controller.h" #include "pathd/path_pcep_lib.h" #include "pathd/path_pcep_config.h" +DEFINE_MTYPE(PATHD, PCEP, "PCEP module"); /* * Globals. diff --git a/pathd/path_pcep.h b/pathd/path_pcep.h index b131b31445..654d089cbc 100644 --- a/pathd/path_pcep.h +++ b/pathd/path_pcep.h @@ -22,11 +22,13 @@ #include #include #include +#include "memory.h" #include "pceplib/pcep_utils_logging.h" #include "pceplib/pcep_pcc_api.h" #include "mpls.h" #include "pathd/pathd.h" -#include "pathd/path_pcep_memory.h" + +DECLARE_MTYPE(PCEP); #define PCEP_DEFAULT_PORT 4189 #define MAX_PCC 32 diff --git a/pathd/path_pcep_cli.c b/pathd/path_pcep_cli.c index 7bbed9464d..355790be8f 100644 --- a/pathd/path_pcep_cli.c +++ b/pathd/path_pcep_cli.c @@ -33,7 +33,6 @@ #include "pathd/pathd.h" #include "pathd/path_errors.h" -#include "pathd/path_pcep_memory.h" #include "pathd/path_pcep.h" #include "pathd/path_pcep_cli.h" #include "pathd/path_pcep_controller.h" diff --git a/pathd/path_pcep_lib.c b/pathd/path_pcep_lib.c index 1d2f25889e..e9d699de47 100644 --- a/pathd/path_pcep_lib.c +++ b/pathd/path_pcep_lib.c @@ -18,15 +18,18 @@ #include +#include "memory.h" + #include #include "pceplib/pcep_utils_counters.h" #include "pceplib/pcep_timers.h" #include "pathd/path_errors.h" -#include "pathd/path_memory.h" #include "pathd/path_pcep.h" #include "pathd/path_pcep_lib.h" #include "pathd/path_pcep_debug.h" -#include "pathd/path_pcep_memory.h" + +DEFINE_MTYPE_STATIC(PATHD, PCEPLIB_INFRA, "PCEPlib Infrastructure"); +DEFINE_MTYPE_STATIC(PATHD, PCEPLIB_MESSAGES, "PCEPlib PCEP Messages"); #define CLASS_TYPE(CLASS, TYPE) (((CLASS) << 16) | (TYPE)) #define DEFAULT_LSAP_SETUP_PRIO 4 diff --git a/pathd/path_pcep_memory.c b/pathd/path_pcep_memory.c deleted file mode 100644 index 5cb5fb33ec..0000000000 --- a/pathd/path_pcep_memory.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2020 NetDEF, Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; see the file COPYING; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include - -#include "pathd/path_pcep_memory.h" - -DEFINE_MTYPE(PATHD, PCEP, "PCEP module"); -DEFINE_MTYPE(PATHD, PCEPLIB_INFRA, "PCEPlib Infrastructure"); -DEFINE_MTYPE(PATHD, PCEPLIB_MESSAGES, "PCEPlib PCEP Messages"); diff --git a/pathd/path_pcep_memory.h b/pathd/path_pcep_memory.h deleted file mode 100644 index a44d178b2b..0000000000 --- a/pathd/path_pcep_memory.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2020 NetDEF, Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; see the file COPYING; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef _FRR_PATH_PCEP_MEMORY_H_ -#define _FRR_PATH_PCEP_MEMORY_H_ - -#include "pathd/path_memory.h" - -DECLARE_MTYPE(PCEP); -DECLARE_MTYPE(PCEPLIB_INFRA); -DECLARE_MTYPE(PCEPLIB_MESSAGES); - -#endif /* _FRR_PATH_PCEP_MEMORY_H_ */ diff --git a/pathd/path_pcep_pcc.c b/pathd/path_pcep_pcc.c index 986aa3c456..a2c1e7cd4c 100644 --- a/pathd/path_pcep_pcc.c +++ b/pathd/path_pcep_pcc.c @@ -41,7 +41,6 @@ #include "pathd/pathd.h" #include "pathd/path_zebra.h" #include "pathd/path_errors.h" -#include "pathd/path_pcep_memory.h" #include "pathd/path_pcep.h" #include "pathd/path_pcep_controller.h" #include "pathd/path_pcep_lib.h" diff --git a/pathd/pathd.c b/pathd/pathd.c index 4893da880a..ae82186315 100644 --- a/pathd/pathd.c +++ b/pathd/pathd.c @@ -24,12 +24,13 @@ #include "network.h" #include "pathd/pathd.h" -#include "pathd/path_memory.h" #include "pathd/path_zebra.h" #include "pathd/path_debug.h" #define HOOK_DELAY 3 +DEFINE_MGROUP(PATHD, "pathd"); + DEFINE_MTYPE_STATIC(PATHD, PATH_SEGMENT_LIST, "Segment List"); DEFINE_MTYPE_STATIC(PATHD, PATH_SR_POLICY, "SR Policy"); DEFINE_MTYPE_STATIC(PATHD, PATH_SR_CANDIDATE, "SR Policy candidate path"); diff --git a/pathd/pathd.h b/pathd/pathd.h index e3d26a0ac5..9c4d256cef 100644 --- a/pathd/pathd.h +++ b/pathd/pathd.h @@ -19,11 +19,14 @@ #ifndef _FRR_PATHD_H_ #define _FRR_PATHD_H_ +#include "lib/memory.h" #include "lib/mpls.h" #include "lib/ipaddr.h" #include "lib/srte.h" #include "lib/hook.h" +DECLARE_MGROUP(PATHD); + enum srte_protocol_origin { SRTE_ORIGIN_UNDEFINED = 0, SRTE_ORIGIN_PCEP = 1, diff --git a/pathd/subdir.am b/pathd/subdir.am index 452d824669..b4501214bf 100644 --- a/pathd/subdir.am +++ b/pathd/subdir.am @@ -23,7 +23,6 @@ pathd_libpath_a_SOURCES = \ pathd/path_debug.c \ pathd/path_errors.c \ pathd/path_main.c \ - pathd/path_memory.c \ pathd/path_nb.c \ pathd/path_nb_config.c \ pathd/path_nb_state.c \ @@ -39,14 +38,12 @@ clippy_scan += \ noinst_HEADERS += \ pathd/path_debug.h \ pathd/path_errors.h \ - pathd/path_memory.h \ pathd/path_nb.h \ pathd/path_pcep.h \ pathd/path_pcep_cli.h \ pathd/path_pcep_controller.h \ pathd/path_pcep_debug.h \ pathd/path_pcep_lib.h \ - pathd/path_pcep_memory.h \ pathd/path_pcep_config.h \ pathd/path_pcep_pcc.h \ pathd/path_zebra.h \ @@ -65,7 +62,6 @@ pathd_pathd_pcep_la_SOURCES = \ pathd/path_pcep_controller.c \ pathd/path_pcep_debug.c \ pathd/path_pcep_lib.c \ - pathd/path_pcep_memory.c \ pathd/path_pcep_config.c \ pathd/path_pcep_pcc.c \ # end -- 2.39.5