Changeset 39566 in vbox
- Timestamp:
- Dec 9, 2011 1:27:31 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 75320
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/scsi.h
r38680 r39566 185 185 #define SCSI_ASC_LOGICAL_BLOCK_OOR 0x21 186 186 #define SCSI_ASC_INV_FIELD_IN_CMD_PACKET 0x24 187 #define SCSI_ASC_WRITE_PROTECTED 0x27 187 188 #define SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED 0x28 188 189 #define SCSI_ASC_MEDIUM_NOT_PRESENT 0x3a -
trunk/include/VBox/vscsi.h
r38878 r39566 99 99 /** The LUN has a non rotational medium. */ 100 100 #define VSCSI_LUN_FEATURE_NON_ROTATIONAL RT_BIT(1) 101 /** The medium of the LUN is readonly. */ 102 #define VSCSI_LUN_FEATURE_READONLY RT_BIT(2) 101 103 102 104 /** -
trunk/src/VBox/Devices/Storage/DrvSCSI.cpp
r39550 r39566 107 107 /** Mark the drive as having a non-rotational medium (i.e. as a SSD). */ 108 108 bool fNonRotational; 109 /** Medium is readonly */ 110 bool fReadonly; 109 111 } DRVSCSI, *PDRVSCSI; 110 112 … … 422 424 *pfFeatures |= VSCSI_LUN_FEATURE_NON_ROTATIONAL; 423 425 426 if (pThis->fReadonly) 427 *pfFeatures |= VSCSI_LUN_FEATURE_READONLY; 428 424 429 return VINF_SUCCESS; 425 430 } … … 825 830 * Validate and read configuration. 826 831 */ 827 if (!CFGMR3AreValuesValid(pCfg, "NonRotationalMedium\0 "))832 if (!CFGMR3AreValuesValid(pCfg, "NonRotationalMedium\0Readonly\0")) 828 833 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, 829 834 N_("SCSI configuration error: unknown option specified")); … … 833 838 return PDMDRV_SET_ERROR(pDrvIns, rc, 834 839 N_("SCSI configuration error: failed to read \"NonRotationalMedium\" as boolean")); 840 841 rc = CFGMR3QueryBoolDef(pCfg, "Readonly", &pThis->fReadonly, false); 842 if (RT_FAILURE(rc)) 843 return PDMDRV_SET_ERROR(pDrvIns, rc, 844 N_("SCSI configuration error: failed to read \"Readonly\" as boolean")); 835 845 836 846 /* -
trunk/src/VBox/Devices/Storage/VSCSI/VSCSILunSbc.cpp
r38878 r39566 260 260 aReply[3] = 0; /* Block descriptor length. */ 261 261 262 if (pVScsiLun->fFeatures & VSCSI_LUN_FEATURE_READONLY) 263 aReply[2] |= RT_BIT(7); /* Set write protect bit */ 264 262 265 pu8ReplyPos = aReply + 4; 263 266 … … 509 512 { 510 513 /* Enqueue new I/O request */ 511 rc = vscsiIoReqTransferEnqueue(pVScsiLun, pVScsiReq, enmTxDir, 512 uLbaStart * 512, cSectorTransfer * 512); 514 if ( ( enmTxDir == VSCSIIOREQTXDIR_WRITE 515 || enmTxDir == VSCSIIOREQTXDIR_FLUSH) 516 && (pVScsiLun->fFeatures & VSCSI_LUN_FEATURE_READONLY)) 517 rcReq = vscsiLunReqSenseErrorSet(pVScsiLun, pVScsiReq, SCSI_SENSE_DATA_PROTECT, SCSI_ASC_WRITE_PROTECTED, 0x00); 518 else 519 rc = vscsiIoReqTransferEnqueue(pVScsiLun, pVScsiReq, enmTxDir, 520 uLbaStart * 512, cSectorTransfer * 512); 513 521 } 514 522 }
Note:
See TracChangeset
for help on using the changeset viewer.