diff mbox

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

Message ID 1335824128-16819-2-git-send-email-andreas.faerber@web.de
State New
Headers show

Commit Message

Andreas Färber April 30, 2012, 10:15 p.m. UTC
From: Pavel Borzenkov <pavel.borzenkov@gmail.com>

Use __APPLE__ and __MACH__ macros instead of CONFIG_COCOA to detect Mac
OS X host. The patch is based on Ben Leslie's patch:
http://patchwork.ozlabs.org/patch/97859/

Signed-off-by: Ben Leslie <benno@benno.id.au>
Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
 block/raw-posix.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Comments

Andreas Färber April 30, 2012, 10:22 p.m. UTC | #1
Am 01.05.2012 00:15, schrieb Andreas Färber:
> From: Pavel Borzenkov <pavel.borzenkov@gmail.com>
> 
> Use __APPLE__ and __MACH__ macros instead of CONFIG_COCOA to detect Mac
> OS X host. The patch is based on Ben Leslie's patch:
> http://patchwork.ozlabs.org/patch/97859/
> 
> Signed-off-by: Ben Leslie <benno@benno.id.au>
> Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>

Gotta forget something: I fixed up the cocoa-for-upstream branch with
Kevin's Acked-by.

Andreas

> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> ---
>  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 2d1bc13..03fcfcc 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>
> @@ -505,7 +505,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);
> @@ -650,7 +650,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 );
>  
> @@ -728,7 +728,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;
Kevin Wolf May 2, 2012, 8:02 a.m. UTC | #2
Am 01.05.2012 00:15, schrieb Andreas Färber:
> From: Pavel Borzenkov <pavel.borzenkov@gmail.com>
> 
> Use __APPLE__ and __MACH__ macros instead of CONFIG_COCOA to detect Mac
> OS X host. The patch is based on Ben Leslie's patch:
> http://patchwork.ozlabs.org/patch/97859/
> 
> Signed-off-by: Ben Leslie <benno@benno.id.au>
> Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> ---
>  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 2d1bc13..03fcfcc 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__)

Is there a 'defined' missing?

Kevin
Andreas Färber May 2, 2012, 9:39 a.m. UTC | #3
Am 02.05.2012 10:02, schrieb Kevin Wolf:
> Am 01.05.2012 00:15, schrieb Andreas Färber:
>> From: Pavel Borzenkov <pavel.borzenkov@gmail.com>
>>
>> Use __APPLE__ and __MACH__ macros instead of CONFIG_COCOA to detect Mac
>> OS X host. The patch is based on Ben Leslie's patch:
>> http://patchwork.ozlabs.org/patch/97859/
>>
>> Signed-off-by: Ben Leslie <benno@benno.id.au>
>> Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
>> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
>> ---
>>  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 2d1bc13..03fcfcc 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__)
> 
> Is there a 'defined' missing?

Seems like it, I'll send you a fixup patch.

Thanks for noticing,

Andreas
diff mbox

Patch

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 2d1bc13..03fcfcc 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>
@@ -505,7 +505,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);
@@ -650,7 +650,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 );
 
@@ -728,7 +728,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;