Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Dec 2007 12:39:51 +0200
From:      Andriy Gapon <avg@icyb.net.ua>
To:        Nikos Vassiliadis <nvass@teledomenet.gr>
Cc:        freebsd-questions@freebsd.org, =?UTF-8?B?U8O4cmVuIFNjaG1pZHQ=?= <sos@FreeBSD.org>
Subject:   Re: mounted cd and tray locking
Message-ID:  <47610BF7.8070002@icyb.net.ua>
In-Reply-To: <47610957.8020800@icyb.net.ua>
References:  <475FC26C.3030508@icyb.net.ua> <200712130930.08558.nvass@teledomenet.gr> <4760FE68.60001@icyb.net.ua> <200712131213.37478.nvass@teledomenet.gr> <47610957.8020800@icyb.net.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
on 13/12/2007 12:28 Andriy Gapon said the following:
> on 13/12/2007 12:13 Nikos Vassiliadis said the following:
>> On Thursday 13 December 2007 11:42:00 Andriy Gapon wrote:
>>> on 13/12/2007 09:30 Nikos Vassiliadis said the following:
>>>> I have no atapicam in my kernel. Nor hald running.
>>>> I reproduced it like this:
>>>> mount /cdrom
>>>> cdcontrol eject
>>> I don't think you reproduced it. Why would you execute the above command
>>> unless it is your intention to eject the disk ?
>> You got it wrong. cdcontrol *does not* eject the disk, it works
>> correctly, as it should. cdcontrol never ejects mounted media.
> 
> Well, I got it right, it's just that in my opinion you knew what you
> were doing.
> 
>> It triggers the situation where I can then press the eject key
>> on the cdrom and really eject the cdrom.
> 
> It would be interesting to see what exact ioctls/commands cdcontrol
> issues. ktrace+kdump can help with this. Assuming your drive is ATAPI
> (not SCSI) then if only CDIOCEJECT is issued then the drive should not
> become unlocked.

Tried this myself:
 11991 cdcontrol CALL  open(0x7fffffffe130,0,0x9)
 11991 cdcontrol NAMI  "/dev/acd0"
 11991 cdcontrol RET   open 3
 11991 cdcontrol CALL  ioctl(0x3,CDIOCALLOW,0)
 11991 cdcontrol RET   ioctl 0
 11991 cdcontrol CALL  ioctl(0x3,CDIOCEJECT,0)
 11991 cdcontrol RET   ioctl -1 errno 16 Device busy
 11991 cdcontrol CALL  exit(0xffffffff)

It is a question for me how atapi-cd should behave on CDIOCALLOW command
issued on an opened disk (by something other than the entity doing
ioctl, i.e. geom acr > 1). Maybe it should work the same way as for
CDIOCEJECT, maybe geom ace should be taken into account somehow.
Part of me says: do not allow unlocking tray if something is mounted,
the other part says: let user do what he wants.
Maybe the easiest solution here is to change cdcontrol to do only
CDIOCEJECT without CDIOCALLOW ?


-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47610BF7.8070002>