From owner-freebsd-arch Sun Apr 8 17:18:28 2001 Delivered-To: freebsd-arch@freebsd.org Received: from aslan.scsiguy.com (aslan.scsiguy.com [63.229.232.106]) by hub.freebsd.org (Postfix) with ESMTP id 6BB0D37B422 for ; Sun, 8 Apr 2001 17:18:25 -0700 (PDT) (envelope-from gibbs@scsiguy.com) Received: from scsiguy.com (localhost [127.0.0.1]) by aslan.scsiguy.com (8.11.2/8.9.3) with ESMTP id f390IOs04689 for ; Sun, 8 Apr 2001 18:18:25 -0600 (MDT) (envelope-from gibbs@scsiguy.com) Message-Id: <200104090018.f390IOs04689@aslan.scsiguy.com> To: arch@FreeBSD.org Subject: Inheritance in new-bus Date: Sun, 08 Apr 2001 18:18:24 -0600 From: "Justin T. Gibbs" Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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