113 lines
2.5 KiB
Plaintext
113 lines
2.5 KiB
Plaintext
$NetBSD: patch-ab,v 1.2 2013/06/16 09:58:48 shattered Exp $
|
|
|
|
--- src/disc_freebsd.c.orig 2013-04-12 11:46:44.000000000 +0000
|
|
+++ src/disc_freebsd.c
|
|
@@ -47,11 +47,19 @@
|
|
#define MB_DEFAULT_DEVICE "/dev/acd0"
|
|
|
|
#define XA_INTERVAL ((60 + 90 + 2) * CD_FRAMES)
|
|
-
|
|
+
|
|
+#ifdef __NetBSD__
|
|
+#define CDIOREADTOCENTRY CDIOREADTOCENTRIES
|
|
+#endif
|
|
|
|
static int read_toc_header(int fd, int *first, int *last) {
|
|
struct ioc_toc_header th;
|
|
+#ifdef __NetBSD__
|
|
+ struct cd_toc_entry td;
|
|
+ struct ioc_read_toc_entry te;
|
|
+#else
|
|
struct ioc_read_toc_single_entry te;
|
|
+#endif
|
|
|
|
int ret = ioctl(fd, CDIOREADTOCHEADER, &th);
|
|
|
|
@@ -67,10 +75,20 @@ static int read_toc_header(int fd, int *
|
|
* session are handled correctly.
|
|
*/
|
|
te.address_format = CD_LBA_FORMAT;
|
|
+#ifdef __NetBSD__
|
|
+ te.starting_track = th.ending_track;
|
|
+ te.data_len = sizeof(td);
|
|
+ te.data = &td;
|
|
+#else
|
|
te.track = th.ending_track;
|
|
+#endif
|
|
ret = ioctl(fd, CDIOREADTOCENTRY, &te);
|
|
|
|
+#ifdef __NetBSD__
|
|
+ if (( td.control & CD_DATA_TRACK) != 0 )
|
|
+#else
|
|
if (( te.entry.control & CD_DATA_TRACK) != 0 )
|
|
+#endif
|
|
(*last)--;
|
|
|
|
return ret;
|
|
@@ -78,17 +96,32 @@ static int read_toc_header(int fd, int *
|
|
|
|
|
|
static int read_toc_entry(int fd, int track_num, unsigned long *lba) {
|
|
+#ifdef __NetBSD__
|
|
+ struct cd_toc_entry td;
|
|
+ struct ioc_read_toc_entry te;
|
|
+#else
|
|
struct ioc_read_toc_single_entry te;
|
|
+#endif
|
|
int ret;
|
|
|
|
+#ifdef __NetBSD__
|
|
+ te.starting_track = track_num;
|
|
+ te.data_len = sizeof(td);
|
|
+ te.data = &td;
|
|
+#else
|
|
te.track = track_num;
|
|
+#endif
|
|
te.address_format = CD_LBA_FORMAT;
|
|
|
|
ret = ioctl(fd, CDIOREADTOCENTRY, &te);
|
|
assert( te.address_format == CD_LBA_FORMAT );
|
|
|
|
if ( ret == 0 )
|
|
+#ifdef __NetBSD__
|
|
+ *lba = td.addr.lba;
|
|
+#else
|
|
*lba = ntohl(te.entry.addr.lba);
|
|
+#endif
|
|
|
|
return ret;
|
|
}
|
|
@@ -96,16 +129,32 @@ static int read_toc_entry(int fd, int tr
|
|
|
|
static int read_leadout(int fd, unsigned long *lba) {
|
|
struct ioc_toc_header th;
|
|
+#ifdef __NetBSD__
|
|
+ struct cd_toc_entry td;
|
|
+ struct ioc_read_toc_entry te;
|
|
+#else
|
|
struct ioc_read_toc_single_entry te;
|
|
+#endif
|
|
int ret;
|
|
|
|
ret = ioctl(fd, CDIOREADTOCHEADER, &th);
|
|
+#ifdef __NetBSD__
|
|
+ te.starting_track = th.ending_track;
|
|
+ te.data_len = sizeof(td);
|
|
+ te.data = &td;
|
|
+#else
|
|
te.track = th.ending_track;
|
|
+#endif
|
|
te.address_format = CD_LBA_FORMAT;
|
|
ret = ioctl(fd, CDIOREADTOCENTRY, &te);
|
|
|
|
+#ifdef __NetBSD__
|
|
+ if (( td.control & CD_DATA_TRACK) != 0 ) {
|
|
+ *lba = td.addr.lba - 11400;
|
|
+#else
|
|
if (( te.entry.control & CD_DATA_TRACK) != 0 ) {
|
|
*lba = ntohl(te.entry.addr.lba) - 11400;
|
|
+#endif
|
|
return ret;
|
|
}
|
|
|