]> xenbits.xen.org Git - xenclient/ioemu-pq.git/commitdiff
Prevent VMs from locking the CD tray
authorAndrew McNeil <andrewmcn@bob.uk.xensource.com>
Tue, 15 Sep 2009 11:26:22 +0000 (12:26 +0100)
committerAndrew McNeil <andrewmcn@bob.uk.xensource.com>
Tue, 15 Sep 2009 11:26:22 +0000 (12:26 +0100)
master/atapi-pass-through

index 4c1889fac81fbf20cd7c3d0c43fdbe96b0f23c14..64162309fb222dbdfbee4a1b07bee3fdbe218a00 100644 (file)
@@ -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 <utime.h>
 +#include <sys/stat.h>
 +#include <fcntl.h>
@@ -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;