From owner-freebsd-hackers Fri Jul 20 2:17:13 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 2CA5F37B405 for ; Fri, 20 Jul 2001 02:17:10 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from hornet.unixfreak.org (hornet [63.198.170.140]) by bazooka.unixfreak.org (Postfix) with ESMTP id C3FD93E31 for ; Fri, 20 Jul 2001 02:17:09 -0700 (PDT) To: hackers@freebsd.org Subject: Proper way for *config(8) to load corresponding modules Date: Fri, 20 Jul 2001 02:17:09 -0700 From: Dima Dorfman Message-Id: <20010720091709.C3FD93E31@bazooka.unixfreak.org> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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