diff options
-rw-r--r-- | lib/Makefile | 4 | ||||
-rw-r--r-- | lib/flex_array.c | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/Makefile b/lib/Makefile index d7b6e30a3a1e..2f59e0a1dd8d 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -12,7 +12,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ | |||
12 | idr.o int_sqrt.o extable.o prio_tree.o \ | 12 | idr.o int_sqrt.o extable.o prio_tree.o \ |
13 | sha1.o irq_regs.o reciprocal_div.o argv_split.o \ | 13 | sha1.o irq_regs.o reciprocal_div.o argv_split.o \ |
14 | proportions.o prio_heap.o ratelimit.o show_mem.o \ | 14 | proportions.o prio_heap.o ratelimit.o show_mem.o \ |
15 | is_single_threaded.o plist.o decompress.o flex_array.o | 15 | is_single_threaded.o plist.o decompress.o |
16 | 16 | ||
17 | lib-$(CONFIG_MMU) += ioremap.o | 17 | lib-$(CONFIG_MMU) += ioremap.o |
18 | lib-$(CONFIG_SMP) += cpumask.o | 18 | lib-$(CONFIG_SMP) += cpumask.o |
@@ -21,7 +21,7 @@ lib-y += kobject.o kref.o klist.o | |||
21 | 21 | ||
22 | obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ | 22 | obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ |
23 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ | 23 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ |
24 | string_helpers.o gcd.o lcm.o list_sort.o uuid.o | 24 | string_helpers.o gcd.o lcm.o list_sort.o uuid.o flex_array.o |
25 | 25 | ||
26 | ifeq ($(CONFIG_DEBUG_KOBJECT),y) | 26 | ifeq ($(CONFIG_DEBUG_KOBJECT),y) |
27 | CFLAGS_kobject.o += -DDEBUG | 27 | CFLAGS_kobject.o += -DDEBUG |
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); | ||