From owner-freebsd-current@FreeBSD.ORG Wed Apr 20 16:12:24 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 618) id E731E16A4E7; Wed, 20 Apr 2005 16:12:22 +0000 (GMT) In-Reply-To: <20050420023351.C421@xorpc.icir.org> from Luigi Rizzo at "Apr 20, 2005 02:33:51 am" To: rizzo@icir.org (Luigi Rizzo) Date: Wed, 20 Apr 2005 16:12:22 +0000 (GMT) X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20050420161222.E731E16A4E7@hub.freebsd.org> From: wpaul@FreeBSD.ORG (Bill Paul) cc: freebsd-current@freebsd.org Subject: Re: New driver loading scheme for Project Evil, need input X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2005 16:12:25 -0000 > On Wed, Apr 20, 2005 at 05:22:40AM +0000, Bill Paul wrote: > ... > > > What about if you want to use >1 NDIS driver? How will it avoid symbol name > > > collisions? > > i don't understand the issue of name collisions though. > Assuming that things work in the same way as dlopen() > (which seems to be the case according to the documentation) > the symbols in the module that we kldload are not globally > visible, but keyed by fileid and only accessible through > kldsym(). So the collisions are only in the filenames that > we kldload, not in the individual symbols. > Then it suffices to rename the patched files... > > cheers > luigi Part of the module build mechanism turns all symbols within a .ko static, so they aren't visible to other modules unless they have an explicit dependency (MODULE_DEPENDS()). For this case, it happens that all of windrv_stub.c's code and data are declared static anyway, so multiple foo_sys.ko modules can't collide with each other. The only thing that is a problem is using MODULE_VERSION(foo, 1). The kernel will complain if you try to load a module of type "foo,1" when there's already a "foo,1" module present. This prevents you from confusing the kernel by doing: # kldload ./foo.ko # cp foo.ko bar.ko # kldload ./bar.ko If foo.c has MODULE_VERSION(foo, 1) in it, then the kernel will know that bar.ko is just another copy of foo.ko even though the file name is different. -Bill -- ============================================================================= -Bill Paul (510) 749-2329 | Senior Engineer, Master of Unix-Fu wpaul@windriver.com | Wind River Systems ============================================================================= you're just BEGGING to face the moose =============================================================================