diff mbox

[2/3] raw-posix: Do not use CONFIG_COCOA macro

Message ID 1320950407-43512-3-git-send-email-pavel.borzenkov@gmail.com
State New
Headers show

Commit Message

Pavel Borzenkov Nov. 10, 2011, 6:40 p.m. UTC
Use __APPLE__ and __MACH__ macros instead of CONFIG_COCOA to detect Mac
OS X host. The patch is based on the Ben Leslie's patch:
http://patchwork.ozlabs.org/patch/97859/

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
---
 block/raw-posix.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Comments

Andreas Färber Nov. 30, 2011, 12:38 a.m. UTC | #1
Am 10.11.2011 19:40, schrieb Pavel Borzenkov:
> Use __APPLE__ and __MACH__ macros instead of CONFIG_COCOA to detect Mac
> OS X host. The patch is based on the Ben Leslie's patch:
> http://patchwork.ozlabs.org/patch/97859/
> 
> Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>

Reviewed-by: Andreas Färber <andreas.faerber@web.de>

Still in my queue for testing on a Mac though.

Andreas

> ---
>  block/raw-posix.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/block/raw-posix.c b/block/raw-posix.c
> index 17e1c6f..ee08f80 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>
> @@ -487,7 +487,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);
> @@ -632,7 +632,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 );
>  
> @@ -710,7 +710,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;
Andreas Färber Dec. 8, 2011, 12:12 a.m. UTC | #2
Am 30.11.2011 01:38, schrieb Andreas Färber:
> Am 10.11.2011 19:40, schrieb Pavel Borzenkov:
>> Use __APPLE__ and __MACH__ macros instead of CONFIG_COCOA to detect Mac
>> OS X host. The patch is based on the Ben Leslie's patch:
>> http://patchwork.ozlabs.org/patch/97859/
>>
>> Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
> 
> Reviewed-by: Andreas Färber <andreas.faerber@web.de>

Thanks, applied to the cocoa branch with a minor edit (s/the//).

http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/cocoa-for-upstream

Andreas

>> ---
>>  block/raw-posix.c |    8 ++++----
>>  1 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/block/raw-posix.c b/block/raw-posix.c
>> index 17e1c6f..ee08f80 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>
>> @@ -487,7 +487,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);
>> @@ -632,7 +632,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 );
>>  
>> @@ -710,7 +710,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 mbox

Patch

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 17e1c6f..ee08f80 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>
@@ -487,7 +487,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);
@@ -632,7 +632,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 );
 
@@ -710,7 +710,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;