Index: trunk/include/VBox/scsi.h
===================================================================
--- trunk/include/VBox/scsi.h	(revision 38677)
+++ trunk/include/VBox/scsi.h	(revision 38680)
@@ -116,9 +116,10 @@
     SCSI_READ_6                         = 0x08,
     SCSI_WRITE_6                        = 0x0a,
-    SCSI_LOG_SENSE                      = 0x4d
+    SCSI_LOG_SENSE                      = 0x4d,
+    SCSI_UNMAP                          = 0x42
 } SCSICMD;
 
 /**
- * Service action in opcoe identifiers
+ * Service action in opcode identifiers
  */
 typedef enum SCSISVCACTIONIN
@@ -178,16 +179,20 @@
 
 /* additional sense keys */
-#define SCSI_ASC_NONE                               0x00
-#define SCSI_ASC_WRITE_ERROR                        0x0c
-#define SCSI_ASC_READ_ERROR                         0x11
-#define SCSI_ASC_ILLEGAL_OPCODE                     0x20
-#define SCSI_ASC_LOGICAL_BLOCK_OOR                  0x21
-#define SCSI_ASC_INV_FIELD_IN_CMD_PACKET            0x24
-#define SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED            0x28
-#define SCSI_ASC_MEDIUM_NOT_PRESENT                 0x3a
-#define SCSI_ASC_SAVING_PARAMETERS_NOT_SUPPORTED    0x39
-#define SCSI_ASC_INVALID_MESSAGE                    0x49
-#define SCSI_ASC_MEDIA_LOAD_OR_EJECT_FAILED         0x53
+#define SCSI_ASC_NONE                                       0x00
+#define SCSI_ASC_WRITE_ERROR                                0x0c
+#define SCSI_ASC_READ_ERROR                                 0x11
+#define SCSI_ASC_ILLEGAL_OPCODE                             0x20
+#define SCSI_ASC_LOGICAL_BLOCK_OOR                          0x21
+#define SCSI_ASC_INV_FIELD_IN_CMD_PACKET                    0x24
+#define SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED                    0x28
+#define SCSI_ASC_MEDIUM_NOT_PRESENT                         0x3a
+#define SCSI_ASC_SAVING_PARAMETERS_NOT_SUPPORTED            0x39
+#define SCSI_ASC_INVALID_MESSAGE                            0x49
+#define SCSI_ASC_MEDIA_LOAD_OR_EJECT_FAILED                 0x53
 #define SCSI_ASC_LOGICAL_UNIT_DOES_NOT_RESPOND_TO_SELECTION 0x00
+#define SCSI_ASC_SYSTEM_RESOURCE_FAILURE                    0x55
+
+/** Additional sense code qualifiers (ASCQ). */
+#define SCSI_ASCQ_SYSTEM_BUFFER_FULL                        0x01
 
 /** @name SCSI_INQUIRY
Index: trunk/include/VBox/vscsi.h
===================================================================
--- trunk/include/VBox/vscsi.h	(revision 38677)
+++ trunk/include/VBox/vscsi.h	(revision 38680)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -68,4 +68,6 @@
     /** Flush */
     VSCSIIOREQTXDIR_FLUSH,
+    /** Unmap */
+    VSCSIIOREQTXDIR_UNMAP,
     /** 32bit hack */
     VSCSIIOREQTXDIR_32BIT_HACK = 0x7fffffff
@@ -94,4 +96,22 @@
 
 /**
+ * Range descriptor.
+ */
+typedef struct VSCSIRANGE
+{
+    /** Start offset. */
+    uint64_t offStart;
+    /** Size of the range. */
+    size_t   cbRange;
+} VSCSIRANGE;
+/** Pointer to a range descriptor. */
+typedef VSCSIRANGE *PVSCSIRANGE;
+
+/** The LUN can handle the UNMAP command. */
+#define VSCSI_LUN_FEATURE_UNMAP          RT_BIT(0)
+/** The LUN has a non rotational medium. */
+#define VSCSI_LUN_FEATURE_NON_ROTATIONAL RT_BIT(1)
+
+/**
  * Virtual SCSI LUN I/O Callback table.
  */
@@ -125,4 +145,18 @@
                                                               VSCSIIOREQ hVScsiIoReq));
 
+    /**
+     * Returns flags of supported features.
+     *
+     * @returns VBox status status code.
+     * @param   hVScsiLun             Virtual SCSI LUN handle.
+     * @param   pvScsiLunUser         Opaque user data which may
+     *                                be used to identify the medium.
+     * @param   hVScsiIoReq           Virtual SCSI I/O request handle.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnVScsiLunGetFeatureFlags, (VSCSILUN hVScsiLun,
+                                                           void *pvScsiLunUser,
+                                                           uint64_t *pfFeatures));
+
+
 } VSCSILUNIOCALLBACKS;
 /** Pointer to a virtual SCSI LUN I/O callback table. */
@@ -284,4 +318,15 @@
                                       size_t *pcbSeg, PCRTSGSEG *ppaSeg);
 
+/**
+ * Query unmap parameters.
+ *
+ * @returns VBox status code.
+ * @param   hVScsiIoReq    The SCSI I/O request handle.
+ * @param   ppaRanges      Where to store the pointer to the range array on success.
+ * @param   pcRanges       Where to store the number of ranges on success.
+ */
+VBOXDDU_DECL(int) VSCSIIoReqUnmapParamsGet(VSCSIIOREQ hVScsiIoReq, PVSCSIRANGE *ppaRanges,
+                                           unsigned *pcRanges);
+
 RT_C_DECLS_END
 
