$OpenBSD: patch-iodev_cdrom_cc,v 1.1 2001/02/02 16:59:11 todd Exp $
--- iodev/cdrom.cc.orig	Sat Mar 25 21:32:13 2000
+++ iodev/cdrom.cc	Tue Oct 17 12:04:02 2000
@@ -42,11 +42,6 @@ extern "C" {
 
 #ifdef __OpenBSD__
 // Here is a diff for cdrom.cc which adds support for OpenBSD.
-//
-// Note that since the i386 sys/disklabel.h contains code which c++ considers
-// invalid, it will not work with a default release until OpenBSD 2.7.
-// (I will fix disklabel.h as soon as 2.6 is done and the tree is unlocked.)
-extern "C" {
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/file.h>
@@ -57,7 +52,6 @@ extern "C" {
 // XXX
 #define BX_CD_FRAMESIZE 2048
 #define CD_FRAMESIZE	2048
-}
 #endif
 
 #ifdef WIN32
@@ -163,7 +157,7 @@ cdrom_interface::read_toc(uint8* buf, in
   // Read CD TOC. Returns false if start track is out of bounds.
 
   if (fd < 0) {
-    bx_panic("cdrom: read_toc: file not open.\n");
+    bio->panic("cdrom: read_toc: file not open.\n");
     }
 
 #ifdef WIN32
@@ -178,7 +172,7 @@ cdrom_interface::read_toc(uint8* buf, in
   {
   struct cdrom_tochdr tochdr;
   if (ioctl(fd, CDROMREADTOCHDR, &tochdr))
-    bx_panic("cdrom: read_toc: READTOCHDR failed.\n");
+    bio->panic("cdrom: read_toc: READTOCHDR failed.\n");
 
   if (start_track > tochdr.cdth_trk1)
     return false;
@@ -195,7 +189,7 @@ cdrom_interface::read_toc(uint8* buf, in
     tocentry.cdte_format = (msf) ? CDROM_MSF : CDROM_LBA;
     tocentry.cdte_track = i;
     if (ioctl(fd, CDROMREADTOCENTRY, &tocentry))
-      bx_panic("cdrom: read_toc: READTOCENTRY failed.\n");
+      bio->panic("cdrom: read_toc: READTOCENTRY failed.\n");
     buf[len++] = 0; // Reserved
     buf[len++] = (tocentry.cdte_adr << 4) | tocentry.cdte_ctrl ; // ADR, control
     buf[len++] = i; // Track number
@@ -220,7 +214,7 @@ cdrom_interface::read_toc(uint8* buf, in
   tocentry.cdte_format = (msf) ? CDROM_MSF : CDROM_LBA;
   tocentry.cdte_track = 0xaa;
   if (ioctl(fd, CDROMREADTOCENTRY, &tocentry))
-    bx_panic("cdrom: read_toc: READTOCENTRY lead-out failed.\n");
+    bio->panic("cdrom: read_toc: READTOCENTRY lead-out failed.\n");
   buf[len++] = 0; // Reserved
   buf[len++] = (tocentry.cdte_adr << 4) | tocentry.cdte_ctrl ; // ADR, control
   buf[len++] = 0xaa; // Track number
@@ -252,7 +246,7 @@ cdrom_interface::read_toc(uint8* buf, in
   struct ioc_read_toc_entry t;
 
   if (ioctl (fd, CDIOREADTOCHEADER, &h) < 0)
-    bx_panic("cdrom: read_toc: READTOCHDR failed.\n");
+    bio->panic("cdrom: read_toc: READTOCHDR failed.\n");
 
   if (start_track > h.ending_track)
     return false;
@@ -272,7 +266,7 @@ cdrom_interface::read_toc(uint8* buf, in
     t.data = &tocentry;
 
     if (ioctl (fd, CDIOREADTOCENTRYS, &tocentry) < 0)
-      bx_panic("cdrom: read_toc: READTOCENTRY failed.\n");
+      bio->panic("cdrom: read_toc: READTOCENTRY failed.\n");
 
     buf[len++] = 0; // Reserved
     buf[len++] = (tocentry.addr_type << 4) | tocentry.control ; // ADR, control
@@ -301,7 +295,7 @@ cdrom_interface::read_toc(uint8* buf, in
   t.data = &tocentry;
 
   if (ioctl (fd, CDIOREADTOCENTRYS, &tocentry) < 0)
-    bx_panic("cdrom: read_toc: READTOCENTRY lead-out failed.\n");
+    bio->panic("cdrom: read_toc: READTOCENTRY lead-out failed.\n");
 
   buf[len++] = 0; // Reserved
   buf[len++] = (tocentry.addr_type << 4) | tocentry.control ; // ADR, control
@@ -349,10 +343,10 @@ cdrom_interface::capacity()
   uint32 nr_sects;
 
   if (fd < 0) {
-    bx_panic("cdrom: capacity: file not open.\n");
+    bio->panic("cdrom: capacity: file not open.\n");
     }
   if (ioctl(fd, BLKGETSIZE, &nr_sects) != 0) {
-    bx_panic("cdrom: ioctl(BLKGETSIZE) failed\n");
+    bio->panic("cdrom: ioctl(BLKGETSIZE) failed\n");
     }
   nr_sects /= (CD_FRAMESIZE / 512);
 
@@ -365,10 +359,10 @@ cdrom_interface::capacity()
   struct disklabel lp;
 
   if (fd < 0)
-    bx_panic("cdrom: capacity: file not open.\n");
+    bio->panic("cdrom: capacity: file not open.\n");
 
   if (ioctl(fd, DIOCGDINFO, &lp) < 0)
-    bx_panic("cdrom: ioctl(DIOCGDINFO) failed\n");
+    bio->panic("cdrom: ioctl(DIOCGDINFO) failed\n");
 
   fprintf(stderr, "#cdrom: capacity: %u\n", lp.d_secperunit);
   return(lp.d_secperunit);
@@ -397,12 +391,12 @@ cdrom_interface::read_block(uint8* buf, 
 #ifdef WIN32
   pos = SetFilePointer(hFile, lba*BX_CD_FRAMESIZE, NULL, SEEK_SET);
   if (pos == 0xffffffff) {
-    bx_panic("cdrom: read_block: lseek returned error.\n");
+    bio->panic("cdrom: read_block: lseek returned error.\n");
     }
 #else
   pos = lseek(fd, lba*BX_CD_FRAMESIZE, SEEK_SET);
   if (pos < 0) {
-    bx_panic("cdrom: read_block: lseek returned error.\n");
+    bio->panic("cdrom: read_block: lseek returned error.\n");
     }
 #endif 
 
@@ -413,7 +407,7 @@ cdrom_interface::read_block(uint8* buf, 
 #endif
   
   if (n != BX_CD_FRAMESIZE) {
-    bx_panic("cdrom: read_block: read returned %d\n",
+    bio->panic("cdrom: read_block: read returned %d\n",
       (int) n);
     }
 }
