Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jun 2000 00:59:47 +0100 (BST)
From:      Nick Hibma <n_hibma@calcaphon.com>
To:        Peter Wemm <peter@netplex.com.au>, FreeBSD CURRENT Mailing List <current@FreeBSD.ORG>, Doug Rabson <dfr@calcaphon.com>
Cc:        green@FreeBSD.ORG
Subject:   Using KLD's with modules that depend other modules in the same file
Message-ID:  <Pine.BSF.4.20.0006200045500.31393-200000@localhost>

next in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--0-1810085133-961459187=:31393
Content-Type: TEXT/PLAIN; charset=US-ASCII


When loading modules with other modules in the same linker file,
depending on each other, currently the kernel linker chokes. Example:
the uhub, uhci, ohci and usb modules are (for unrelated reasons) linked
into one big file. It is however impossible currently to preload that
file because the dependencies are not found if MODULE_DEPEND and
MODULE_VERSION are added in appropriate places.

Currently we do the following:

for all linker files
	(A) check dependencies for all modules in linker file
		against found_modules
	if resolves
		(B) add the modules to found_modules

The attached patch changes this to

for all linker files
	(B) create a list of modules in the file (file_modules)
	(A) check dependencies for all modules in linker file
		against found_modules and file_modules
	if resolves
		(C) concatenate file_modules to found_modules

Step A and B are reversed and a copy loop (C) has been added.


As a side effect it is now also possible for modules to depend on
themselves (usb_depend_on_usb):

% nm /modules/usb.ko | grep depend_on
00019bc0 d _uhub_depend_on_usb
00019e88 d _usb_depend_on_usb


Comments?

Nick

P.S.: I am aware of the people involved being at Usenix, so I'll
postpone committing this until they have had time to comment on it.
--
n_hibma@webweaving.org
n_hibma@freebsd.org                                          USB project
http://www.etla.net/~n_hibma/

--0-1810085133-961459187=:31393
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="kern_linker.c.diff"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.BSF.4.20.0006200059470.31393@localhost>
Content-Description: 
Content-Disposition: attachment; filename="kern_linker.c.diff"

SW5kZXg6IGt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wpOw0KLQkgICAgaWYgKG1vZGxpc3Rf
bG9va3VwKG1vZG5hbWUpICE9IE5VTEwpIHsNCisJICAgIGlmIChtb2RsaXN0
X2xvb2t1cCgmZm91bmRfbW9kdWxlcywgbW9kbmFtZSkgIT0gTlVMTCkgew0K
IAkJcHJpbnRmKCJtb2R1bGUgJXMgYWxyZWFkeSBwcmVzZW50IVxuIiwgbW9k
bmFtZSk7DQogCQlyZXR1cm4gRUVYSVNUOw0KIAkgICAgfQ0KQEAgLTEzMzQs
NyArMTM1Niw3IEBADQogCSAgICB9DQogCSAgICBpZiAoaiA8IGRlcHMtPmxz
X2xlbmd0aCkJLyogZWFybHkgZXhpdCwgaXQncyBhIHNlbGYgcmVmZXJlbmNl
ICovDQogCQljb250aW51ZTsNCi0JICAgIG1vZCA9IG1vZGxpc3RfbG9va3Vw
KG1vZG5hbWUpOw0KKwkgICAgbW9kID0gbW9kbGlzdF9sb29rdXAoJmZvdW5k
X21vZHVsZXMsIG1vZG5hbWUpOw0KIAkgICAgaWYgKG1vZCkgewkJLyogd29v
aG9vLCBpdCdzIGxvYWRlZCBhbHJlYWR5ICovDQogCQlsZmRlcCA9IG1vZC0+
Y29udGFpbmVyOw0KIAkJbGZkZXAtPnJlZnMrKzsNCg==
--0-1810085133-961459187=:31393--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.20.0006200045500.31393-200000>