[PATCH 06/31] cpumask: new lib/cpumask.c

From: Mike Travis
Date: Mon Sep 29 2008 - 14:03:47 EST


Signed-of-by: Mike Travis <travis@xxxxxxx>
---
lib/cpumask.c | 36 +++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 15 deletions(-)

--- struct-cpumasks.orig/lib/cpumask.c
+++ struct-cpumasks/lib/cpumask.c
@@ -3,34 +3,40 @@
#include <linux/cpumask.h>
#include <linux/module.h>

-int __first_cpu(const cpumask_t *srcp)
+int cpus_first(const_cpumask_t srcp)
{
- return find_first_bit(srcp->bits, NR_CPUS);
+ return find_first_bit(srcp->bits, nr_cpu_ids);
}
-EXPORT_SYMBOL(__first_cpu);
+EXPORT_SYMBOL(cpus_first);

-int __next_cpu(int n, const cpumask_t *srcp)
+int cpus_next(int n, const_cpumask_t srcp)
{
- return find_next_bit(srcp->bits, NR_CPUS, n+1);
+ return find_next_bit(srcp->bits, nr_cpu_ids, n+1);
}
-EXPORT_SYMBOL(__next_cpu);
+EXPORT_SYMBOL(cpus_next);

-#if NR_CPUS > 64
-int __next_cpu_nr(int n, const cpumask_t *srcp)
+int cpus_next_in(int n, const_cpumask_t srcp, const_cpumask_t andp)
{
- return find_next_bit(srcp->bits, nr_cpu_ids, n+1);
+ int cpu;
+
+ for (cpu = n + 1; cpu < nr_cpu_ids; cpu++) {
+ cpu = find_next_bit(srcp->bits, nr_cpu_ids, cpu);
+
+ if (cpu < nr_cpu_ids && cpu_isset(cpu, andp))
+ return cpu;
+ }
+ return nr_cpu_ids;
}
-EXPORT_SYMBOL(__next_cpu_nr);
-#endif
+EXPORT_SYMBOL(cpus_next_in);

-int __any_online_cpu(const cpumask_t *mask)
+int any_cpu_in(const_cpumask_t mask, const_cpumask_t andmask)
{
int cpu;

- for_each_cpu_mask(cpu, *mask) {
- if (cpu_online(cpu))
+ for_each_cpu(cpu, mask) {
+ if (cpu_isset(cpu, andmask))
break;
}
return cpu;
}
-EXPORT_SYMBOL(__any_online_cpu);
+EXPORT_SYMBOL(any_cpu_in);

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/