Get timeout value from the registry or use default timeout.

svn path=/trunk/; revision=4632
This commit is contained in:
Eric Kohl 2003-05-01 17:50:35 +00:00
parent 85c99dd8aa
commit 8cbf35a0f7
2 changed files with 24 additions and 4 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: cdrom.c,v 1.18 2002/12/15 14:34:43 ekohl Exp $ /* $Id: cdrom.c,v 1.19 2003/05/01 17:50:03 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -44,13 +44,15 @@
#define VERSION "0.0.1" #define VERSION "0.0.1"
#define SCSI_CDROM_TIMEOUT 10 /* Default timeout: 10 seconds */
typedef struct _CDROM_DATA typedef struct _CDROM_DATA
{ {
ULONG Dummy; ULONG Dummy;
} CDROM_DATA, *PCDROM_DATA; } CDROM_DATA, *PCDROM_DATA;
BOOLEAN STDCALL BOOLEAN STDCALL
CdromClassFindDevices(IN PDRIVER_OBJECT DriverObject, CdromClassFindDevices(IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath, IN PUNICODE_STRING RegistryPath,
@ -461,6 +463,12 @@ CdromClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
return(STATUS_INSUFFICIENT_RESOURCES); return(STATUS_INSUFFICIENT_RESOURCES);
} }
/* Get timeout value */
DiskDeviceExtension->TimeOutValue =
ScsiClassQueryTimeOutRegistryValue(RegistryPath);
if (DiskDeviceExtension->TimeOutValue == 0)
DiskDeviceExtension->TimeOutValue = SCSI_CDROM_TIMEOUT;
/* Initialize lookaside list for SRBs */ /* Initialize lookaside list for SRBs */
ScsiClassInitializeSrbLookasideList(DiskDeviceExtension, ScsiClassInitializeSrbLookasideList(DiskDeviceExtension,
4); 4);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: disk.c,v 1.29 2003/04/29 19:49:17 ekohl Exp $ /* $Id: disk.c,v 1.30 2003/05/01 17:50:35 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -37,6 +37,8 @@
#define VERSION "0.0.1" #define VERSION "0.0.1"
#define SCSI_DISK_TIMEOUT 10 /* Default timeout: 10 seconds */
typedef struct _DISK_DATA typedef struct _DISK_DATA
{ {
@ -402,7 +404,7 @@ DiskClassCheckReadWrite(IN PDEVICE_OBJECT DeviceObject,
static NTSTATUS static NTSTATUS
DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject, DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath, /* what's this used for? */ IN PUNICODE_STRING RegistryPath,
IN PDEVICE_OBJECT PortDeviceObject, IN PDEVICE_OBJECT PortDeviceObject,
IN ULONG PortNumber, IN ULONG PortNumber,
IN ULONG DiskNumber, IN ULONG DiskNumber,
@ -515,6 +517,12 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
DiskDeviceExtension->TargetId = InquiryData->TargetId; DiskDeviceExtension->TargetId = InquiryData->TargetId;
DiskDeviceExtension->Lun = InquiryData->Lun; DiskDeviceExtension->Lun = InquiryData->Lun;
/* Get timeout value */
DiskDeviceExtension->TimeOutValue =
ScsiClassQueryTimeOutRegistryValue(RegistryPath);
if (DiskDeviceExtension->TimeOutValue == 0)
DiskDeviceExtension->TimeOutValue = SCSI_DISK_TIMEOUT;
/* Initialize the lookaside list for SRBs */ /* Initialize the lookaside list for SRBs */
ScsiClassInitializeSrbLookasideList(DiskDeviceExtension, ScsiClassInitializeSrbLookasideList(DiskDeviceExtension,
4); 4);
@ -722,6 +730,7 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
PartitionDeviceExtension->TargetId = InquiryData->TargetId; PartitionDeviceExtension->TargetId = InquiryData->TargetId;
PartitionDeviceExtension->Lun = InquiryData->Lun; PartitionDeviceExtension->Lun = InquiryData->Lun;
PartitionDeviceExtension->SectorShift = DiskDeviceExtension->SectorShift; PartitionDeviceExtension->SectorShift = DiskDeviceExtension->SectorShift;
PartitionDeviceExtension->TimeOutValue = SCSI_DISK_TIMEOUT;
/* Initialize lookaside list for SRBs */ /* Initialize lookaside list for SRBs */
ScsiClassInitializeSrbLookasideList(PartitionDeviceExtension, ScsiClassInitializeSrbLookasideList(PartitionDeviceExtension,
@ -1062,6 +1071,9 @@ DiskClassShutdownFlush(IN PDEVICE_OBJECT DeviceObject,
Srb->TargetId = DeviceExtension->TargetId; Srb->TargetId = DeviceExtension->TargetId;
Srb->Lun = DeviceExtension->Lun; Srb->Lun = DeviceExtension->Lun;
/* Set timeout */
Srb->TimeOutValue = DeviceExtension->TimeOutValue * 4;
/* Flush write cache */ /* Flush write cache */
Srb->Function = SRB_FUNCTION_EXECUTE_SCSI; Srb->Function = SRB_FUNCTION_EXECUTE_SCSI;
Srb->SrbFlags = SRB_FLAGS_NO_DATA_TRANSFER; Srb->SrbFlags = SRB_FLAGS_NO_DATA_TRANSFER;