Add ioctl_tree library

This provides a more efficient and flexible format than a simple list of
ioctls, and is also less invasive to extend with more ioctls.