Messages in this thread | | | Subject | Re: 2.1.118 Tons of oopes | Date | Sun, 30 Aug 1998 00:23:07 -0700 | From | "Gregory P. Smith" <> |
| |
> > > Before I get into the part about the flames, I have a suggestion: how > > > about we start using the GCC intialiser extensions? In other words, if > > > I have a "xyz" driver, I do this: > > >=20 > > > struct file_operations xyz_fops =3D { > > > open:xyz_open, > > > read:xyz_read, > > > write:xyz_write, > > > }; > > >=20 ... > > > > IMNSHO, the whole usage of NULL silly. Is there a good reason why > > we're not simply a pointer pointing to a routine implementing the > > default action? (Does nothing if empty?) That way we wouldn't have > > to have a null pointer check on every call... > > Yes, I can see the benefit of avoiding the NULL check. It would be > nice to be able to do this. However, that would then require every > driver to be updated on every addition of a new VFS method. ... > However, if there was some compiler trickery we could employ such that > a VFS change doesn't require source code to be touched, it would be a > good idea. Being able to strip those method existence tests would make > code a bit more readable and would also save a few cycles. But I don't > see how to do it without making drivers not distributed with the > kernel much harder to maintain.
Doing some brainstorming:
How about defining a varargs function that takes as parameters pointers to the VFS methods in a permanently defined order. This way future methods could be added to the end and for drivers not using them the function could fill them in with the default action pointer. The drawback is that this would need to be done in an initialization function.
A way to do the above in a C macro so it could happen as a structure declaration not in a function would be nice. However, macros can't have variable numbers of arguments. Anyone know of any good hacks to simulate that?
I don't really like the above option, ideas?
Greg
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html
| |