$NetBSD: patch-ch,v 1.3 2006/09/03 17:13:30 ben Exp $

--- interface/cdda_interface.h.orig	2001-03-23 17:15:46.000000000 -0800
+++ interface/cdda_interface.h
@@ -18,9 +18,19 @@
 #endif
 #define CD_FRAMESAMPLES (CD_FRAMESIZE_RAW / 4)
 
+#if defined(__APPLE__) && defined(__MACH__)
+#include <IOKit/IOKitLib.h>
+#include <IOKit/storage/IOCDTypes.h>
+#endif
+
 #include <sys/types.h>
 #include <signal.h>
 
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+#include <stdio.h>
+#include <camlib.h>
+#endif
+
 #define MAXTRK 100
 
 typedef struct TOC {	/* structure of table of contents */
@@ -33,6 +43,7 @@ typedef struct TOC {	/* structure of tab
 #define GENERIC_SCSI	0
 #define COOKED_IOCTL	1
 #define TEST_INTERFACE	2
+#define OSX_IOKIT	3
 
 #define CDDA_MESSAGE_FORGETIT 0
 #define CDDA_MESSAGE_PRINTIT 1
@@ -47,13 +58,27 @@ typedef struct cdrom_drive{
   int opened; /* This struct may just represent a candidate for opening */
 
   char *cdda_device_name;
+#if !defined(__FreeBSD__) && !defined(__DragonFly__)
   char *ioctl_device_name;
 
   int cdda_fd;
-  int ioctl_fd;
 
-  char *drive_model;
   int drive_type;
+#else
+  struct cam_device *dev;
+  union ccb *ccb;
+#endif
+
+#if defined(__APPLE__) && defined(__MACH__)
+  io_object_t io;
+  int fd;
+  char *dev;
+  CDTOC *raw_toc;
+  int descriptor_count;
+#endif
+
+  int ioctl_fd;
+  char *drive_model;
   int interface;
   int bigendianp;
   int nsectors;
@@ -83,9 +108,13 @@ typedef struct cdrom_drive{
   int is_mmc;
 
   /* SCSI command buffer and offset pointers */
+#if !defined(__FreeBSD__) && !defined(__DragonFly__)
   unsigned char *sg;
   unsigned char *sg_buffer;
   unsigned char inqbytes[4];
+#else
+  unsigned char *sg_buffer;
+#endif
 
   /* Scsi parameters and state */
   unsigned char density;
