On Nov 20, 2015, at 11:26 AM, Kevin Wolf wrote: > 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 <programmingk...@gmail.com> >> >> --- >> 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?
Sorry for the HTML. This patch has been fixed and sent in. > >> @@ -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? ret > 0 could happen and a message should be displayed for it.