[haiku-development] Re: Writing Device Drivers Publishing notes

  • From: Earl Pottinger <earl_colby_pottinger@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 15 May 2011 15:48:45 -0700 (PDT)

Thanks for the help so far, I would like to clear up some points because I am a 
little confused about how I should contine my development.
First, what I am trying to write is a driver for a Compressing Ram Drive that 
also writes out it's contents to one or more storage units so that it can 
recover itself after a reboot.  Since the drive's data can also compress in 
memory the data written to it.  The ram drive's parameters can be set to a 
larger value than the true available memory.  This write-back function allows 
two more features to be added to the ramdrive.
(1) Using a simple virtual memory model it allows me to set the size of the 
drive larger than the memory in the computer would normally allow.  In this 
sense it looks like a hard drive with a large cache.  But what it does does 
better than said hard drive is when you reboot what is quickly loaded in ram is 
the data tracks that you had been using.  This helps the ram drive continue to 
have better performance than a hard drive on the same machine.
(2) Raid-???  A poor man's raid, not for data protection but for combining the 
storage across a number of storage units.  For example: I have a number of 80 
GB drives, I can easily setup the driver to combine 40GB off my boot drive and 
three other 80GB drives to look like a single 280GB drive even without 
compression enabled.
So here are my questions:
In testing the code I am getting diffirent error results depending if I test 
with Alpha1, Alpha2 or the latest nightly release (presently using 
r41339-x86gcc2hybrid).  Should I drop working with the Alphas?  And which 
nightly should I be using to best match Alpha3?
Part of my problems appear to be caused by Haiku Disk Caching software, how do 
I mark a HaikuFS formatted drive to not be cached when it is written to?
Part of my problems seem to be caused but delays generated by my driver as it 
reads and writes large blocks data to/from storage.  Is there a max latency 
that Haiku's kernel needs?  Should I turn off interrupts while read/writting 
data tracks?
A possible but unlikely possibility is HaikuFS issuing additional read/writes 
to the driver before the previous one is done, does HaikuFS honor the 
block/non-blocking IO flags?  If not, I can add my own blocking code to the 
read/write hooks but I would like to avoid adding any code that will slow the 
drive down if possible.
Malloc() vs Create_Area() which is better for creating a few very large (64MB - 
1.5GB) buffers?
Where, oh where should I post/upload my test drivers for other developers to 
see?  I am ready to upload my simple drivers that I know work ok to Haikuware 
but I am not sure that is the right place to upload the debugging versions as 
they can not be consider stable or for general usage.
If I do upload them to Haikuware, is adding the string 'DEBUGGING VERSION' and 
posting warnings in large read letters in the read-me file enough?

Sorry for all the questions, the code is about 80% done and now that I am 
coming to the really hard parts I don't want to waste time and effort on the 
wrong things.

Other related posts: