> From: "Peter T. Breuer" <ptb@it.uc3m.es>
> Date: Sun, 7 May 2000 20:00:04 +0200 (MET DST)
> Subject: OO missing in task queues and modules
>
> The task queue and module interfaces are not sufficiently object
> oriented (discussion bait). Feel free to tell me if that's not so.
> Then I won't have to make the following hacks.
I don't think there is any point in going for object orientation INSIDE the
kernel. The overhead required is too much.
>
> I would like to
>
> 1) make
> init(struct module *this)
> the type of the module init functions. They currently are of type
> init(void).
A module is not a class, its a collection of a procedures. You cannot
have 'instances' of modules.
THIS_MODULE macro gives you pointer to struct module * for 'this' module
> I've encountered this need while writing a module that removes itself
> using the tq_timer queue to schedule its removal. The easiest solution
> is for its init function to schedule free-module(this,0). But it needs
> a pointer to the module struct. If I use the module name instead and
> schedule delete_module(this_kernelspace_name), I still have to get hold
> of the name. Easiest way to do that is to look at this->name. I can't
> hard code it since the user may change it.
You can get pointer to module struct from THIS_MODULE but calling delete_module
from itself is wrong. You can call delete_module function and place
return address as sys_exit. You can insert a parameter to sys_exit on stack if
needed.
-- Amit Kale Veritas Software ( http://www.veritas.com )- 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.tux.org/lkml/
This archive was generated by hypermail 2b29 : Mon May 15 2000 - 21:00:11 EST