This factors common code from mount, cmount and mount2 into mountlib. It also uses atexit for unregistering the mount.