From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8BT7-0004OP-4s for qemu-devel@nongnu.org; Thu, 25 Jun 2015 14:01:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z8BT6-0005fb-42 for qemu-devel@nongnu.org; Thu, 25 Jun 2015 14:01:45 -0400 Message-ID: <558C41FB.30705@redhat.com> Date: Thu, 25 Jun 2015 20:01:31 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <3B3C7431-1003-4AAA-90AF-0E1A154DFBE2@gmail.com> <5589A026.5020800@redhat.com> <455CF92B-58FA-446D-9EB0-42661C23B739@gmail.com> <87pp4kxos3.fsf@blackfin.pond.sub.org> <7B989F99-B95C-4D53-AA2D-29B87634D2BB@gmail.com> <558C22BD.1020404@redhat.com> <558C2852.3050102@redhat.com> <47B5E901-9CCD-4737-A5F2-B790EBEF941A@gmail.com> In-Reply-To: <47B5E901-9CCD-4737-A5F2-B790EBEF941A@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] block.c: fix real cdrom detection List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Programmingkid , Laurent Vivier Cc: Kevin Wolf , Peter Maydell , Markus Armbruster , Qemu-block , qemu-devel qemu-devel 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