Date: Wed, 22 May 2002 02:23:50 +0100 From: Brian Somers <brian@Awfulhak.org> To: Peter Wemm <peter@wemm.org> Cc: Brian Somers <brian@Awfulhak.org>, John Baldwin <jhb@FreeBSD.org>, cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Makoto Matsushita <matusita@jp.FreeBSD.org> Subject: Re: cvs commit: src/sys/i386/i386 userconfig.c Message-ID: <200205220123.g4M1No4m005723@hak.lan.Awfulhak.org> In-Reply-To: Message from Peter Wemm <peter@wemm.org> of "Tue, 21 May 2002 16:49:02 PDT." <20020521234902.DA22F380A@overcee.wemm.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> Brian Somers wrote:
> > > On 21-May-2002 Brian Somers wrote:
> > > >>
> > > >> jhb> Compile in the 'intro' command if VISUAL_USERCONFIG is
> > > >> jhb> specified not just for INTRO_USERCONFIG. This allows a
> > > >> jhb> userconfig script to use the 'intro' command to bring up the
> > > >> jhb> introduction kernel config screen which cdboot ISO's use.
> > > >>
> > > >> Wonderful!
> > > >>
> > > >> jhb> The only downside for a cdboot ISO now is that when you boot up
> > > >> jhb> you get bogus error messages from kldloading the drivers in the
> > > >> jhb> mfsroot since the kernel modules are already present in GENERIC.
> > > >>
> > > >> I'm also same problem in my mind. Perhaps we can steal some codes
> > > >> (or logics) from ifmaybeload() at src/usr.sbin/ifconfig/ifconfig.c.
> > > >
> > > > Or perhaps src/usr.sbin/ppp/defs.c:loadmodules().
> > >
> > > Maybe we need a generic function in libutil then to avoid duplicating
> > > this code.
> >
> > The problem is that the code would read something like:
> >
> > int
> > loadmodule(const char *module)
> > {
> > if (modfind(module) == -1)
> > return (kldload(module));
> > return (0);
> > }
>
> This is actually inadequate. If you are looking for a specfic module, there
> is no guarantee that it is in the file that you load. You really need to check
> that the file load works and it yieled the correct module.
>
> eg:
> if (modfind("ccd") < 0) {
> /* Not present in kernel, try loading it */
> if (kldload("ccd") < 0 || modfind("ccd") < 0)
> warn("ccd module not available!");
> }
>
> Specifically, the second modfind() afterwards is necessary.
Yes, until there's a proper way of turning module names into file
names, this is probably the best we can do.
A different error would be appropriate if the second modfind() fails,
but still, I think it's pushing it a bit to put something like this
in libutil.
> Cheers,
> -Peter
> --
> Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com
> "All of this is for nothing if we don't go to the stars" - JMS/B5
--
Brian <brian@Awfulhak.org> <brian@freebsd-services.com>
<http://www.Awfulhak.org> <brian@[uk.]FreeBSD.org>
Don't _EVER_ lose your sense of humour ! <brian@[uk.]OpenBSD.org>
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205220123.g4M1No4m005723>
