summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJustin Pettit <jpettit@ovn.org>2018-02-27 14:50:25 -0800
committerJustin Pettit <jpettit@ovn.org>2018-02-28 14:53:34 -0800
commit84b99a04900a745f7addef616eb188a2dccf3233 (patch)
treea2de06061bed1e6cd7dbd7648c86796eb8fc2182 /lib
parentbcfed2313689f95cc07e07b7fa8aef779add9460 (diff)
downloadopenvswitch-84b99a04900a745f7addef616eb188a2dccf3233.tar.gz
ovs-numa: Prevent shadowing 'dummy_config'.
Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/ovs-numa.c34
-rw-r--r--lib/ovs-numa.h2
2 files changed, 11 insertions, 25 deletions
diff --git a/lib/ovs-numa.c b/lib/ovs-numa.c
index 98e97cb33..24edeab2a 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 6946cdc08..088fcb8c3 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);