summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>2005-03-26 06:05:06 +0000
committerken <ken@FreeBSD.org>2005-03-26 06:05:06 +0000
commit43981486c2b741116e1d7d2f92ec4e43329292e3 (patch)
tree811f56a4eedd92a6b0fc690820e6409f3692f8ea /sys/cam
parenta856c3c2dfa2f5002877592007990d980e989d5a (diff)
downloadFreeBSD-src-43981486c2b741116e1d7d2f92ec4e43329292e3.zip
FreeBSD-src-43981486c2b741116e1d7d2f92ec4e43329292e3.tar.gz
Fix a problem with the cd(4) driver -- the CAMGETPASSTHRU ioctl wouldn't
succeed if there was no media in the drive. This was broken in rev 1.72 when the media check was added to cdioctl(). For now, check the ioctl group to decide whether to check for media or not. (We only need to check for media on CD-specific ioctls.) Reported by: bland MFC after: 3 days
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/scsi/scsi_cd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index 11a64a7..d0b2bb2 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -1929,10 +1929,16 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td)
/*
* If we don't have media loaded, check for it. If still don't
* have media loaded, we can only do a load or eject.
+ *
+ * We only care whether media is loaded if this is a cd-specific ioctl
+ * (thus the IOCGROUP check below). Note that this will break if
+ * anyone adds any ioctls into the switch statement below that don't
+ * have their ioctl group set to 'c'.
*/
if (((softc->flags & CD_FLAG_VALID_MEDIA) == 0)
&& ((cmd != CDIOCCLOSE)
- && (cmd != CDIOCEJECT))) {
+ && (cmd != CDIOCEJECT))
+ && (IOCGROUP(cmd) == 'c')) {
error = cdcheckmedia(periph);
if (error != 0) {
cam_periph_unlock(periph);
OpenPOWER on IntegriCloud