Date: Fri, 20 Jul 2001 02:17:09 -0700 From: Dima Dorfman <dima@unixfreak.org> To: hackers@freebsd.org Subject: Proper way for *config(8) to load corresponding modules Message-ID: <20010720091709.C3FD93E31@bazooka.unixfreak.org>
next in thread | raw e-mail | index | archive | help
Most *config(8) programs, such as ifconfig(8), mdconfig(8), and ccdconfig(8), attempt to load their corresponding module if it isn't already loaded, or already compiled into the kernel. Looking at these programs, they achieve this task in (primarily) two different ways. The first uses modfind() then kldload() (e.g., see ccdconfig.c r1.19 l174). Others use a combination of kldnext(), modfnext(), and some loops to do this (e.g., see ifconfig.c r1.64 l1911). Is there any difference between these two, and which one is preferred (I'd think the former if there is no difference). It would be nice if they all did the same thing. Once it's determined which method is preferred, I'd like to propose a kldmaybeload(3) routine that takes a module name and loads it if it's not already loaded or compiled in. For now this just factors out some common code, but it may save headaches later if the kld interface is changed so that neither of these methods work without modification (with a kldmaybeload, it'd be sufficient just to modify the library function). Thanks for any insight. Dima Dorfman To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010720091709.C3FD93E31>