Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 08 Apr 2001 18:18:24 -0600
From:      "Justin T. Gibbs" <gibbs@scsiguy.com>
To:        arch@FreeBSD.org
Subject:   Inheritance in new-bus
Message-ID:  <200104090018.f390IOs04689@aslan.scsiguy.com>

next in thread | raw e-mail | index | archive | help
I decided to play around with this again.  So far I have a system
that allows inheritance of "interfaces" in new-bus.  This means that
cardbus, for instance, can inherit bus, device and pci interfaces
from the PCI code, and CIS parsing fuctions from pccard.  Each
kobject has an array of interfaces.  Each interface includes a parent
interface pointer.  To subscribe to an interface, a kobject need only
list the interface in its list of interfaces.  To override methods of
an interface, a new interface is defined with a list of methods and
a pointer to the parent interface.  A "root" interface uses
"null_interface" as its parent.  The upshot of this is that, so
long as a sub-interface does not need to explicitly call the parent
interface's implementation of method as part of its own implementation
of the method, there is no need to know anything about the parents
implementation.  The hierarchy of methods also removes the need for
the defop method in a method description - the root interface is
the default.

I'd like to be able to opaquely call the "parent" implementation of
method from a method override, but I haven't found a scheme I'm
totally happy with.  The best I have so far would require KOBJMETHOD
declarations outside of the method array so each method within a file can
be referenced by symbol name.  The method array would then become
an array of pointers to methods.  The perl scripts would then be
responsible for making macros to do the appropriate casting to
call the parent method stored in the method descripter.  The parent
would be filled in during class compilation.

Patches sufficient to get my laptop to run can be found here:

http://people.FreeBSD.org/~gibbs/newbus_pci_cardbus.diffs

Some of the changes can be simplified as some interface users
do not perform overrides and I neglected to just reference the
interface directly.  There are also lots of pieces of code that
might benefit from a rewrite to make use of this new feature.

Comments?

--
Justin

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104090018.f390IOs04689>