[openbeos] Re: driver/module shutdown notification for R1
- From: Eike Dehling <e.e.dehling@xxxxxxxxxxxxxxxxxx>
- To: openbeos@xxxxxxxxxxxxx
- Date: Sat, 14 Jun 2003 15:27:02 +0200
Waldemar Kornewald wrote:
Actually, this should be no problem.
We add the ioctl and std_ops action B_UNLOAD_ON_SHUTDOWN.
When the system is shut down the kernel calls
if(ioctl(fd,B_UNLOAD_ON_SHUTDOWN...) == B_OK)
unload_driver(fd);
and
if(module->std_ops(B_UNLOAD_ON_SHUTDOWN) == B_OK)
unload_module(module);
for each module and driver that is loaded.
Drivers/modules that do not support this automatically return B_ERROR or
something like that.
The same goes for drivers/modules that do not need this behaviour. They
just
do not implement it and the switch-case part in the driver will fall
through
and return B_ERROR.
Why should we need an additional call for driver/modules if we can use
the
current API without any problems?
The advantage is that old drivers will still work and can be adapted
without
much work (just add a new "case" statement).
Waldemar
Isn't the 'uninit_driver()' function meant for this purpose? The BeBook
says it's called when unloading the driver ...
Good point. :))
Still, how do modules know that the system is shutting down?
This was actually the source of my problem. PPP is a module in BONE (and
will be a module in OBOS, too). The PPP module must disconnect before the
system is shut down.
I could write some application for that task and execute it in the shutdown
script, but when we go embedded (OBIA ;) it will be better to have this in
the kernel itself. And it is better not to rely upon scripts for jobs that
could be done automatically. This would be the next step to a terrible
Linux-I-script-everything-please-edit-me-with-a-text-editor-super-duper-comp
licated-world! ;)
Waldemar
When the kernel calls this function for all drivers before shutting
down, it should work. I would expect it already does this, does it ? Or
do i miss something ?
Eike.
- References:
- [openbeos] driver/module shutdown notification for R1
- From: Waldemar Kornewald
- [openbeos] Re: driver/module shutdown notification for R1
- From: François Revol
- [openbeos] Re: driver/module shutdown notification for R1
- From: Waldemar Kornewald
- [openbeos] Re: driver/module shutdown notification for R1
- From: Eike Dehling
- [openbeos] Re: driver/module shutdown notification for R1
- From: Waldemar Kornewald
Other related posts:
- » [openbeos] driver/module shutdown notification for R1
- » [openbeos] Re: driver/module shutdown notification for R1
- » [openbeos] Re: driver/module shutdown notification for R1
- » [openbeos] Re: driver/module shutdown notification for R1
- » [openbeos] Re: driver/module shutdown notification for R1
- » [openbeos] Re: driver/module shutdown notification for R1
- » [openbeos] Re: driver/module shutdown notification for R1
- » [openbeos] Re: driver/module shutdown notification for R1
- » [openbeos] Re: driver/module shutdown notification for R1
- » [openbeos] Re: driver/module shutdown notification for R1
- » [openbeos] Re: driver/module shutdown notification for R1
- » [openbeos] Re: driver/module shutdown notification for R1
- » [openbeos] Re: driver/module shutdown notification for R1
- » [openbeos] Re: driver/module shutdown notification for R1
- » [openbeos] Re: driver/module shutdown notification for R1
justActually, this should be no problem. We add the ioctl and std_ops action B_UNLOAD_ON_SHUTDOWN. When the system is shut down the kernel calls
if(ioctl(fd,B_UNLOAD_ON_SHUTDOWN...) == B_OK) unload_driver(fd);
and
if(module->std_ops(B_UNLOAD_ON_SHUTDOWN) == B_OK) unload_module(module);
for each module and driver that is loaded.
Drivers/modules that do not support this automatically return B_ERROR or
something like that.
The same goes for drivers/modules that do not need this behaviour. They
throughdo not implement it and the switch-case part in the driver will fall
theand return B_ERROR.
Why should we need an additional call for driver/modules if we can use
withoutcurrent API without any problems?
The advantage is that old drivers will still work and can be adapted
much work (just add a new "case" statement).Isn't the 'uninit_driver()' function meant for this purpose? The BeBook
Waldemar
says it's called when unloading the driver ...
Good point. :))
Still, how do modules know that the system is shutting down? This was actually the source of my problem. PPP is a module in BONE (and will be a module in OBOS, too). The PPP module must disconnect before the system is shut down. I could write some application for that task and execute it in the shutdown script, but when we go embedded (OBIA ;) it will be better to have this in the kernel itself. And it is better not to rely upon scripts for jobs that could be done automatically. This would be the next step to a terrible Linux-I-script-everything-please-edit-me-with-a-text-editor-super-duper-comp licated-world! ;)
Waldemar
- [openbeos] driver/module shutdown notification for R1
- From: Waldemar Kornewald
- [openbeos] Re: driver/module shutdown notification for R1
- From: François Revol
- [openbeos] Re: driver/module shutdown notification for R1
- From: Waldemar Kornewald
- [openbeos] Re: driver/module shutdown notification for R1
- From: Eike Dehling
- [openbeos] Re: driver/module shutdown notification for R1
- From: Waldemar Kornewald