Move attach loop device to its own file
Extract ioctl from wrapper