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
This commit is contained in:
Kenneth D. Merry 2005-03-26 06:05:06 +00:00
parent e9e4d3e4d4
commit 53372d3a6d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=144135

View File

@ -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);