Rebase on top of linux trunk.  This also brings some common code into
the .h file.  Also address issues brought up in last attempt for pull
request (README fix)