Re: VFS: C99 sparse format for struct vfsops

From: Doug Rabson <dfr_at_nlsystems.com>
Date: 05 Jun 2003 16:06:16 +0100
On Thu, 2003-06-05 at 15:51, Paul Richards wrote:
> On Wed, Jun 04, 2003 at 02:43:20PM +0100, Doug Rabson wrote:
> > On Wed, 2003-06-04 at 14:16, Paul Richards wrote:
> > > On Wed, Jun 04, 2003 at 01:33:46PM +0100, Doug Rabson wrote:
> > > 
> > > > Interfaces actually can be added at runtime. Existing objects (i.e.
> > > > objects instantiated before the new interface was added) will continue
> > > > to work as before. If methods from the new interface are called on old
> > > > objects, the default method will be called.
> > > 
> > > How can you add an interface at runtime?
> > 
> > By loading a kernel module. If I load e.g. the agp kernel module, I add
> > the agp_if interface to the kernel.
> 
> Yes, I know that you can load a pre-compiled interface at runtime
> and thereby add that interface, but you can only "create" interfaces
> at build time because each method in the interface is uniquely
> identified by a kobjop_desc struct, which is what I was referring to.

What has build time got to do with anything? At build time, you have no
idea what interfaces are available either. Besides modules can be built
at a different time from the rest of the kernel.

> 
> > The code which is doing the method dispatch has no real idea what
> > methods (or what interfaces for that matter) that the object's class
> > implements. You can't use the classes method table layout for the ops
> > table since the caller has no way of knowing that layout (and the layout
> > will be different for almost every class in the system).
> > 
> > One possible way of making this slightly simpler might be to make the
> > class point at a table indexed by interface ID, each entry of which is a
> > table indexed by a method ID from that interface. This sounds fine in
> > theory but in practice, it would end up slower due to the two memory
> > accesses.
> 
> That's along the lines of what I suggested at the start of the thread :-)

Its still slower and wastes more memory and bloats the code for every
call site. I have a better approach in mind which I will be trying out
soonish.
Received on Thu Jun 05 2003 - 06:07:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:10 UTC