$NetBSD: patch-aa,v 1.1.1.1 2002/03/25 11:24:28 drochner Exp $ --- cdromlow.c.orig Sat Mar 23 19:48:00 2002 +++ cdromlow.c Sat Mar 23 20:10:30 2002 @@ -9,7 +9,7 @@ #include #include #include -#if !defined( __FreeBSD__) && !defined(__svr4__ ) +#if !defined( __FreeBSD__) && !defined(__svr4__ ) && !defined(__NetBSD__) # 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__) /* 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 x; int hasdatatrack=-1; +#ifdef __NetBSD__ + struct cd_toc_entry entrydata; + entry.data = &entrydata; + entry.data_len = sizeof(entrydata); +#endif if (info->filedescriptor!=-1) { @@ -148,7 +169,11 @@ entry.cdromlow_tocent_format=CDROM_LBA; ioctl(info->filedescriptor,CDROMREADTOCENTRY,&entry); #ifndef __FreeBSD__ +#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 @@ 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 @@ 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 @@ 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_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) { @@ -325,7 +372,11 @@ if (ioctl(info->filedescriptor,CDROMREADTOCENTRY,&track)==-1) ok=0; #ifndef __FreeBSD__ +#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