From: Tejun Heo <tj@home-tj.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: mochel@osdl.org,
lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC/PATCH] Per-device parameter support (13/16)
Date: Mon, 25 Oct 2004 17:00:46 +0900 [thread overview]
Message-ID: <20041025080046.GC20995@home-tj.org> (raw)
In-Reply-To: <1098683773.8098.43.camel@localhost.localdomain>
On Mon, Oct 25, 2004 at 03:56:13PM +1000, Rusty Russell wrote:
> On Sat, 2004-10-23 at 13:31 +0900, Tejun Heo wrote:
> > +void devparam_module_done(struct module *mod)
> > +{
> > + struct vector *vec = &mod->param_vec;
> > + int i;
> > +
> > + for (i = 0; i < vector_len(vec); i++) {
> > + char **param = vector_elem(vec, i, 0);
> > + if (param[0])
> > + printk(KERN_ERR
> > + "Device params: Unknown parameter `%s'\n",
> > + param[0]);
> > + }
> > +
> > + vector_destroy(vec);
> > +}
>
> That seems a strange place to warn... Is that right?
Yes, it's right. Because a module may contain more than one drivers,
devparam puts all paramters into an array and mask them off with NULL
when they are taken and, after module initialization is done, above
devparam_module_done() is called and prints warnings about untaken
paramters. The same approach is used for boot options too.
> > +
> > + /* Module parameter vector, used by deviceparam */
> > + struct vector param_vec;
>
> I don't mind the addition of your vector type, but adding infrastructure
> always results in arguments. Can you think of another place which needs
> it?
I just find dynamically expandable arrays very useful when I code
stuff. Expanding/shrinking in the middle is maybe unnecessary but in
general, a vector w/ constructor/destructor is handy. I cannot
pinpoint any specific code right now but I am pretty positive that
there are many places where unncessary fixed limit is employed to
avoid dynamic array management (not that fixed limit is always bad but
it's better to avoid them when possible without much overhead).
If getting the vector in is difficult, I can merge vector codes into
devparam or change devparam to use list instead. No problem there.
But I think that having generic vector around isn't a bad idea. I'll
try to find places where vector can be useful if I can find some time.
Thanks.
--
tejun
next prev parent reply other threads:[~2004-10-25 8:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-23 4:31 [RFC/PATCH] Per-device parameter support (13/16) Tejun Heo
2004-10-25 5:04 ` Rusty Russell
2004-10-25 5:56 ` Rusty Russell
2004-10-25 8:00 ` Tejun Heo [this message]
2004-10-25 6:08 ` Rusty Russell
2004-10-25 8:28 ` Tejun Heo
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=20041025080046.GC20995@home-tj.org \
--to=tj@home-tj.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@osdl.org \
--cc=rusty@rustcorp.com.au \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.