From: Ingo Oeser <ingo.oeser@informatik.tu-chemnitz.de>
To: Riley Williams <Riley@Williams.Name>
Cc: linux-kernel@vger.kernel.org
Subject: Re: try_then_request_module
Date: Tue, 20 May 2003 09:39:33 +0200 [thread overview]
Message-ID: <20030520093933.O659@nightmaster.csn.tu-chemnitz.de> (raw)
In-Reply-To: <BKEGKPICNAKILKJKMHCAOEPLDAAA.Riley@Williams.Name>; from Riley@Williams.Name on Mon, May 19, 2003 at 07:50:02PM +0100
Hi Riley,
On Mon, May 19, 2003 at 07:50:02PM +0100, Riley Williams wrote:
> > int module_loaded_flag=0;
Tell that we don't know, whether the module is loaded
> > retry_with_module_loaded:
> >
> > /* search code */
Do the search.
> > if (!module_loaded_flag && !found) {
Test, whether we did not yet explicitly load the module and not
found the entry either.
> > module_loaded_flag=1;
Tell that we loaded it (if we cannot load it, then we fall
through).
> > if (!request_module(bla))
> > goto retry_with_module_loaded;
Restart search after successful module load.
> > }
> > return found;
> Out of curiosity, what exactly is the purpose of the goto in the
> above code? Since we set module_loaded_flag just prior to it, the
> first if statement must fail after the goto, so we just fall down
> to where we would have been without the goto.
That is intended. I just reuse the search code here instead of
duplicating it.
Since I load the module to broaden my search range, I can also
try to load the module there. Without module support this goto
will never execute and most of that code there compiled away.
That's why I consider try_then_request_module() not needed.
But people seem to have big problems with using gotos and still
reading the code (although it's quite common in the kernel), so
try_then_request_module() might solve this *social* problem ;-)
Regards
Ingo Oeser
next prev parent reply other threads:[~2003-05-20 11:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-19 1:41 try_then_request_module Rusty Russell
2003-05-19 9:08 ` try_then_request_module Ingo Oeser
2003-05-19 18:50 ` try_then_request_module Riley Williams
2003-05-20 7:39 ` Ingo Oeser [this message]
2003-05-21 23:18 ` try_then_request_module Riley Williams
2003-05-20 0:19 ` try_then_request_module Rusty Russell
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=20030520093933.O659@nightmaster.csn.tu-chemnitz.de \
--to=ingo.oeser@informatik.tu-chemnitz.de \
--cc=Riley@Williams.Name \
--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
all inboxes | Powered by JetHome®