Prevent CD-ROM media eject while device is locked
commit3e6b53eb32400a9ef172b34a6168ec563c9db74e
authorMark McLoughlin <markmc@redhat.com>
Wed, 27 May 2009 09:06:11 +0000 (27 10:06 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 16 Jun 2009 22:46:59 +0000 (16 17:46 -0500)
treef4ab0922140762c7842d683cdccd1243f4ddf8a0
parent80de8ace664689f2ba1eae307bb8d48abc343063
Prevent CD-ROM media eject while device is locked

Section 10.8.25 ("START/STOP UNIT Command") of SFF-8020i states that
if the device is locked we should refuse to eject if the device is
locked.

ASC_MEDIA_REMOVAL_PREVENTED is the appropriate return in this case.

In order to stop itself from ejecting the media it is running from,
Fedora's installer (anaconda) requires the CDROMEJECT ioctl() to fail
if the drive has been previously locked.

See also https://bugzilla.redhat.com/501412

(cherry picked from commit aea2a33c73f28ecd8f10b242ecadddcc79c1c28b)

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
block.c
block.h
hw/ide.c