On 25/06/2015 19:56, Programmingkid wrote:
>> In fact, programmingkid, you should fix it in hdev_open() where
>> there is already a #if __APPLE__ .
>
> Nice to hear from you again Laurent. The only way a solution in
> hdev_open() would work is if it could prevent find_image_format()
> from executing. Otherwise find_image_format() would just quit QEMU
> with an error.
You have to implement an is_inserted function like this one that is
already there for FreeBSD:
static int cdrom_is_inserted(BlockDriverState *bs)
{
return raw_getlength(bs) > 0;
}
The point you're changing is _already_ testing bdrv_is_inserted.
Look at the block starting like this:
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
static int cdrom_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
and create a similar one that is #ifdef __APPLE__. Feel free to remove
pieces that you don't know how to do in OS X / CoreFoundation.
Paolo