qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ben Leslie <benno@benno.id.au>
To: "Andreas Färber" <andreas.faerber@web.de>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Tristan Gingold <gingold@adacore.com>,
	Alexander Graf <agraf@suse.de>,
	qemu-devel Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X
Date: Mon, 30 May 2011 08:25:51 +1000	[thread overview]
Message-ID: <BANLkTikYG2o=yBE5bzF=AvC7b++cxBAQ9g@mail.gmail.com> (raw)
In-Reply-To: <D2C6F942-7EEF-4E33-AE85-306156C936B7@web.de>

On Mon, May 30, 2011 at 02:17, Andreas Färber <andreas.faerber@web.de> wrote:
> Am 16.05.2011 um 12:57 schrieb Ben Leslie:
>
>> On Wed, May 11, 2011 at 23:54, Peter Maydell <peter.maydell@linaro.org>
>> wrote:
>>>
>>> On 7 May 2011 12:40, Alexander Graf <agraf@suse.de> 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 <benno@benno.id.au>
---
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"

      reply	other threads:[~2011-05-29 22:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-06  9:48 [Qemu-devel] Add option to disable Cocoa on Mac OS X Ben Leslie
2011-05-06 10:46 ` Tristan Gingold
2011-05-06 12:01   ` Alexander Graf
2011-05-07 10:12     ` Andreas Färber
2011-05-07 10:40       ` Alexander Graf
2011-05-11 13:54         ` Peter Maydell
2011-05-16 10:57           ` Ben Leslie
2011-05-29 16:17             ` Andreas Färber
2011-05-29 22:25               ` Ben Leslie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTikYG2o=yBE5bzF=AvC7b++cxBAQ9g@mail.gmail.com' \
    --to=benno@benno.id.au \
    --cc=agraf@suse.de \
    --cc=andreas.faerber@web.de \
    --cc=gingold@adacore.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).