Date: Sat, 14 Sep 2013 14:09:06 -0400 From: Leonardo Passos <lnrdpss@gmail.com> To: freebsd-drivers@freebsd.org Subject: Device hierarchy Message-ID: <CAO10wb6_AoZ9maGhx326tjZ6-aqvyzVV7rBxfOv%2BLOABixs_cw@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi all, I am checking some code from the FreeBSD repository, and I came across a situation that I could not explain, at least from the existing documentation. Looking at sys/dev/ata/ata-raid.c in the 9.1 release, I see the following module declaration (line 4616): static moduledata_t ata_raid_moduledata = { "ataraid", ata_raid_module_event_handler, NULL }; DECLARE_MODULE(ata, ata_raid_moduledata, SI_SUB_RAID, SI_ORDER_FIRST); MODULE_VERSION(ataraid, 1); MODULE_DEPEND(ataraid, ata, 1, 1, 1); MODULE_DEPEND(ataraid, ad, 1, 1, 1); The name of the module, as specified in DECLARE_MODULE, is ata, but the name provided in the moduledata_t instance is "ataraid". According to the documentation of DECLARE_MODULE, the name field in the structure instance (2nd parameter) is the official module name. So, it is correct to assume that passing "ata" as the first parameter in DECLARE_MODULE is an error, as it does not match "ataraid", or is it the case that such name is a "don't care" field, as FreeBSD takes the name as given by the moduledata_t instance? Another weird situation appears in sys/dev/ata-isa.c (line 201): static driver_t ata_isa_driver = { "ata", ata_isa_methods, sizeof(struct ata_channel), }; DRIVER_MODULE(ata, isa, ata_isa_driver, ata_devclass, 0, 0); MODULE_DEPEND(ata, ata, 1, 1, 1); Here, the driver module name is set to "ata", and later, it is stated that ata depends on ata. Is the dependency referring to another ata module, at a different level in the driver stacking? How are these names and dependencies resolved? Thanks, Leonardo.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAO10wb6_AoZ9maGhx326tjZ6-aqvyzVV7rBxfOv%2BLOABixs_cw>