]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: rename memory_vty.c to lib_vty.c
authorDavid Lamparter <equinox@diac24.net>
Fri, 6 Dec 2019 13:38:55 +0000 (14:38 +0100)
committerDavid Lamparter <equinox@diac24.net>
Fri, 6 Dec 2019 14:13:29 +0000 (15:13 +0100)
And memory_init() to lib_cmd_init().

Signed-off-by: David Lamparter <equinox@diac24.net>
27 files changed:
bgpd/bgp_main.c
bgpd/bgp_vty.c
isisd/isis_main.c
lib/grammar_sandbox.c
lib/grammar_sandbox_main.c
lib/lib_vty.c [new file with mode: 0644]
lib/lib_vty.h [new file with mode: 0644]
lib/libfrr.c
lib/memory_vty.c [deleted file]
lib/memory_vty.h [deleted file]
lib/subdir.am
nhrpd/nhrp_main.c
ospf6d/ospf6_main.c
ospfd/ospf_main.c
pimd/pim_main.c
ripd/rip_main.c
ripngd/ripng_main.c
tests/helpers/c/main.c
tests/lib/cli/common_cli.c
tests/lib/cxxcompat.c
tests/lib/northbound/test_oper_data.c
tests/lib/test_buffer.c
tests/lib/test_privs.c
vtysh/extract.pl.in
vtysh/vtysh_main.c
watchfrr/watchfrr.c
zebra/main.c

index 08c5d3468d422ed64935fa29431f7e950e6a15e9..9cb3957a86c2ff24195554f02121941509afef7d 100644 (file)
@@ -27,7 +27,6 @@
 #include "thread.h"
 #include <lib/version.h>
 #include "memory.h"
-#include "memory_vty.h"
 #include "prefix.h"
 #include "log.h"
 #include "privs.h"
index fa236a24b74cbac45537f8de53f4c23fe759c169..553131b7473ec65af759b0bb373a30e33fe99619 100644 (file)
@@ -32,7 +32,7 @@
 #include "thread.h"
 #include "log.h"
 #include "memory.h"
-#include "memory_vty.h"
+#include "lib_vty.h"
 #include "hash.h"
 #include "queue.h"
 #include "filter.h"
index 7e79fdea1535c7146e5dfd16601f1d04b7747117..364441f79d92f7de34f434b7c8b5f98a1bce6c25 100644 (file)
@@ -29,7 +29,6 @@
 #include "command.h"
 #include "vty.h"
 #include "memory.h"
-#include "memory_vty.h"
 #include "stream.h"
 #include "if.h"
 #include "privs.h"
index c6fd3c04adece80ad9f8930e56f15a5e62935a12..a23874a517490d23dab956a153badc3aac7eb009 100644 (file)
@@ -28,7 +28,6 @@
 #endif
 
 #include "command.h"
-#include "memory_vty.h"
 #include "graph.h"
 #include "linklist.h"
 #include "command_match.h"
index 6d28a667b387b968b3038050ebed247fc5c48afa..4bd8f5138aad0cb3dcf1e1401fac322076917410 100644 (file)
@@ -28,7 +28,7 @@
 #endif
 
 #include "command.h"
-#include "memory_vty.h"
+#include "lib_vty.h"
 
 static void vty_do_exit(int isexit)
 {
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
        host.domainname = strdup("testdomainname");
 
        vty_init(master, true);
-       memory_init();
+       lib_cmd_init();
        yang_init();
        nb_init(master, NULL, 0);
 
diff --git a/lib/lib_vty.c b/lib/lib_vty.c
new file mode 100644 (file)
index 0000000..932b465
--- /dev/null
@@ -0,0 +1,229 @@
+/*
+ * Assorted library VTY commands
+ *
+ * Copyright (C) 1998 Kunihiro Ishiguro
+ * Copyright (C) 2016-2017  David Lamparter for 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 <zebra.h>
+/* malloc.h is generally obsolete, however GNU Libc mallinfo wants it. */
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#ifdef HAVE_MALLOC_MALLOC_H
+#include <malloc/malloc.h>
+#endif
+#include <dlfcn.h>
+#ifdef HAVE_LINK_H
+#include <link.h>
+#endif
+
+#include "log.h"
+#include "memory.h"
+#include "module.h"
+#include "lib_vty.h"
+
+/* Looking up memory status from vty interface. */
+#include "vector.h"
+#include "vty.h"
+#include "command.h"
+
+#ifdef HAVE_MALLINFO
+static int show_memory_mallinfo(struct vty *vty)
+{
+       struct mallinfo minfo = mallinfo();
+       char buf[MTYPE_MEMSTR_LEN];
+
+       vty_out(vty, "System allocator statistics:\n");
+       vty_out(vty, "  Total heap allocated:  %s\n",
+               mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.arena));
+       vty_out(vty, "  Holding block headers: %s\n",
+               mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.hblkhd));
+       vty_out(vty, "  Used small blocks:     %s\n",
+               mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.usmblks));
+       vty_out(vty, "  Used ordinary blocks:  %s\n",
+               mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.uordblks));
+       vty_out(vty, "  Free small blocks:     %s\n",
+               mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.fsmblks));
+       vty_out(vty, "  Free ordinary blocks:  %s\n",
+               mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.fordblks));
+       vty_out(vty, "  Ordinary blocks:       %ld\n",
+               (unsigned long)minfo.ordblks);
+       vty_out(vty, "  Small blocks:          %ld\n",
+               (unsigned long)minfo.smblks);
+       vty_out(vty, "  Holding blocks:        %ld\n",
+               (unsigned long)minfo.hblks);
+       vty_out(vty, "(see system documentation for 'mallinfo' for meaning)\n");
+       return 1;
+}
+#endif /* HAVE_MALLINFO */
+
+static int qmem_walker(void *arg, struct memgroup *mg, struct memtype *mt)
+{
+       struct vty *vty = arg;
+       if (!mt) {
+               vty_out(vty, "--- qmem %s ---\n", mg->name);
+               vty_out(vty, "%-30s: %8s %-8s%s %8s %9s\n",
+                       "Type", "Current#", "  Size",
+#ifdef HAVE_MALLOC_USABLE_SIZE
+                       "     Total",
+#else
+                       "",
+#endif
+                       "Max#",
+#ifdef HAVE_MALLOC_USABLE_SIZE
+                       "MaxBytes"
+#else
+                       ""
+#endif
+                       );
+       } else {
+               if (mt->n_alloc != 0) {
+                       char size[32];
+                       snprintf(size, sizeof(size), "%6zu", mt->size);
+#ifdef HAVE_MALLOC_USABLE_SIZE
+#define TSTR " %9zu"
+#define TARG , mt->total
+#define TARG2 , mt->max_size
+#else
+#define TSTR ""
+#define TARG
+#define TARG2
+#endif
+                       vty_out(vty, "%-30s: %8zu %-8s"TSTR" %8zu"TSTR"\n",
+                               mt->name,
+                               mt->n_alloc,
+                               mt->size == 0 ? ""
+                                             : mt->size == SIZE_VAR
+                                                       ? "variable"
+                                                       : size
+                               TARG,
+                               mt->n_max
+                               TARG2);
+               }
+       }
+       return 0;
+}
+
+
+DEFUN_NOSH (show_memory,
+           show_memory_cmd,
+           "show memory",
+           "Show running system information\n"
+           "Memory statistics\n")
+{
+#ifdef HAVE_MALLINFO
+       show_memory_mallinfo(vty);
+#endif /* HAVE_MALLINFO */
+
+       qmem_walk(qmem_walker, vty);
+       return CMD_SUCCESS;
+}
+
+DEFUN_NOSH (show_modules,
+           show_modules_cmd,
+           "show modules",
+           "Show running system information\n"
+           "Loaded modules\n")
+{
+       struct frrmod_runtime *plug = frrmod_list;
+
+       vty_out(vty, "%-12s %-25s %s\n\n", "Module Name", "Version",
+               "Description");
+       while (plug) {
+               const struct frrmod_info *i = plug->info;
+
+               vty_out(vty, "%-12s %-25s %s\n", i->name, i->version,
+                       i->description);
+               if (plug->dl_handle) {
+#ifdef HAVE_DLINFO_ORIGIN
+                       char origin[MAXPATHLEN] = "";
+                       dlinfo(plug->dl_handle, RTLD_DI_ORIGIN, &origin);
+#ifdef HAVE_DLINFO_LINKMAP
+                       const char *name;
+                       struct link_map *lm = NULL;
+                       dlinfo(plug->dl_handle, RTLD_DI_LINKMAP, &lm);
+                       if (lm) {
+                               name = strrchr(lm->l_name, '/');
+                               name = name ? name + 1 : lm->l_name;
+                               vty_out(vty, "\tfrom: %s/%s\n", origin, name);
+                       }
+#else
+                       vty_out(vty, "\tfrom: %s \n", origin, plug->load_name);
+#endif
+#else
+                       vty_out(vty, "\tfrom: %s\n", plug->load_name);
+#endif
+               }
+               plug = plug->next;
+       }
+
+       vty_out(vty, "pid: %u\n", (uint32_t)(getpid()));
+
+       return CMD_SUCCESS;
+}
+
+void lib_cmd_init(void)
+{
+       install_element(VIEW_NODE, &show_memory_cmd);
+       install_element(VIEW_NODE, &show_modules_cmd);
+}
+
+/* Stats querying from users */
+/* Return a pointer to a human friendly string describing
+ * the byte count passed in. E.g:
+ * "0 bytes", "2048 bytes", "110kB", "500MiB", "11GiB", etc.
+ * Up to 4 significant figures will be given.
+ * The pointer returned may be NULL (indicating an error)
+ * or point to the given buffer, or point to static storage.
+ */
+const char *mtype_memstr(char *buf, size_t len, unsigned long bytes)
+{
+       unsigned int m, k;
+
+       /* easy cases */
+       if (!bytes)
+               return "0 bytes";
+       if (bytes == 1)
+               return "1 byte";
+
+       /*
+        * When we pass the 2gb barrier mallinfo() can no longer report
+        * correct data so it just does something odd...
+        * Reporting like Terrabytes of data.  Which makes users...
+        * edgy.. yes edgy that's the term for it.
+        * So let's just give up gracefully
+        */
+       if (bytes > 0x7fffffff)
+               return "> 2GB";
+
+       m = bytes >> 20;
+       k = bytes >> 10;
+
+       if (m > 10) {
+               if (bytes & (1 << 19))
+                       m++;
+               snprintf(buf, len, "%d MiB", m);
+       } else if (k > 10) {
+               if (bytes & (1 << 9))
+                       k++;
+               snprintf(buf, len, "%d KiB", k);
+       } else
+               snprintf(buf, len, "%ld bytes", bytes);
+
+       return buf;
+}
diff --git a/lib/lib_vty.h b/lib/lib_vty.h
new file mode 100644 (file)
index 0000000..48e409e
--- /dev/null
@@ -0,0 +1,40 @@
+/* Memory management routine
+ * Copyright (C) 1998 Kunihiro Ishiguro
+ *
+ * This file is part of GNU Zebra.
+ *
+ * GNU Zebra 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, or (at your option) any
+ * later version.
+ *
+ * GNU Zebra 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 _ZEBRA_LIB_VTY_H
+#define _ZEBRA_LIB_VTY_H
+
+#include "memory.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void lib_cmd_init(void);
+
+/* Human friendly string for given byte count */
+#define MTYPE_MEMSTR_LEN 20
+extern const char *mtype_memstr(char *, size_t, unsigned long);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ZEBRA_LIB_VTY_H */
index 8ef32eaa8a760d277679712d42aaa30e212c86ec..5f292c989c16be7e0a94e5f8bbee30710d87d679 100644 (file)
@@ -30,7 +30,7 @@
 #include "vty.h"
 #include "command.h"
 #include "version.h"
-#include "memory_vty.h"
+#include "lib_vty.h"
 #include "log_vty.h"
 #include "zclient.h"
 #include "log_int.h"
@@ -679,7 +679,7 @@ struct thread_master *frr_init(void)
                cmd_init(1);
 
        vty_init(master, di->log_always);
-       memory_init();
+       lib_cmd_init();
        log_filter_cmd_init();
 
        frr_pthread_init();
@@ -1077,7 +1077,6 @@ void frr_fini(void)
 
        hook_call(frr_fini);
 
-       /* memory_init -> nothing needed */
        vty_terminate();
        cmd_terminate();
        nb_terminate();
diff --git a/lib/memory_vty.c b/lib/memory_vty.c
deleted file mode 100644 (file)
index 1adc0d7..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Memory and dynamic module VTY routine
- *
- * Copyright (C) 1998 Kunihiro Ishiguro
- * Copyright (C) 2016-2017  David Lamparter for 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 <zebra.h>
-/* malloc.h is generally obsolete, however GNU Libc mallinfo wants it. */
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_MALLOC_MALLOC_H
-#include <malloc/malloc.h>
-#endif
-#include <dlfcn.h>
-#ifdef HAVE_LINK_H
-#include <link.h>
-#endif
-
-#include "log.h"
-#include "memory.h"
-#include "module.h"
-#include "memory_vty.h"
-
-/* Looking up memory status from vty interface. */
-#include "vector.h"
-#include "vty.h"
-#include "command.h"
-
-#ifdef HAVE_MALLINFO
-static int show_memory_mallinfo(struct vty *vty)
-{
-       struct mallinfo minfo = mallinfo();
-       char buf[MTYPE_MEMSTR_LEN];
-
-       vty_out(vty, "System allocator statistics:\n");
-       vty_out(vty, "  Total heap allocated:  %s\n",
-               mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.arena));
-       vty_out(vty, "  Holding block headers: %s\n",
-               mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.hblkhd));
-       vty_out(vty, "  Used small blocks:     %s\n",
-               mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.usmblks));
-       vty_out(vty, "  Used ordinary blocks:  %s\n",
-               mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.uordblks));
-       vty_out(vty, "  Free small blocks:     %s\n",
-               mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.fsmblks));
-       vty_out(vty, "  Free ordinary blocks:  %s\n",
-               mtype_memstr(buf, MTYPE_MEMSTR_LEN, minfo.fordblks));
-       vty_out(vty, "  Ordinary blocks:       %ld\n",
-               (unsigned long)minfo.ordblks);
-       vty_out(vty, "  Small blocks:          %ld\n",
-               (unsigned long)minfo.smblks);
-       vty_out(vty, "  Holding blocks:        %ld\n",
-               (unsigned long)minfo.hblks);
-       vty_out(vty, "(see system documentation for 'mallinfo' for meaning)\n");
-       return 1;
-}
-#endif /* HAVE_MALLINFO */
-
-static int qmem_walker(void *arg, struct memgroup *mg, struct memtype *mt)
-{
-       struct vty *vty = arg;
-       if (!mt) {
-               vty_out(vty, "--- qmem %s ---\n", mg->name);
-               vty_out(vty, "%-30s: %8s %-8s%s %8s %9s\n",
-                       "Type", "Current#", "  Size",
-#ifdef HAVE_MALLOC_USABLE_SIZE
-                       "     Total",
-#else
-                       "",
-#endif
-                       "Max#",
-#ifdef HAVE_MALLOC_USABLE_SIZE
-                       "MaxBytes"
-#else
-                       ""
-#endif
-                       );
-       } else {
-               if (mt->n_alloc != 0) {
-                       char size[32];
-                       snprintf(size, sizeof(size), "%6zu", mt->size);
-#ifdef HAVE_MALLOC_USABLE_SIZE
-#define TSTR " %9zu"
-#define TARG , mt->total
-#define TARG2 , mt->max_size
-#else
-#define TSTR ""
-#define TARG
-#define TARG2
-#endif
-                       vty_out(vty, "%-30s: %8zu %-8s"TSTR" %8zu"TSTR"\n",
-                               mt->name,
-                               mt->n_alloc,
-                               mt->size == 0 ? ""
-                                             : mt->size == SIZE_VAR
-                                                       ? "variable"
-                                                       : size
-                               TARG,
-                               mt->n_max
-                               TARG2);
-               }
-       }
-       return 0;
-}
-
-
-DEFUN (show_memory,
-       show_memory_cmd,
-       "show memory",
-       "Show running system information\n"
-       "Memory statistics\n")
-{
-#ifdef HAVE_MALLINFO
-       show_memory_mallinfo(vty);
-#endif /* HAVE_MALLINFO */
-
-       qmem_walk(qmem_walker, vty);
-       return CMD_SUCCESS;
-}
-
-DEFUN (show_modules,
-       show_modules_cmd,
-       "show modules",
-       "Show running system information\n"
-       "Loaded modules\n")
-{
-       struct frrmod_runtime *plug = frrmod_list;
-
-       vty_out(vty, "%-12s %-25s %s\n\n", "Module Name", "Version",
-               "Description");
-       while (plug) {
-               const struct frrmod_info *i = plug->info;
-
-               vty_out(vty, "%-12s %-25s %s\n", i->name, i->version,
-                       i->description);
-               if (plug->dl_handle) {
-#ifdef HAVE_DLINFO_ORIGIN
-                       char origin[MAXPATHLEN] = "";
-                       dlinfo(plug->dl_handle, RTLD_DI_ORIGIN, &origin);
-#ifdef HAVE_DLINFO_LINKMAP
-                       const char *name;
-                       struct link_map *lm = NULL;
-                       dlinfo(plug->dl_handle, RTLD_DI_LINKMAP, &lm);
-                       if (lm) {
-                               name = strrchr(lm->l_name, '/');
-                               name = name ? name + 1 : lm->l_name;
-                               vty_out(vty, "\tfrom: %s/%s\n", origin, name);
-                       }
-#else
-                       vty_out(vty, "\tfrom: %s \n", origin, plug->load_name);
-#endif
-#else
-                       vty_out(vty, "\tfrom: %s\n", plug->load_name);
-#endif
-               }
-               plug = plug->next;
-       }
-
-       vty_out(vty, "pid: %u\n", (uint32_t)(getpid()));
-
-       return CMD_SUCCESS;
-}
-
-void memory_init(void)
-{
-       install_element(VIEW_NODE, &show_memory_cmd);
-       install_element(VIEW_NODE, &show_modules_cmd);
-}
-
-/* Stats querying from users */
-/* Return a pointer to a human friendly string describing
- * the byte count passed in. E.g:
- * "0 bytes", "2048 bytes", "110kB", "500MiB", "11GiB", etc.
- * Up to 4 significant figures will be given.
- * The pointer returned may be NULL (indicating an error)
- * or point to the given buffer, or point to static storage.
- */
-const char *mtype_memstr(char *buf, size_t len, unsigned long bytes)
-{
-       unsigned int m, k;
-
-       /* easy cases */
-       if (!bytes)
-               return "0 bytes";
-       if (bytes == 1)
-               return "1 byte";
-
-       /*
-        * When we pass the 2gb barrier mallinfo() can no longer report
-        * correct data so it just does something odd...
-        * Reporting like Terrabytes of data.  Which makes users...
-        * edgy.. yes edgy that's the term for it.
-        * So let's just give up gracefully
-        */
-       if (bytes > 0x7fffffff)
-               return "> 2GB";
-
-       m = bytes >> 20;
-       k = bytes >> 10;
-
-       if (m > 10) {
-               if (bytes & (1 << 19))
-                       m++;
-               snprintf(buf, len, "%d MiB", m);
-       } else if (k > 10) {
-               if (bytes & (1 << 9))
-                       k++;
-               snprintf(buf, len, "%d KiB", k);
-       } else
-               snprintf(buf, len, "%ld bytes", bytes);
-
-       return buf;
-}
diff --git a/lib/memory_vty.h b/lib/memory_vty.h
deleted file mode 100644 (file)
index 941255b..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Memory management routine
- * Copyright (C) 1998 Kunihiro Ishiguro
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra 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, or (at your option) any
- * later version.
- *
- * GNU Zebra 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 _ZEBRA_MEMORY_VTY_H
-#define _ZEBRA_MEMORY_VTY_H
-
-#include "memory.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void memory_init(void);
-
-/* Human friendly string for given byte count */
-#define MTYPE_MEMSTR_LEN 20
-extern const char *mtype_memstr(char *, size_t, unsigned long);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ZEBRA_MEMORY_VTY_H */
index 23b1950384ac7df07bbb4b5058bace976103fd20..be059c89463eb90687d6069df9bcc2e447eed30d 100644 (file)
@@ -40,13 +40,13 @@ lib_libfrr_la_SOURCES = \
        lib/json.c \
        lib/keychain.c \
        lib/lib_errors.c \
+       lib/lib_vty.c \
        lib/libfrr.c \
        lib/linklist.c \
        lib/log.c \
        lib/log_vty.c \
        lib/md5.c \
        lib/memory.c \
-       lib/memory_vty.c \
        lib/mlag.c \
        lib/module.c \
        lib/mpls.c \
@@ -114,6 +114,7 @@ vtysh_scan += \
        $(top_srcdir)/lib/if.c \
        $(top_srcdir)/lib/if_rmap.c \
        $(top_srcdir)/lib/keychain.c \
+       $(top_srcdir)/lib/lib_vty.c \
        $(top_srcdir)/lib/nexthop_group.c \
        $(top_srcdir)/lib/plist.c \
        $(top_srcdir)/lib/routemap.c \
@@ -179,6 +180,7 @@ pkginclude_HEADERS += \
        lib/json.h \
        lib/keychain.h \
        lib/lib_errors.h \
+       lib/lib_vty.h \
        lib/libfrr.h \
        lib/libospf.h \
        lib/linklist.h \
@@ -186,7 +188,6 @@ pkginclude_HEADERS += \
        lib/log_vty.h \
        lib/md5.h \
        lib/memory.h \
-       lib/memory_vty.h \
        lib/module.h \
        lib/monotime.h \
        lib/mpls.h \
index a781122b16a3b2699abb35da7adab1b435d222b5..b58fe776ab543f6bfc1689f9420e66239f5be83f 100644 (file)
@@ -21,7 +21,6 @@
 #include "version.h"
 #include "log.h"
 #include "memory.h"
-#include "memory_vty.h"
 #include "command.h"
 #include "libfrr.h"
 
index 0fa5585b80b1e322a46ef21ac6e4c4f69f708a1d..0aaefeb3c26a0c4c9d28d899e2651a787782538e 100644 (file)
@@ -28,7 +28,6 @@
 #include "command.h"
 #include "vty.h"
 #include "memory.h"
-#include "memory_vty.h"
 #include "if.h"
 #include "filter.h"
 #include "prefix.h"
index a542b4da8373859a70f6faddbdd87e3470cc7ba2..d02ffe0448df73ad394fd1e04c67218729d2b850 100644 (file)
@@ -35,7 +35,6 @@
 #include "stream.h"
 #include "log.h"
 #include "memory.h"
-#include "memory_vty.h"
 #include "privs.h"
 #include "sigevent.h"
 #include "zclient.h"
index 3f79b304e5952617ae66b1a0cee77f9db05da58a..f0ca367258d4ab5840b8bf6e9316136bb5b721f1 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "memory.h"
 #include "vrf.h"
-#include "memory_vty.h"
 #include "filter.h"
 #include "vty.h"
 #include "sigevent.h"
index 26504a857d564a22aabee3fc07ec9ebbb1025db5..060bb76585c1aac4434a3ae4937fdd3736377b13 100644 (file)
@@ -25,7 +25,6 @@
 #include "thread.h"
 #include "command.h"
 #include "memory.h"
-#include "memory_vty.h"
 #include "prefix.h"
 #include "filter.h"
 #include "keychain.h"
index 002434550032e85d411f31988150c888823b99d3..9daeeb9580da39a51a0ca4a5c2a6e045ba4f334c 100644 (file)
@@ -27,7 +27,6 @@
 #include "vty.h"
 #include "command.h"
 #include "memory.h"
-#include "memory_vty.h"
 #include "thread.h"
 #include "log.h"
 #include "prefix.h"
index b1dcfcf7075c38d9724e92c44c3b6f0a03dcac7e..2de29cbdbcdbc0da9426d32be09e42c61d002e58 100644 (file)
@@ -24,7 +24,7 @@
 #include "vty.h"
 #include "command.h"
 #include "memory.h"
-#include "memory_vty.h"
+#include "lib_vty.h"
 
 extern void test_init(void);
 
@@ -154,7 +154,7 @@ int main(int argc, char **argv)
        /* Library inits. */
        cmd_init(1);
        vty_init(master, false);
-       memory_init();
+       lib_cmd_init();
        yang_init();
        nb_init(master, NULL, 0);
 
index 2071ae08cd7e80820d41e306c42c1a4c08b5b484..e091372ab8766bee6d3eaf0a4760f61a997c1f84 100644 (file)
@@ -25,7 +25,7 @@
 #include "vty.h"
 #include "command.h"
 #include "memory.h"
-#include "memory_vty.h"
+#include "lib_vty.h"
 #include "log.h"
 
 #include "common_cli.h"
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
        cmd_domainname_set("test.domain");
 
        vty_init(master, false);
-       memory_init();
+       lib_cmd_init();
        yang_init();
        nb_init(master, NULL, 0);
 
index 88126e84bce8196fefd0e36ec6b7ad6cd36dd031..391ccd9268af72002311a4cfca762df296a3cdc9 100644 (file)
 #include "lib/json.h"
 #include "lib/keychain.h"
 #include "lib/lib_errors.h"
+#include "lib/lib_vty.h"
 #include "lib/libfrr.h"
 #include "lib/libospf.h"
 #include "lib/linklist.h"
 #include "lib/log.h"
 #include "lib/md5.h"
 #include "lib/memory.h"
-#include "lib/memory_vty.h"
 #include "lib/mlag.h"
 #include "lib/module.h"
 #include "lib/monotime.h"
index a28830e088468e6014e7ece0a366226812c5a2d2..18d3180889b406b6054fcd58f7563838b11c6a66 100644 (file)
@@ -23,7 +23,7 @@
 #include "vty.h"
 #include "command.h"
 #include "memory.h"
-#include "memory_vty.h"
+#include "lib_vty.h"
 #include "log.h"
 #include "northbound.h"
 
@@ -412,7 +412,7 @@ int main(int argc, char **argv)
        cmd_init(1);
        cmd_hostname_set("test");
        vty_init(master, false);
-       memory_init();
+       lib_cmd_init();
        yang_init();
        nb_init(master, modules, array_size(modules));
 
index b56cc30cf3ad99c727fe5e98eb25d86aaa3e139b..7fb9a769d3e18088f5c39f3cbbb8d092a10d96c1 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <zebra.h>
 #include <memory.h>
-#include <memory_vty.h>
+#include <lib_vty.h>
 #include <buffer.h>
 
 struct thread_master *master;
@@ -32,7 +32,7 @@ int main(int argc, char **argv)
        char junk[3];
        char c = 'a';
 
-       memory_init();
+       lib_cmd_init();
 
        if ((argc != 2) || (sscanf(argv[1], "%d%1s", &n, junk) != 1)) {
                fprintf(stderr, "Usage: %s <number of chars to simulate>\n",
index de638bc67a3e0df1792587ee5e3987c13ecf90f1..c06ebbeb38e86d35fdb4ff8c73f4860f1a67c282 100644 (file)
@@ -22,7 +22,7 @@
 #include "getopt.h"
 #include "privs.h"
 #include "memory.h"
-#include "memory_vty.h"
+#include "lib_vty.h"
 
 zebra_capabilities_t _caps_p[] = {
        ZCAP_NET_RAW, ZCAP_BIND, ZCAP_NET_ADMIN, ZCAP_DAC_OVERRIDE,
@@ -105,7 +105,7 @@ int main(int argc, char **argv)
        }
 
        /* Library inits. */
-       memory_init();
+       lib_cmd_init();
        zprivs_preinit(&test_privs);
        zprivs_init(&test_privs);
 
index d0b0c701a778c2ed488a0160fc96046e496c01fb..e8df08ef600bd70166fd4621b9c21e5403c46ef9 100755 (executable)
@@ -96,7 +96,7 @@ sub scan_file {
         elsif ($file =~ /lib\/if\.c$/) {
             $protocol = "VTYSH_INTERFACE";
         }
-        elsif ($file =~ /lib\/filter\.c$/) {
+        elsif ($file =~ /lib\/(filter|lib_vty)\.c$/) {
             $protocol = "VTYSH_ALL";
         }
        elsif ($file =~ /lib\/agentx\.c$/) {
index c7e1d252c7271a2345888c2024303dc4cfedd21d..0ba1b9d9c8c70b23461ee5c4a36ffd52ea84a0e1 100644 (file)
@@ -45,7 +45,6 @@
 #include "command.h"
 #include "memory.h"
 #include "linklist.h"
-#include "memory_vty.h"
 #include "libfrr.h"
 #include "ferr.h"
 #include "lib_errors.h"
index 4e8502107a576188e8f96c01610f06f816e377ac..ed9616963dad19d96851a1170e0aac29826d6e03 100644 (file)
@@ -25,7 +25,6 @@
 #include <sigevent.h>
 #include <lib/version.h>
 #include "command.h"
-#include "memory_vty.h"
 #include "libfrr.h"
 #include "lib_errors.h"
 
index 731c4e161400e268fa7bf00cf0d0c04e4737d098..c20674d2f04a6e3eabff6c2afa64735f7ff84492 100644 (file)
@@ -27,7 +27,6 @@
 #include "filter.h"
 #include "memory.h"
 #include "zebra_memory.h"
-#include "memory_vty.h"
 #include "prefix.h"
 #include "log.h"
 #include "plist.h"