[PATCH 04/31] cpumask: move cpu_alloc to separate file

Previous thread: [PATCH 01/31] cpumask: Documentation by Mike Travis on Monday, September 29, 2008 - 11:02 am. (8 messages)

Next thread: [PATCH 07/31] cpumask: changes to compile init/main.c by Mike Travis on Monday, September 29, 2008 - 11:02 am. (1 message)
From: Mike Travis
Date: Monday, September 29, 2008 - 11:02 am

Signed-of-by: Mike Travis <travis@sgi.com>
---
 include/linux/cpumask.h       |   40 -------------
 include/linux/cpumask_alloc.h |  127 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 127 insertions(+), 40 deletions(-)

--- struct-cpumasks.orig/include/linux/cpumask.h
+++ struct-cpumasks/include/linux/cpumask.h
@@ -67,37 +67,6 @@
  * CPU_MASK_NONE			Initializer - no bits set
  * unsigned long *cpus_addr(mask)	Array of unsigned long's in mask
  *
- * CPUMASK_ALLOC kmalloc's a structure that is a composite of many cpumask_t
- * variables, and CPUMASK_PTR provides pointers to each field.
- *
- * The structure should be defined something like this:
- * struct my_cpumasks {
- *	cpumask_t mask1;
- *	cpumask_t mask2;
- * };
- *
- * Usage is then:
- *	CPUMASK_ALLOC(my_cpumasks);
- *	CPUMASK_PTR(mask1, my_cpumasks);
- *	CPUMASK_PTR(mask2, my_cpumasks);
- *
- *	--- DO NOT reference cpumask_t pointers until this check ---
- *	if (my_cpumasks == NULL)
- *		"kmalloc failed"...
- *
- * References are now pointers to the cpumask_t variables (*mask1, ...)
- *
- *if NR_CPUS > BITS_PER_LONG
- *   CPUMASK_ALLOC(m)			Declares and allocates struct m *m =
- *						kmalloc(sizeof(*m), GFP_KERNEL)
- *   CPUMASK_FREE(m)			Macro for kfree(m)
- *else
- *   CPUMASK_ALLOC(m)			Declares struct m _m, *m = &_m
- *   CPUMASK_FREE(m)			Nop
- *endif
- *   CPUMASK_PTR(v, m)			Declares cpumask_t *v = &(m->v)
- * ------------------------------------------------------------------------
- *
  * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing
  * int cpumask_parse_user(ubuf, ulen, mask)	Parse ascii string as cpumask
  * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing
@@ -327,15 +296,6 @@ extern cpumask_t cpu_mask_all;
 
 #define cpus_addr(src) ((src).bits)
 
-#if NR_CPUS > BITS_PER_LONG
-#define	CPUMASK_ALLOC(m)	struct m *m = kmalloc(sizeof(*m), GFP_KERNEL)
-#define	CPUMASK_FREE(m)		kfree(m)
-#else
-#define	CPUMASK_ALLOC(m)	struct m _m, *m ...
Previous thread: [PATCH 01/31] cpumask: Documentation by Mike Travis on Monday, September 29, 2008 - 11:02 am. (8 messages)

Next thread: [PATCH 07/31] cpumask: changes to compile init/main.c by Mike Travis on Monday, September 29, 2008 - 11:02 am. (1 message)