From: Andrew McNeil Date: Tue, 15 Sep 2009 11:26:22 +0000 (+0100) Subject: Prevent VMs from locking the CD tray X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=4201c51ed72dcc5dce837cb21f075500b83c96be;p=xenclient%2Fioemu-pq.git Prevent VMs from locking the CD tray --- diff --git a/master/atapi-pass-through b/master/atapi-pass-through index 4c1889f..6416230 100644 --- a/master/atapi-pass-through +++ b/master/atapi-pass-through @@ -105,10 +105,10 @@ index 0000000..f9bdee9 +#endif /* !BLOCK_RAW_POSIX_H */ diff --git a/hw/atapi-pt.c b/hw/atapi-pt.c new file mode 100644 -index 0000000..47ee6af +index 0000000..92f2934 --- /dev/null +++ b/hw/atapi-pt.c -@@ -0,0 +1,1163 @@ +@@ -0,0 +1,1173 @@ +#include +#include +#include @@ -1157,6 +1157,16 @@ index 0000000..47ee6af + /* A few commands need special attention */ + switch(cmd_code) + { ++ case GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL: ++ // we don't allow locking, to prevent a VM from hogging the drive ++ if((s->io_buffer[4] & 1) == 0) // unlock ++ ide_atapi_cmd_ok(s); ++ else // lock ++ ide_atapi_pt_set_error(s, SENSE_ILLEGAL_REQUEST, ++ ASC_INV_FIELD_IN_CMD_PACKET, 0x70); ++ ++ return; ++ + case GPCMD_BLANK: // bigger timeout while blanking + cmd->timeout = 1000 * 60 * 80; // 80 mins + break;