]> git.puffer.fish Git - mirror/frr.git/commitdiff
sharpd: Add start of global data structures
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 7 Feb 2019 13:21:24 +0000 (08:21 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 7 Feb 2019 14:35:49 +0000 (09:35 -0500)
We have a bit of a mess with globals in the sharp daemon.
Let's start formalizing it a bit.  Future commits will
take advantage of this, as that we need to have the ability
to start dumping stats about commands we have issued.

These changes will be useful for debugging and understanding
what is going on.

Signed-off-by: Donald sharp <sharpd@cumulusnetworks.com>
sharpd/sharp_globals.h [new file with mode: 0644]
sharpd/sharp_main.c
sharpd/subdir.am

diff --git a/sharpd/sharp_globals.h b/sharpd/sharp_globals.h
new file mode 100644 (file)
index 0000000..6b6cafc
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * SHARP - code to track globals
+ * Copyright (C) 2019 Cumulus Networks, Inc.
+ *               Donald Sharp
+ *
+ * This file is part of FRR.
+ *
+ * FRR 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.
+ *
+ * FRR 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 __SHARP_GLOBAL_H__
+#define __SHARP_GLOBAL_H__
+
+struct sharp_global {
+};
+
+#endif
index 175a276089b6962b1e0ad8a3cdc707c3501411e3..c389b0bc362f584581138845f019eaaa023c8cdb 100644 (file)
@@ -46,6 +46,7 @@
 
 #include "sharp_zebra.h"
 #include "sharp_vty.h"
+#include "sharp_globals.h"
 
 uint32_t total_routes = 0;
 uint32_t installed_routes = 0;
@@ -125,7 +126,12 @@ FRR_DAEMON_INFO(sharpd, SHARP, .vty_port = SHARP_VTY_PORT,
                .privs = &sharp_privs, .yang_modules = sharpd_yang_modules,
                .n_yang_modules = array_size(sharpd_yang_modules), )
 
-extern void sharp_vty_init(void);
+struct sharp_global sg;
+
+static void sharp_global_init(void)
+{
+       memset(&sg, 0, sizeof(sg));
+}
 
 int main(int argc, char **argv, char **envp)
 {
@@ -151,6 +157,8 @@ int main(int argc, char **argv, char **envp)
 
        master = frr_init();
 
+       sharp_global_init();
+
        nexthop_group_init(NULL, NULL, NULL, NULL);
        vrf_init(NULL, NULL, NULL, NULL, NULL);
 
index c00d90ea0a148a9cd54cffc27f1f9a90bf1f0213..6e8864ad7cda103889958fcf7bfe051e6c394557 100644 (file)
@@ -17,6 +17,7 @@ sharpd_libsharp_a_SOURCES = \
 
 noinst_HEADERS += \
        sharpd/sharp_vty.h \
+       sharpd/sharp_globals.h \
        sharpd/sharp_zebra.h \
        # end