diff mbox series

[ovs-dev,shadow,6/8] ovs-numa: Prevent shadowing 'dummy_config'.

Message ID 1519804863-73126-7-git-send-email-jpettit@ovn.org
State Accepted
Headers show
Series Remove shadowed declarations | expand

Commit Message

Justin Pettit Feb. 28, 2018, 8:01 a.m. UTC
Signed-off-by: Justin Pettit <jpettit@ovn.org>
---
 lib/ovs-numa.c | 34 ++++++++++------------------------
 lib/ovs-numa.h |  2 +-
 2 files changed, 11 insertions(+), 25 deletions(-)
diff mbox series

Patch

diff --git a/lib/ovs-numa.c b/lib/ovs-numa.c
index 98e97cb33fdd..24edeab2a8d9 100644
--- a/lib/ovs-numa.c
+++ b/lib/ovs-numa.c
@@ -122,8 +122,9 @@  insert_new_cpu_core(struct numa_node *n, unsigned core_id)
     return c;
 }
 
-/* Has the same effect as discover_numa_and_core(), but instead of reading
- * sysfs entries, extracts the info from 'dummy_config'.
+/* Has the same effect as discover_numa_and_core(), but instead of
+ * reading sysfs entries, extracts the info from the global variable
+ * 'dummy_config', which is set with ovs_numa_set_dummy().
  *
  * 'dummy_config' lists the numa_ids of each CPU separated by a comma, e.g.
  * - "0,0,0,0": four cores on numa socket 0.
@@ -132,7 +133,7 @@  insert_new_cpu_core(struct numa_node *n, unsigned core_id)
  *
  * The different numa ids must be consecutives or the function will abort. */
 static void
-discover_numa_and_core_dummy(const char *dummy_config)
+discover_numa_and_core_dummy(void)
 {
     char *conf = xstrdup(dummy_config);
     char *id, *saveptr = NULL;
@@ -268,19 +269,19 @@  get_numa_by_numa_id(int numa_id)
 }
 
 
-
-static bool
-ovs_numa_init__(const char *dummy_config)
+/* Initializes the numa module. */
+void
+ovs_numa_init(void)
 {
     static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
 
     if (ovsthread_once_start(&once)) {
         const struct numa_node *n;
 
-        if (!dummy_config) {
-            discover_numa_and_core();
+        if (dummy_numa) {
+            discover_numa_and_core_dummy();
         } else {
-            discover_numa_and_core_dummy(dummy_config);
+            discover_numa_and_core();
         }
 
         HMAP_FOR_EACH(n, hmap_node, &all_numa_nodes) {
@@ -296,10 +297,6 @@  ovs_numa_init__(const char *dummy_config)
         }
 
         ovsthread_once_done(&once);
-
-        return true;
-    } else {
-        return false;
     }
 }
 
@@ -317,17 +314,6 @@  ovs_numa_set_dummy(const char *config)
     dummy_config = xstrdup(config);
 }
 
-/* Initializes the numa module. */
-void
-ovs_numa_init(void)
-{
-    if (dummy_numa) {
-        ovs_numa_init__(dummy_config);
-    } else {
-        ovs_numa_init__(NULL);
-    }
-}
-
 bool
 ovs_numa_numa_id_is_valid(int numa_id)
 {
diff --git a/lib/ovs-numa.h b/lib/ovs-numa.h
index 6946cdc0889a..088fcb8c3b42 100644
--- a/lib/ovs-numa.h
+++ b/lib/ovs-numa.h
@@ -47,7 +47,7 @@  struct ovs_numa_info_numa {
 };
 
 void ovs_numa_init(void);
-void ovs_numa_set_dummy(const char *dummy_config);
+void ovs_numa_set_dummy(const char *config);
 bool ovs_numa_numa_id_is_valid(int numa_id);
 bool ovs_numa_core_id_is_valid(unsigned core_id);
 int ovs_numa_get_n_numas(void);