diff options
Diffstat (limited to 'lib/flex_array.c')
-rw-r--r-- | lib/flex_array.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/flex_array.c b/lib/flex_array.c index b62ce6cffd0a..66eef2e4483e 100644 --- a/lib/flex_array.c +++ b/lib/flex_array.c | |||
@@ -46,6 +46,7 @@ static inline int elements_fit_in_base(struct flex_array *fa) | |||
46 | * flex_array_alloc - allocate a new flexible array | 46 | * flex_array_alloc - allocate a new flexible array |
47 | * @element_size: the size of individual elements in the array | 47 | * @element_size: the size of individual elements in the array |
48 | * @total: total number of elements that this should hold | 48 | * @total: total number of elements that this should hold |
49 | * @flags: page allocation flags to use for base array | ||
49 | * | 50 | * |
50 | * Note: all locking must be provided by the caller. | 51 | * Note: all locking must be provided by the caller. |
51 | * | 52 | * |
@@ -111,6 +112,7 @@ static int fa_element_to_part_nr(struct flex_array *fa, | |||
111 | 112 | ||
112 | /** | 113 | /** |
113 | * flex_array_free_parts - just free the second-level pages | 114 | * flex_array_free_parts - just free the second-level pages |
115 | * @fa: the flex array from which to free parts | ||
114 | * | 116 | * |
115 | * This is to be used in cases where the base 'struct flex_array' | 117 | * This is to be used in cases where the base 'struct flex_array' |
116 | * has been statically allocated and should not be free. | 118 | * has been statically allocated and should not be free. |
@@ -159,9 +161,12 @@ __fa_get_part(struct flex_array *fa, int part_nr, gfp_t flags) | |||
159 | 161 | ||
160 | /** | 162 | /** |
161 | * flex_array_put - copy data into the array at @element_nr | 163 | * flex_array_put - copy data into the array at @element_nr |
162 | * @src: address of data to copy into the array | 164 | * @fa: the flex array to copy data into |
163 | * @element_nr: index of the position in which to insert | 165 | * @element_nr: index of the position in which to insert |
164 | * the new element. | 166 | * the new element. |
167 | * @src: address of data to copy into the array | ||
168 | * @flags: page allocation flags to use for array expansion | ||
169 | * | ||
165 | * | 170 | * |
166 | * Note that this *copies* the contents of @src into | 171 | * Note that this *copies* the contents of @src into |
167 | * the array. If you are trying to store an array of | 172 | * the array. If you are trying to store an array of |
@@ -192,6 +197,7 @@ int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, | |||
192 | 197 | ||
193 | /** | 198 | /** |
194 | * flex_array_clear - clear element in array at @element_nr | 199 | * flex_array_clear - clear element in array at @element_nr |
200 | * @fa: the flex array of the element. | ||
195 | * @element_nr: index of the position to clear. | 201 | * @element_nr: index of the position to clear. |
196 | * | 202 | * |
197 | * Locking must be provided by the caller. | 203 | * Locking must be provided by the caller. |
@@ -218,8 +224,10 @@ int flex_array_clear(struct flex_array *fa, unsigned int element_nr) | |||
218 | 224 | ||
219 | /** | 225 | /** |
220 | * flex_array_prealloc - guarantee that array space exists | 226 | * flex_array_prealloc - guarantee that array space exists |
227 | * @fa: the flex array for which to preallocate parts | ||
221 | * @start: index of first array element for which space is allocated | 228 | * @start: index of first array element for which space is allocated |
222 | * @end: index of last (inclusive) element for which space is allocated | 229 | * @end: index of last (inclusive) element for which space is allocated |
230 | * @flags: page allocation flags | ||
223 | * | 231 | * |
224 | * This will guarantee that no future calls to flex_array_put() | 232 | * This will guarantee that no future calls to flex_array_put() |
225 | * will allocate memory. It can be used if you are expecting to | 233 | * will allocate memory. It can be used if you are expecting to |
@@ -252,6 +260,7 @@ int flex_array_prealloc(struct flex_array *fa, unsigned int start, | |||
252 | 260 | ||
253 | /** | 261 | /** |
254 | * flex_array_get - pull data back out of the array | 262 | * flex_array_get - pull data back out of the array |
263 | * @fa: the flex array from which to extract data | ||
255 | * @element_nr: index of the element to fetch from the array | 264 | * @element_nr: index of the element to fetch from the array |
256 | * | 265 | * |
257 | * Returns a pointer to the data at index @element_nr. Note | 266 | * Returns a pointer to the data at index @element_nr. Note |
@@ -289,6 +298,7 @@ static int part_is_free(struct flex_array_part *part) | |||
289 | 298 | ||
290 | /** | 299 | /** |
291 | * flex_array_shrink - free unused second-level pages | 300 | * flex_array_shrink - free unused second-level pages |
301 | * @fa: the flex array to shrink | ||
292 | * | 302 | * |
293 | * Frees all second-level pages that consist solely of unused | 303 | * Frees all second-level pages that consist solely of unused |
294 | * elements. Returns the number of pages freed. | 304 | * elements. Returns the number of pages freed. |