cpumask: add cpumask_copy()

Since cpumasks are to become pointers to undefined structs, we need to
replace assignments.  Also, dynamically allocated ones will eventually
be nr_cpu_ids bits (<= NR_CPUS), so assignment is a definite no-no.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 include/linux/cpumask.h |    8 ++++++++
 1 file changed, 8 insertions(+)

diff -r 10ad89a35e3f include/linux/cpumask.h
--- a/include/linux/cpumask.h	Sat Oct 04 20:59:15 2008 +1000
+++ b/include/linux/cpumask.h	Sat Oct 04 21:02:37 2008 +1000
@@ -63,6 +63,8 @@
  * int first_cpu(mask)			Number lowest set bit, or NR_CPUS
  * int next_cpu(cpu, mask)		Next cpu past 'cpu', or NR_CPUS
  * int next_cpu_nr(cpu, mask)		Next cpu past 'cpu', or nr_cpu_ids
+ *
+ * void cpumask_copy(dmask, smask)	dmask = smask
  *
  * size_t cpumask_size()		Length of cpumask in bytes.
  * cpumask_t cpumask_of_cpu(cpu)	Return cpumask with bit 'cpu' set
@@ -345,6 +347,12 @@ static inline void cpumask_fold(struct c
 	bitmap_fold(dstp->bits, origp->bits, sz, NR_CPUS);
 }
 
+static inline void cpumask_copy(struct cpumask *dstp,
+				const struct cpumask *srcp)
+{
+	memcpy(dstp, srcp, cpumask_size());
+}
+
 /*
  * Special-case data structure for "single bit set only" constant CPU masks.
  *
