Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164527
b: refs/heads/master
c: fc0d8d9
h: refs/heads/master
i:
  164525: f10f6a1
  164523: 1fd2359
  164519: a35d7fe
  164511: b321f4b
v: v3
  • Loading branch information
David Rientjes authored and Linus Torvalds committed Sep 22, 2009
1 parent 0de6ca1 commit dccd786
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 45b588d6e5cc172704bac0c998ce54873b149b22
refs/heads/master: fc0d8d944df0c58cd810f33db82f87dcf5dcc190
12 changes: 11 additions & 1 deletion trunk/lib/flex_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ static inline int elements_fit_in_base(struct flex_array *fa)
* flex_array_alloc - allocate a new flexible array
* @element_size: the size of individual elements in the array
* @total: total number of elements that this should hold
* @flags: page allocation flags to use for base array
*
* Note: all locking must be provided by the caller.
*
Expand Down Expand Up @@ -111,6 +112,7 @@ static int fa_element_to_part_nr(struct flex_array *fa,

/**
* flex_array_free_parts - just free the second-level pages
* @fa: the flex array from which to free parts
*
* This is to be used in cases where the base 'struct flex_array'
* has been statically allocated and should not be free.
Expand Down Expand Up @@ -159,9 +161,12 @@ __fa_get_part(struct flex_array *fa, int part_nr, gfp_t flags)

/**
* flex_array_put - copy data into the array at @element_nr
* @src: address of data to copy into the array
* @fa: the flex array to copy data into
* @element_nr: index of the position in which to insert
* the new element.
* @src: address of data to copy into the array
* @flags: page allocation flags to use for array expansion
*
*
* Note that this *copies* the contents of @src into
* the array. If you are trying to store an array of
Expand Down Expand Up @@ -192,6 +197,7 @@ int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src,

/**
* flex_array_clear - clear element in array at @element_nr
* @fa: the flex array of the element.
* @element_nr: index of the position to clear.
*
* Locking must be provided by the caller.
Expand All @@ -218,8 +224,10 @@ int flex_array_clear(struct flex_array *fa, unsigned int element_nr)

/**
* flex_array_prealloc - guarantee that array space exists
* @fa: the flex array for which to preallocate parts
* @start: index of first array element for which space is allocated
* @end: index of last (inclusive) element for which space is allocated
* @flags: page allocation flags
*
* This will guarantee that no future calls to flex_array_put()
* will allocate memory. It can be used if you are expecting to
Expand Down Expand Up @@ -252,6 +260,7 @@ int flex_array_prealloc(struct flex_array *fa, unsigned int start,

/**
* flex_array_get - pull data back out of the array
* @fa: the flex array from which to extract data
* @element_nr: index of the element to fetch from the array
*
* Returns a pointer to the data at index @element_nr. Note
Expand Down Expand Up @@ -289,6 +298,7 @@ static int part_is_free(struct flex_array_part *part)

/**
* flex_array_shrink - free unused second-level pages
* @fa: the flex array to shrink
*
* Frees all second-level pages that consist solely of unused
* elements. Returns the number of pages freed.
Expand Down

0 comments on commit dccd786

Please sign in to comment.