From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzoWL-0001Xk-8E for qemu-devel@nongnu.org; Fri, 20 Nov 2015 11:26:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzoWK-0000vC-5v for qemu-devel@nongnu.org; Fri, 20 Nov 2015 11:26:45 -0500 Date: Fri, 20 Nov 2015 17:26:33 +0100 From: Kevin Wolf Message-ID: <20151120162633.GE4130@noname.redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v5] raw-posix.c: Make physical devices usable in QEMU under Mac OS X host List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Programmingkid Cc: Stefan Hajnoczi , qemu-devel qemu-devel , Qemu-block Am 27.07.2015 um 19:05 hat Programmingkid geschrieben: > Mac OS X can be picky when it comes to allowing the user to use physical > devices > in QEMU. Most mounted volumes appear to be off limits to QEMU. If an issue is > detected, a message is displayed showing the user how to unmount a volume. > > Signed-off-by: John Arbuckle > > --- > Removed changes to GetBSDPath() to a separate patch. > This patch now depends on the GetBSDPath patch. Unfortunately, this patch was sent as HTML, so git am doesn't accept it. I tried to manually get something working out of it, but I failed. Possibly there are actual merge conflicts, too (even going back to master@{2015-07-27}), but in any case I couldn't apply this. Can you please rebase and send as a plain text patch that applies to current master? > @@ -2156,7 +2180,21 @@ static int hdev_open(BlockDriverState *bs, QDict > *options, int flags, > if (local_err) { > error_propagate(errp, local_err); > } > - return ret; > + } > + > +#if defined(__APPLE__) && defined(__MACH__) > + /* if a physical device experienced an error while being opened */ > + if (strncmp(filename, "/dev/", 5) == 0 && (cdromOK == false || ret != 0)) > { > + printf("If device %s is mounted on the desktop, unmount it" > + " first before using it in QEMU.\n", filename); > + printf("Command to unmount device: diskutil unmountDisk %s\n", > + filename); > + printf("Command to mount device: diskutil mountDisk %s\n", filename); > + } > +#endif /* defined(__APPLE__) && defined(__MACH__) */ > + > + if (ret < 0) { > + return ret; > } Why don't you simply include the #ifdef block in the first if (ret < 0)? Or does ret > 0 happen and the message must be displayed for it? Kevin