From: Dave Hansen <dave@linux.vnet.ibm.com>
To: Oren Laadan <orenl@cs.columbia.edu>
Cc: akpm@linux-foundation.org, vda.linux@googlemail.com,
containers@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, menage@google.com
Subject: Re: [RFC][PATCH] flexible array implementation v3
Date: Thu, 23 Jul 2009 09:02:17 -0700 [thread overview]
Message-ID: <1248364937.24021.725.camel@nimitz> (raw)
In-Reply-To: <4A68855C.1060702@cs.columbia.edu>
On Thu, 2009-07-23 at 11:44 -0400, Oren Laadan wrote:
> Probably premature, but -- I wonder if it's worth adding interfaces to:
>
> * copy a range of elements at once (perhaps to/from regular array ?
> or userspace ? -- depending on potential users)
I can see this making some sense, especially if you're dumping a bunch
of stuff out to userspace and don't want to worry about page boundaries,
etc... Or, if you have a ton of stuff to copy and some of the
flex_array overhead is getting in the way. I'm not opposed to it, but I
think I'd want to see a user first to make sure I got the implementation
right.
> * (macro ?) iterate through elements (better have it ready for users
> of flex_array before, than convert their code later on)
I've thought about this, but I don't think there's much advantage to
doing it. It obfuscates things without any real gain in simplicity. We
have LIST_FOR_EACH() because containerof() and some of the typing is a
little non-obvious. But, here, I think it's mostly dummy-proof:
We need a 'tmp' variable here because unlike list traversal, there's no
position implied in the variables. So, we're looking at (with a new
macro):
int tmp;
FA_FOR_EACH(fa, var, tmp)
foo(var);
vs.
int i;
for (i = 0; i < fa->total_nr_elements; i++)
foo(flex_array_get(fa, i));
The macro *looks* cleaner, but I don't think it really buys us much.
-- Dave
prev parent reply other threads:[~2009-07-23 16:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-22 17:53 [RFC][PATCH] flexible array implementation v3 Dave Hansen
2009-07-23 1:44 ` KAMEZAWA Hiroyuki
2009-07-23 14:05 ` Dave Hansen
2009-07-23 14:48 ` KAMEZAWA Hiroyuki
2009-07-23 15:44 ` Oren Laadan
2009-07-23 16:02 ` Dave Hansen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1248364937.24021.725.camel@nimitz \
--to=dave@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=containers@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
--cc=orenl@cs.columbia.edu \
--cc=vda.linux@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox