summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2009-09-21 17:04:30 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 07:17:47 -0700
commite6de3988aa52debb25a427d085061f3bf1181d54 (patch)
tree4a5dd6acac3e73049918c646bd977894335e5560 /include
parent2f30b1f9e1b612cdd1a17daeecf514229e8d6a5f (diff)
flex_array: add flex_array_clear function
Add a new function to the flex_array API: int flex_array_clear(struct flex_array *fa, unsigned int element_nr) This function will zero the element at element_nr in the flex_array. Although this is equivalent to using flex_array_put() and passing a pointer to zero'd memory, flex_array_clear() does not require such a pointer to memory that would most likely need to be allocated on the caller's stack which could be significantly large depending on element_size. Signed-off-by: David Rientjes <rientjes@google.com> Cc: Dave Hansen <dave@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/flex_array.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h
index 45ff1849151..3887b21f883 100644
--- a/include/linux/flex_array.h
+++ b/include/linux/flex_array.h
@@ -44,6 +44,7 @@ void flex_array_free(struct flex_array *fa);
void flex_array_free_parts(struct flex_array *fa);
int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src,
gfp_t flags);
+int flex_array_clear(struct flex_array *fa, unsigned int element_nr);
void *flex_array_get(struct flex_array *fa, unsigned int element_nr);
#endif /* _FLEX_ARRAY_H */