diff options
Diffstat (limited to 'lib/flex_array.c')
-rw-r--r-- | lib/flex_array.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/flex_array.c b/lib/flex_array.c index 77a6fea7481e..c0ea40ba2082 100644 --- a/lib/flex_array.c +++ b/lib/flex_array.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/flex_array.h> | 23 | #include <linux/flex_array.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/stddef.h> | 25 | #include <linux/stddef.h> |
26 | #include <linux/module.h> | ||
26 | 27 | ||
27 | struct flex_array_part { | 28 | struct flex_array_part { |
28 | char elements[FLEX_ARRAY_PART_SIZE]; | 29 | char elements[FLEX_ARRAY_PART_SIZE]; |
@@ -103,6 +104,7 @@ struct flex_array *flex_array_alloc(int element_size, unsigned int total, | |||
103 | FLEX_ARRAY_BASE_BYTES_LEFT); | 104 | FLEX_ARRAY_BASE_BYTES_LEFT); |
104 | return ret; | 105 | return ret; |
105 | } | 106 | } |
107 | EXPORT_SYMBOL(flex_array_alloc); | ||
106 | 108 | ||
107 | static int fa_element_to_part_nr(struct flex_array *fa, | 109 | static int fa_element_to_part_nr(struct flex_array *fa, |
108 | unsigned int element_nr) | 110 | unsigned int element_nr) |
@@ -126,12 +128,14 @@ void flex_array_free_parts(struct flex_array *fa) | |||
126 | for (part_nr = 0; part_nr < FLEX_ARRAY_NR_BASE_PTRS; part_nr++) | 128 | for (part_nr = 0; part_nr < FLEX_ARRAY_NR_BASE_PTRS; part_nr++) |
127 | kfree(fa->parts[part_nr]); | 129 | kfree(fa->parts[part_nr]); |
128 | } | 130 | } |
131 | EXPORT_SYMBOL(flex_array_free_parts); | ||
129 | 132 | ||
130 | void flex_array_free(struct flex_array *fa) | 133 | void flex_array_free(struct flex_array *fa) |
131 | { | 134 | { |
132 | flex_array_free_parts(fa); | 135 | flex_array_free_parts(fa); |
133 | kfree(fa); | 136 | kfree(fa); |
134 | } | 137 | } |
138 | EXPORT_SYMBOL(flex_array_free); | ||
135 | 139 | ||
136 | static unsigned int index_inside_part(struct flex_array *fa, | 140 | static unsigned int index_inside_part(struct flex_array *fa, |
137 | unsigned int element_nr) | 141 | unsigned int element_nr) |
@@ -196,6 +200,7 @@ int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, | |||
196 | memcpy(dst, src, fa->element_size); | 200 | memcpy(dst, src, fa->element_size); |
197 | return 0; | 201 | return 0; |
198 | } | 202 | } |
203 | EXPORT_SYMBOL(flex_array_put); | ||
199 | 204 | ||
200 | /** | 205 | /** |
201 | * flex_array_clear - clear element in array at @element_nr | 206 | * flex_array_clear - clear element in array at @element_nr |
@@ -223,6 +228,7 @@ int flex_array_clear(struct flex_array *fa, unsigned int element_nr) | |||
223 | memset(dst, FLEX_ARRAY_FREE, fa->element_size); | 228 | memset(dst, FLEX_ARRAY_FREE, fa->element_size); |
224 | return 0; | 229 | return 0; |
225 | } | 230 | } |
231 | EXPORT_SYMBOL(flex_array_clear); | ||
226 | 232 | ||
227 | /** | 233 | /** |
228 | * flex_array_prealloc - guarantee that array space exists | 234 | * flex_array_prealloc - guarantee that array space exists |
@@ -259,6 +265,7 @@ int flex_array_prealloc(struct flex_array *fa, unsigned int start, | |||
259 | } | 265 | } |
260 | return 0; | 266 | return 0; |
261 | } | 267 | } |
268 | EXPORT_SYMBOL(flex_array_prealloc); | ||
262 | 269 | ||
263 | /** | 270 | /** |
264 | * flex_array_get - pull data back out of the array | 271 | * flex_array_get - pull data back out of the array |
@@ -288,6 +295,7 @@ void *flex_array_get(struct flex_array *fa, unsigned int element_nr) | |||
288 | } | 295 | } |
289 | return &part->elements[index_inside_part(fa, element_nr)]; | 296 | return &part->elements[index_inside_part(fa, element_nr)]; |
290 | } | 297 | } |
298 | EXPORT_SYMBOL(flex_array_get); | ||
291 | 299 | ||
292 | /** | 300 | /** |
293 | * flex_array_get_ptr - pull a ptr back out of the array | 301 | * flex_array_get_ptr - pull a ptr back out of the array |
@@ -308,6 +316,7 @@ void *flex_array_get_ptr(struct flex_array *fa, unsigned int element_nr) | |||
308 | 316 | ||
309 | return *tmp; | 317 | return *tmp; |
310 | } | 318 | } |
319 | EXPORT_SYMBOL(flex_array_get_ptr); | ||
311 | 320 | ||
312 | static int part_is_free(struct flex_array_part *part) | 321 | static int part_is_free(struct flex_array_part *part) |
313 | { | 322 | { |
@@ -348,3 +357,4 @@ int flex_array_shrink(struct flex_array *fa) | |||
348 | } | 357 | } |
349 | return ret; | 358 | return ret; |
350 | } | 359 | } |
360 | EXPORT_SYMBOL(flex_array_shrink); | ||