[plug] Object Oriented Kernels?

Campbell, David (Ex AS17) david.j.campbell at honeywell.com
Wed Oct 4 13:11:00 WST 2000


> The Thought Assassin wrote:
> > > The Linux kernel is an example of OO code written in C.
> > That's a curious statement. What examples can you give of object
> oriented
> > code in the kernel? Examples of inheritance and encapsulation would be
> > welcome.
> As an example of encapsulation, look at the VFS stuff. Each filesystem
> driver is effectively a class which implements (registering an array of
> functions) a particular interface with all of the usual filesystem calls.

SCSI does pretty much the same, use a C structure with the slots
for the driver interface call. The data entry will either point to standard
routines (such as "not-supported") or those provided by the driver.

I don't have the kernel code around but in practice it looks awfully like
C++ without the class junk.

David Campbell





More information about the plug mailing list