$OpenBSD: patch-plat_freebsd_c,v 1.2 2005/09/05 13:37:20 espie Exp $ --- plat_freebsd.c.orig Mon Feb 20 18:29:55 1995 +++ plat_freebsd.c Mon Sep 5 15:29:27 2005 @@ -5,10 +5,13 @@ * * Todd Pfaff, 3/20/94 * + * 11/26/95: Modified to work under FreeBSD 2.x + * by Donald Burr + * */ static char *ident = "@(#)plat_freebsd.c 1.2 2/20/95"; -#if defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) #include #include @@ -30,13 +33,16 @@ static char *ident = "@(#)plat_freebsd.c #include "/sys/scsi/scsi_all.h" #include "/sys/scsi/scsi_cd.h" #else +/* #include #include +*/ +#include #endif #include "struct.h" -#define DEFAULT_CD_DEVICE "/dev/rcd0d" +#define DEFAULT_CD_DEVICE "/dev/rcd0c" void *malloc(); @@ -163,7 +169,7 @@ gen_get_drive_status(d, oldmode, mode, p } if (ioctl(d->fd, CDIOCREADSUBCHANNEL, &sc)) { -#ifdef __NetBSD__ +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) /* we need to release the device so the kernel will notice reloaded media */ (void) close(d->fd); @@ -261,6 +267,9 @@ gen_set_volume(d, left, right) bzero((char *)&vol, sizeof(vol)); +#define LEFT_PORT 0 +#define RIGHT_PORT 1 + vol.vol[LEFT_PORT] = left; vol.vol[RIGHT_PORT] = right; @@ -345,14 +354,20 @@ gen_eject(d) if (fstatfs(stbuf.st_rdev, &buf) == 0) return (-3); -#ifdef __NetBSD__ +#if defined(__NetBSD__) || defined(__FreeBSD__) rval = ioctl(d->fd, CDIOCALLOW); if (rval == 0) #endif rval = ioctl(d->fd, CDIOCEJECT); -#ifdef __NetBSD__ +#if defined(__NetBSD__) || defined(__FreeBSD__) if (rval == 0) rval = ioctl(d->fd, CDIOCPREVENT); +#endif +#if defined(__OpenBSD__) + if (rval == 0) { + (void) close(d->fd); + d->fd = -1; + } #endif return rval; }