[haiku-development] Writing Device Drivers - CRAM - Problem uninit_driver()

  • From: Earl Pottinger <earl_colby_pottinger@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 19 Aug 2011 19:41:25 -0700 (PDT)

One minor problem with my driver is flushing the contents of the RAMDISK to 
storage.  Presently, I solve problem by calling my flush() every three seconds 
or so.
What I really want to do is to flush the contents when the driver is 
unloaded/shutdown.  The uninit_driver() should serve this purpose, but in my 
tests this call is taken least than 1-in-20 times whenever I select Haiku's 
shutdown command.This causes a problem because while the BFS ioctl() passes my 
code a flush request, some writes() will occur that flush request.  If I do not 
force a flush() after those final writes() the resulting drive image is not a 
valid one or is missing the last files written to it when I reboot and reload 
the resulting drive image to memory.
Any suggestions in how to insure uninit_driver() is always called after 
Haiku-OS starts a shutdown?

Other related posts: