mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Oliver Xymoron <oxymoron@waste.org>
Cc: linux-kernel@vger.kernel.org, kaos@ocs.com.au
Subject: Re: [PATCH] 2.5.1-pre10 #ifdef CONFIG_KMOD Cleanup Part II.
Date: Sat, 15 Dec 2001 12:26:29 +1100	[thread overview]
Message-ID: <E16F3av-0003TC-00@wagner.rustcorp.com.au> (raw)
In-Reply-To: Your message of "Fri, 14 Dec 2001 10:38:17 MDT." <Pine.LNX.4.40.0112141019100.11489-100000@waste.org>

In message <Pine.LNX.4.40.0112141019100.11489-100000@waste.org> you write:
> On Thu, 13 Dec 2001, Rusty Russell wrote:
> 
> > 2) Adds request_module_start()/request_module_end() macros, eg.
> >
> > 	struct protocol protoptr;
> >
> > 	request_module_start("proto-%u", protonum) {
> > 		/* search for protocol, set protoptr. */
> >
> > 	} request_module_end(protoptr != NULL);
> >
> >    This loops once if !CONFIG_KMOD or protoptr != NULL after first
> >    iteration, otherwise calls request_module and loops a second time.
> 
> Clever, but very un-C-like. Perhaps something like this:
> 
> do {
>   /* search for protocol, set protoptr. */
> } while (protoptr != NULL || request_module("proto-%u",protonum)==0);
> 
> ..with request_module returning -EBUSY if the module is already loaded.

This can spin forever 8(.  I would love to have just a
request_module_loop() macro, eg:

	request_module_loop("proto-%u", protonum) {
		...
	}

But it turns out not to be possible without more C 9x compliance
(ie. local variable decls in for () loops).

> > 3) Adds a request_module_unless() macro, eg:
> >
> > 	protoptr = request_module_unless(protoptrs[proto],
> > 					 "proto-%u", protonum);
> 
> Also weird.

Ack.  However, I was looking for positive suggestions 8)

Thanks,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

  reply	other threads:[~2001-12-15  2:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-13  2:18 Rusty Russell
2001-12-14 16:38 ` Oliver Xymoron
2001-12-15  1:26   ` Rusty Russell [this message]
2001-12-15 16:58     ` Oliver Xymoron

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=E16F3av-0003TC-00@wagner.rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=kaos@ocs.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oxymoron@waste.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

all inboxes | Powered by JetHome®