Prepare to support FreeBSD
Add support for FreeBSD

* Implement the get block info calls differently from Linux (different
  ioctl names)
* Change sed usage to work with BSD sed (more strict)