summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Kacur <jkacur@redhat.com>2010-01-27 19:42:50 +0100
committerJohn Kacur <jkacur@redhat.com>2010-01-27 19:42:50 +0100
commit51dfab754a398581b19dd98ed26be9e7f0d28ddd (patch)
treebde6446fcdaf2dec9dc452998255139f658f2b82
parent29c4f544fb4028690320b3aa07434a54943f9d37 (diff)
downloadrt-tests-51dfab754a398581b19dd98ed26be9e7f0d28ddd.tar.gz
rt-tests: Separate the #ifdef LIBNUMA_API_VERSION functions.
Separate the #ifdef LIBNUMA_API_VERSION of function rt_numa_numa_node_of_cpu, it is slightly cleaner this way. Signed-off-by: John Kacur <jkacur@redhat.com>
-rw-r--r--src/cyclictest/rt_numa.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/cyclictest/rt_numa.h b/src/cyclictest/rt_numa.h
index 14837ff..8d44097 100644
--- a/src/cyclictest/rt_numa.h
+++ b/src/cyclictest/rt_numa.h
@@ -58,15 +58,20 @@ static void numa_on_and_available()
fatal("--numa specified and numa functions not available.\n");
}
+#if LIBNUMA_API_VERSION >= 2
static int rt_numa_numa_node_of_cpu(int cpu)
{
-#if LIBNUMA_API_VERSION >= 2
int node;
node = numa_node_of_cpu(cpu);
if (node == -1)
fatal("invalid cpu passed to numa_node_of_cpu(%d)\n", cpu);
return node;
-#else
+}
+
+#else /* LIBNUMA_API_VERSION == 1 */
+
+static int rt_numa_numa_node_of_cpu(int cpu)
+{
unsigned char cpumask[16];
int node, ret, idx, bit;
int max_node, max_cpus;
@@ -96,10 +101,10 @@ static int rt_numa_numa_node_of_cpu(int cpu)
errno = EINVAL;
end:
return ret;
-
-#endif
}
+#endif /* LIBNUMA_API_VERSION */
+
static void *rt_numa_numa_alloc_onnode(size_t size, int node, int cpu)
{
void *stack;