[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X
From: |
Ben Leslie |
Subject: |
Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X |
Date: |
Mon, 30 May 2011 08:25:51 +1000 |
On Mon, May 30, 2011 at 02:17, Andreas Färber <address@hidden> wrote:
> Am 16.05.2011 um 12:57 schrieb Ben Leslie:
>
>> On Wed, May 11, 2011 at 23:54, Peter Maydell <address@hidden>
>> wrote:
>>>
>>> On 7 May 2011 12:40, Alexander Graf <address@hidden> wrote:
>>>>
>>>> So I suppose the only thing missing is a --disable-cocoa option, yup.
>>>
>>> I've just noticed that some of the code in block/raw-posix.c
>>> uses the CONFIG_COCOA #define to gate whether to do MacOSX
>>> specific handling of CDROMs and so on. I'm not a MacOS expert
>>> but maybe that needs to be changed to some other ifdef -- I'm
>>> guessing we don't want to have cdrom handling randomly change
>>> behaviour just because the user tried to disable Cocoa graphics
>>> handling...
>>
>> These seems to be a good point. Potentially checking for __APPLE__ and
>> __MACH__ makes more sense? (See:
>> http://predef.sourceforge.net/preos.html#sec20)
>
> Any update on this?
>
> IIUC without digging further, today, Cocoa not only means displaying the
> graphical window but also has impact on which libraries are linked to, such
> as IOKit and CoreAudio. So simply replacing CONFIG_COCOA with __APPLE__
> would seem not to be enough.
>
> Tristan, if your patch takes care of everything, mind to resend or to
> provide a Patchwork link please?
Replacing with CONFIG_COCOA with __APPLE__ seemed to be enough for me, but
I might have missed something. Here is the patch if someone else could
try it out:
Signed-off-by: Ben Leslie <address@hidden>
---
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 6b72470..1f61a7f 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -29,7 +29,7 @@
#include "module.h"
#include "block/raw-posix-aio.h"
-#ifdef CONFIG_COCOA
+#if defined(__APPLE__) && (__MACH__)
#include <paths.h>
#include <sys/param.h>
#include <IOKit/IOKitLib.h>
@@ -235,7 +235,7 @@ static int raw_open(BlockDriverState *bs, const
char *filename, int flags)
bufsize = sectorsize;
}
#endif
-#ifdef CONFIG_COCOA
+#if defined(__APPLE__) && defined(__MACH__)
uint32_t blockSize = 512;
if ( !ioctl( fd, DKIOCGETBLOCKSIZE, &blockSize ) && blockSize
> bufsize) {
bufsize = blockSize;
@@ -680,7 +680,7 @@ again:
}
if (size == 0)
#endif
-#ifdef CONFIG_COCOA
+#if defined(__APPLE__) && defined(__MACH__)
size = LONG_LONG_MAX;
#else
size = lseek(fd, 0LL, SEEK_END);
@@ -820,7 +820,7 @@ static BlockDriver bdrv_file = {
/***********************************************/
/* host device */
-#ifdef CONFIG_COCOA
+#if defined(__APPLE__) && defined(__MACH__)
static kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator );
static kern_return_t GetBSDPath( io_iterator_t mediaIterator, char
*bsdPath, CFIndex maxPathSize );
@@ -898,7 +898,7 @@ static int hdev_open(BlockDriverState *bs, const
char *filename, int flags)
{
BDRVRawState *s = bs->opaque;
-#ifdef CONFIG_COCOA
+#if defined(__APPLE__) && defined(__MACH__)
if (strstart(filename, "/dev/cdrom", NULL)) {
kern_return_t kernResult;
io_iterator_t mediaIterator;
diff --git a/configure b/configure
index d7dba5d..6a5864f 100755
--- a/configure
+++ b/configure
@@ -635,6 +635,8 @@ for opt do
;;
--enable-profiler) profiler="yes"
;;
+ --disable-cocoa) cocoa="no"
+ ;;
--enable-cocoa)
cocoa="yes" ;
sdl="no" ;
@@ -932,6 +934,7 @@ echo " --disable-sdl disable SDL"
echo " --enable-sdl enable SDL"
echo " --disable-vnc disable VNC"
echo " --enable-vnc enable VNC"
+echo " --disable-cocoa disable COCOA"
echo " --enable-cocoa enable COCOA (Mac OS X only)"
echo " --audio-drv-list=LIST set audio drivers list:"
echo " Available drivers: $audio_possible_drivers"
- [Qemu-devel] Add option to disable Cocoa on Mac OS X, Ben Leslie, 2011/05/06
- Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X, Tristan Gingold, 2011/05/06
- Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X, Alexander Graf, 2011/05/06
- Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X, Andreas Färber, 2011/05/07
- Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X, Alexander Graf, 2011/05/07
- Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X, Peter Maydell, 2011/05/11
- Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X, Ben Leslie, 2011/05/16
- Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X, Andreas Färber, 2011/05/29
- Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X,
Ben Leslie <=