public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Daniel Mierswa <impulze@impulze.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] Re: Parsing kernel parameters and escaping "
Date: Tue, 14 Jul 2009 12:19:29 +0930	[thread overview]
Message-ID: <200907141219.30772.rusty@rustcorp.com.au> (raw)
In-Reply-To: <4A5AA0AD.2030502@impulze.org>

On Mon, 13 Jul 2009 12:19:17 pm Daniel Mierswa wrote:
> Rusty Russell wrote:
> > It might be nice to have that test code somewhere at the bottom of
> > param.c, at least while we're playing with the code.
>
> Umm, I'm not sure where test-code is supposed to go in kernel code.
> Should it be a main() function, a test() function, just a comment, could
> you elaborate? All i did now was to build a small program that reads
> argv[1] and uses next_arg just like parse_args() in params.c does.

Usually I write a function like:

#if 0
static int param_result(char *param, char *val)
{
	static int expect;
	const char *params[] = { "foo", "foo", ... };
	const char *vals[] = "bar", NULL, ...};

	BUG_ON(strcmp(param,params[expect]) != 0);
	if (vals[expect] == NULL)
		BUGON(val);
	else
		BUGON(strcmp(val, vals[expect]) != 0);
}

static int test_params(void)
{
	char *str = kstrdup("foo=bar foo ...", GFP_KERNEL);
	parse_args("test", str, NULL, 0, param_result);
	return 0;
}
module_init(test_params);
#endif

> > Thanks!
>
> Ditto.

Thanks for all the work!
Rusty.

      reply	other threads:[~2009-07-14  2:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-05 13:54 Parsing kernel parameters and escaping " Daniel Mierswa
2009-07-06 23:03 ` [RFC] " Daniel Mierswa
2009-07-06 23:05   ` Daniel Mierswa
2009-07-07  0:54   ` Daniel Mierswa
2009-07-12  9:41     ` Rusty Russell
2009-07-12 17:59       ` Daniel Mierswa
2009-07-12 23:57         ` Rusty Russell
2009-07-13  2:49           ` Daniel Mierswa
2009-07-14  2:49             ` Rusty Russell [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=200907141219.30772.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=impulze@impulze.org \
    --cc=linux-kernel@vger.kernel.org \
    /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