$NetBSD: patch-aa,v 1.3 2006/05/21 23:02:29 wiz Exp $ --- cdromlow.c.orig 2001-10-27 09:23:21.000000000 +0000 +++ cdromlow.c @@ -9,7 +9,7 @@ #include #include #include -#if !defined( __FreeBSD__) && !defined(__svr4__ ) +#if !defined( __FreeBSD__) && !defined(__svr4__ ) && !defined(__NetBSD__) && !defined(__DragonFly__) # include #else # include @@ -37,7 +37,7 @@ /* we provide some macro mappings here. FreeBSD structs are a bit * different to those used by Linux so we will use macros to compensate that */ -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) /* Needed by FreeBSD */ # define CDROM_DATA_TRACK 4 @@ -46,19 +46,35 @@ # define CD_FRAMESIZE_RAW 2352 # define CDROM_LBA CD_LBA_FORMAT # define CDROMREADTOCHDR CDIOREADTOCHEADER +#ifdef __NetBSD__ +# define CDROMREADTOCENTRY CDIOREADTOCENTRIES +#else # define CDROMREADTOCENTRY CDIOREADTOCENTRY +#endif # define cdromlow_definecdromheader struct ioc_toc_header +#ifdef __NetBSD__ +# define cdromlow_definecdromhentry struct ioc_read_toc_entry +#else # define cdromlow_definecdromhentry struct ioc_read_toc_single_entry +#endif /* referencing the TOC header */ # define cdromlow_tochdr_firstt starting_track # define cdromlow_tochdr_lastt ending_track /* referencing TOC entries */ +#ifdef __NetBSD__ +# define cdromlow_tocent_track starting_track +#else # define cdromlow_tocent_track track +#endif # define cdromlow_tocent_format address_format +#ifdef __NetBSD__ +# define cdromlow_tocent_addr data->addr +#else # define cdromlow_tocent_addr entry.addr +#endif #elif __svr4__ # define CD_FRAMESIZE 2048 # define CD_FRAMESIZE_RAW 2352 @@ -138,6 +154,11 @@ int cdromlow_hasdatatrack(int handle) int x; int hasdatatrack=-1; +#ifdef __NetBSD__ + struct cd_toc_entry entrydata; + entry.data = &entrydata; + entry.data_len = sizeof(entrydata); +#endif if (info->filedescriptor!=-1) { @@ -147,8 +168,12 @@ int cdromlow_hasdatatrack(int handle) entry.cdromlow_tocent_track=x; entry.cdromlow_tocent_format=CDROM_LBA; ioctl(info->filedescriptor,CDROMREADTOCENTRY,&entry); -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__DragonFly__) +#ifdef __NetBSD__ + if (entry.data->control & CDROM_DATA_TRACK) +#else if (entry.cdte_ctrl&CDROM_DATA_TRACK) +#endif #else if (entry.entry.control & CDROM_DATA_TRACK) #endif @@ -191,6 +216,11 @@ int cdromlow_trackoffset(int handle,int cdromlow_tochandle *info=(cdromlow_tochandle*)handle; cdromlow_definecdromhentry entry; int offset=-1; +#ifdef __NetBSD__ + struct cd_toc_entry entrydata; + entry.data = &entrydata; + entry.data_len = sizeof(entrydata); +#endif if (info->filedescriptor!=-1) { @@ -223,6 +253,13 @@ int cdromlow_tracksize_sectors(int handl cdromlow_definecdromhentry tracknext; int tracksize; int ok=1; +#ifdef __NetBSD__ + struct cd_toc_entry trackdata, tracknextdata; + track.data = &trackdata; + track.data_len = sizeof(trackdata); + tracknext.data = &tracknextdata; + tracknext.data_len = sizeof(tracknextdata); +#endif tracksize=0; if (info->filedescriptor!=-1) @@ -278,6 +315,11 @@ int cdromlow_cddbnumber(int handle) cdromlow_definecdromhentry entry; int x,secs; int cddbnum=0; +#ifdef __NetBSD__ + struct cd_toc_entry entrydata; + entry.data = &entrydata; + entry.data_len = sizeof(entrydata); +#endif cddbnum=0; if (info->filedescriptor!=-1) @@ -317,6 +359,11 @@ cdromlow_tracktype cdromlow_gettracktype cdromlow_definecdromhentry track; int ok=1; cdromlow_tracktype result=TRACKTYPE_UNKNOWN; +#ifdef __NetBSD__ + struct cd_toc_entry trackdata; + track.data = &trackdata; + track.data_len = sizeof(trackdata); +#endif if (info->filedescriptor!=-1) { @@ -324,8 +371,12 @@ cdromlow_tracktype cdromlow_gettracktype track.cdromlow_tocent_format=CDROM_LBA; if (ioctl(info->filedescriptor,CDROMREADTOCENTRY,&track)==-1) ok=0; -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__DragonFly__) +#ifdef __NetBSD__ + if (track.data->control & CDROM_DATA_TRACK) +#else if (track.cdte_ctrl&CDROM_DATA_TRACK) +#endif #else if (track.entry.control & CDROM_DATA_TRACK) #endif