On Wed, 2009-07-22 at 19:45 -0700, H. Peter Anvin wrote:
I call it a flexible array. It does all of its work in
PAGE_SIZE bits, so never does an order0 allocation.
The base level has PAGE_SIZE-2*sizeof(int) bytes of
storage for pointers to the second level. So, with a
32-bit arch, you
12:34, Dave Hansen wrote:
On Wed, 2009-07-22 at 11:25 +0800, Li Zefan wrote:
+/**
+ * flex_array_put - copy data into the array at @element_nr
+ * @src: address of data to copy into the array
+ * @element_nr:index of the position in which to insert
+ * the new element.
On Tue, Jul 21, 2009 at 03:00:17PM -0700, Dave Hansen wrote:
Changes from v1:
- to vs too typo
- added __check_part_and_nr() and gave it a warning
- fixed off-by-one check on __nr_part_ptrs()
- addedFLEX_ARRAY_INIT() macro
- some kerneldoc comments about the capacity
with various sized objects
On Wed, 2009-07-22 at 15:09 +0800, Amerigo Wang wrote:
On Tue, Jul 21, 2009 at 03:00:17PM -0700, Dave Hansen wrote:
+static inline int __nr_part_ptrs(void)
How about __nr_ptrs_in_part()?
That would be fine except it is the number of part pointers in the base.
I guess you're proving that I
On Tue, Jul 21, 2009 at 03:00:17PM -0700, Dave Hansen wrote:
Changes from v1:
- to vs too typo
- added __check_part_and_nr() and gave it a warning
- fixed off-by-one check on __nr_part_ptrs()
- addedFLEX_ARRAY_INIT() macro
- some kerneldoc comments about the capacity
with various
Dave Hansen wrote:
Changes from v1:
- to vs too typo
- added __check_part_and_nr() and gave it a warning
- fixed off-by-one check on __nr_part_ptrs()
- addedFLEX_ARRAY_INIT() macro
- some kerneldoc comments about the capacity
with various sized objects
- comments to note lack of locking
Does the array automatically grow if you give it more elements than
you tell it it can have? How about a resize() function that can be
used to either grow or shrink the array?
___
Containers mailing list
contain...@lists.linux-foundation.org
On Wed, 2009-07-22 at 13:57 -0700, Benjamin Blum wrote:
Does the array automatically grow if you give it more elements than
you tell it it can have?
The only limits it has or enforces are the structural and architectural
ones dictated by the layout.
How about a resize() function that can be
On Wed, 2009-07-22 at 15:55 -0400, Mike Waychison wrote:
+#define FLEX_ARRAY_INIT(size, total) {{{\
+ .element_size = (size), \
+ .nr_elements = 0, \
+}}}
+
It's not clear how this guy is used. It will initialize a flex_array,
but how is somebody
On Wed, 2009-07-22 at 11:30 -0700, Matt Helsley wrote:
+static int __check_part_and_nr(struct flex_array *fa,
+int part_nr, int element_nr)
+{
+ if (part_nr = __nr_part_ptrs() ||
+ element_nr fa-nr_elements) {
+ WARN(1, bad flexible
On Wed, Jul 22, 2009 at 2:51 PM, Dave Hansend...@linux.vnet.ibm.com wrote:
On Wed, 2009-07-22 at 13:57 -0700, Benjamin Blum wrote:
Does the array automatically grow if you give it more elements than
you tell it it can have?
The only limits it has or enforces are the structural and
On 07/21/2009 03:00 PM, Dave Hansen wrote:
Here's an alternative. I think it's what Andrew was
suggesting here:
http://lkml.org/lkml/2009/7/2/518
I call it a flexible array. It does all of its work in
PAGE_SIZE bits, so never does an order0 allocation.
The base level has
On Wed, 2009-07-22 at 16:20 -0700, Benjamin Blum wrote:
How about a resize() function that can be
used to either grow or shrink the array?
I think growing is out of the question. It has a fixed maximum size
already. As for shrinking, there's probably a use case for when
something
On Tue, 21 Jul 2009 15:09:05 -0700
Dave Hansen d...@linux.vnet.ibm.com wrote:
On Tue, 2009-07-21 at 15:00 -0700, Dave Hansen wrote:
The interface is dirt simple. 4 functions:
alloc_flex_array()
free_flex_array()
flex_array_put()
flex_array_get()
On Tue, 2009-07-21 at 15:00 -0700, Dave Hansen wrote:
The interface is dirt simple. 4 functions:
alloc_flex_array()
free_flex_array()
flex_array_put()
flex_array_get()
put() appends an item into the array while get() takes
indexes and does array-style
On Wed, 2009-07-22 at 11:25 +0800, Li Zefan wrote:
+/**
+ * flex_array_put - copy data into the array at @element_nr
+ * @src: address of data to copy into the array
+ * @element_nr:index of the position in which to insert
+ * the new element.
@fa and @flags are
16 matches
Mail list logo