aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2009-06-06 17:50:36 -0400
committerRusty Russell <rusty@rustcorp.com.au>2009-06-09 09:00:26 -0400
commit0281b5dc0350cbf6dd21ed558a33cccce77abc02 (patch)
tree4523b6f48722eee44a854207e268c71ae4d84771
parent3af968e066d593bc4dacc021715f3e95ddf0996f (diff)
cpumask: introduce zalloc_cpumask_var
So can get cpumask_var with cpumask_clear Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--include/linux/cpumask.h15
-rw-r--r--lib/cpumask.c12
2 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 9f315382610b..c5ac87ca7bc6 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -1022,6 +1022,8 @@ typedef struct cpumask *cpumask_var_t;
1022 1022
1023bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node); 1023bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
1024bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); 1024bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
1025bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
1026bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
1025void alloc_bootmem_cpumask_var(cpumask_var_t *mask); 1027void alloc_bootmem_cpumask_var(cpumask_var_t *mask);
1026void free_cpumask_var(cpumask_var_t mask); 1028void free_cpumask_var(cpumask_var_t mask);
1027void free_bootmem_cpumask_var(cpumask_var_t mask); 1029void free_bootmem_cpumask_var(cpumask_var_t mask);
@@ -1040,6 +1042,19 @@ static inline bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
1040 return true; 1042 return true;
1041} 1043}
1042 1044
1045static inline bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
1046{
1047 cpumask_clear(*mask);
1048 return true;
1049}
1050
1051static inline bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
1052 int node)
1053{
1054 cpumask_clear(*mask);
1055 return true;
1056}
1057
1043static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask) 1058static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask)
1044{ 1059{
1045} 1060}
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 1f71b97de0f9..eb23aaa0c7b8 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -119,6 +119,12 @@ bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
119} 119}
120EXPORT_SYMBOL(alloc_cpumask_var_node); 120EXPORT_SYMBOL(alloc_cpumask_var_node);
121 121
122bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
123{
124 return alloc_cpumask_var_node(mask, flags | __GFP_ZERO, node);
125}
126EXPORT_SYMBOL(zalloc_cpumask_var_node);
127
122/** 128/**
123 * alloc_cpumask_var - allocate a struct cpumask 129 * alloc_cpumask_var - allocate a struct cpumask
124 * @mask: pointer to cpumask_var_t where the cpumask is returned 130 * @mask: pointer to cpumask_var_t where the cpumask is returned
@@ -135,6 +141,12 @@ bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
135} 141}
136EXPORT_SYMBOL(alloc_cpumask_var); 142EXPORT_SYMBOL(alloc_cpumask_var);
137 143
144bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
145{
146 return alloc_cpumask_var(mask, flags | __GFP_ZERO);
147}
148EXPORT_SYMBOL(zalloc_cpumask_var);
149
138/** 150/**
139 * alloc_bootmem_cpumask_var - allocate a struct cpumask from the bootmem arena. 151 * alloc_bootmem_cpumask_var - allocate a struct cpumask from the bootmem arena.
140 * @mask: pointer to cpumask_var_t where the cpumask is returned 152 * @mask: pointer to cpumask_var_t where the cpumask is returned