Two Drivers In A Single Loadable Module

Including two drivers in a single loadable module is not supported.

However, it can be done in a non-compliant way by making three loadable modules.

Put all the driver code in one common module and write two small wrapper modules for each driver. The small wrappers need _init, _fini, _info, dev_ops/cb_ops structures for the driver and a line so the two small driver wrappers depend on the main module and get linked with its symbols.


Each mini-driver stub should include: char _depends_on[] = "misc/foo"; where "misc/foo" is the name of the common code module.

The common module would be a "misc." module, with it's own _init, _fini and _info functions. The module ops would be of the "misc" type using a modlmisc structure (look this up in >sys/modctl.h<).

The underlying driver just includes the common shared code.

The mini-driver stubs each have their own separate dev_ops structures and can be made unloadable. The misc module with the common driver code will be automatically held via the driver stub modules depending on them.

Note that this method, and using modlmisc, are not DDI-compliant, and so may not work in future releases of Solaris.

Source: http://developers.sun.com/solaris/developer/support/driver/faqs.html#QA4.11

Stumble
Delicious
Technorati
Twitter
Facebook

Bookmark and Share

0 comments

Post a Comment