Author: tfaber Date: Sun Nov 10 20:54:19 2013 New Revision: 60922
URL: http://svn.reactos.org/svn/reactos?rev=60922&view=rev Log: [CLASSPNP] - Do not disable compiler warnings - Fix a ton of them
Modified: trunk/reactos/drivers/storage/classpnp/CMakeLists.txt trunk/reactos/drivers/storage/classpnp/autorun.c trunk/reactos/drivers/storage/classpnp/class.c trunk/reactos/drivers/storage/classpnp/classp.h trunk/reactos/drivers/storage/classpnp/create.c trunk/reactos/drivers/storage/classpnp/debug.c trunk/reactos/drivers/storage/classpnp/debug.h trunk/reactos/drivers/storage/classpnp/power.c trunk/reactos/drivers/storage/classpnp/utils.c trunk/reactos/drivers/storage/classpnp/xferpkt.c trunk/reactos/include/ddk/classpnp.h
Modified: trunk/reactos/drivers/storage/classpnp/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/classpnp/CM... ============================================================================== --- trunk/reactos/drivers/storage/classpnp/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/classpnp/CMakeLists.txt [iso-8859-1] Sun Nov 10 20:54:19 2013 @@ -34,11 +34,8 @@
if(ARCH STREQUAL "i386") # FIXME: http://www.cmake.org/Bug/view.php?id=12998 - if(MSVC) - #add_target_compile_flags(classpnp "/Gz") - set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "/Gz") - else() - set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-w") + if(NOT MSVC) + set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=switch") endif() endif()
Modified: trunk/reactos/drivers/storage/classpnp/autorun.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/classpnp/au... ============================================================================== --- trunk/reactos/drivers/storage/classpnp/autorun.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/classpnp/autorun.c [iso-8859-1] Sun Nov 10 20:54:19 2013 @@ -103,12 +103,7 @@ IN ULONG CountDown );
-VOID -NTAPI -ClasspFailurePredict( - IN PDEVICE_OBJECT DeviceObject, - IN PFAILURE_PREDICTION_INFO Info - ); +IO_WORKITEM_ROUTINE ClasspFailurePredict;
NTSTATUS NTAPI @@ -489,7 +484,7 @@ SET_FLAG(FdoExtension->DeviceObject->Flags, DO_VERIFY_VOLUME);
} - InterlockedIncrement(&FdoExtension->MediaChangeCount); + InterlockedIncrement((PLONG)&FdoExtension->MediaChangeCount); ClasspSetMediaChangeStateEx(FdoExtension, MediaPresent, FALSE, @@ -599,7 +594,7 @@ ) { #if DBG - PUCHAR states[] = {"Unknown", "Present", "Not Present"}; + PCSTR states[] = {"Unknown", "Present", "Not Present"}; #endif MEDIA_CHANGE_DETECTION_STATE oldMediaState; PMEDIA_CHANGE_DETECTION_INFO info = FdoExtension->MediaChangeDetectionInfo; @@ -818,9 +813,10 @@ ClasspMediaChangeDetectionCompletion( PDEVICE_OBJECT DeviceObject, PIRP Irp, - PSCSI_REQUEST_BLOCK Srb + PVOID Context ) { + PSCSI_REQUEST_BLOCK srb = Context; PFUNCTIONAL_DEVICE_EXTENSION fdoExtension; PCLASS_PRIVATE_FDO_DATA fdoData; PMEDIA_CHANGE_DETECTION_INFO info; @@ -840,7 +836,7 @@ info = fdoExtension->MediaChangeDetectionInfo;
ASSERT(info->MediaChangeIrp != NULL); - ASSERT(!TEST_FLAG(Srb->SrbStatus, SRB_STATUS_QUEUE_FROZEN)); + ASSERT(!TEST_FLAG(srb->SrbStatus, SRB_STATUS_QUEUE_FROZEN)); DBGTRACE(ClassDebugMCN, ("> ClasspMediaChangeDetectionCompletion: Device %p completed MCN irp %p.", DeviceObject, Irp));
/* @@ -855,15 +851,15 @@ * This hack only applies to drives with the CAUSE_NOT_REPORTABLE_HACK bit set; this * is set by disk.sys when HackCauseNotReportableHack is set for the drive in its BadControllers list. */ - if ((SRB_STATUS(Srb->SrbStatus) != SRB_STATUS_SUCCESS) && + if ((SRB_STATUS(srb->SrbStatus) != SRB_STATUS_SUCCESS) && TEST_FLAG(fdoExtension->ScanForSpecialFlags, CLASS_SPECIAL_CAUSE_NOT_REPORTABLE_HACK) && - (Srb->SenseInfoBufferLength >= RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseCode))){ - - PSENSE_DATA senseData = Srb->SenseInfoBuffer; + (srb->SenseInfoBufferLength >= RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseCode))){ + + PSENSE_DATA senseData = srb->SenseInfoBuffer;
if ((senseData->SenseKey == SCSI_SENSE_NOT_READY) && (senseData->AdditionalSenseCode == SCSI_ADSENSE_LUN_NOT_READY)){ - Srb->SrbStatus = SRB_STATUS_SUCCESS; + srb->SrbStatus = SRB_STATUS_SUCCESS; } }
@@ -873,12 +869,12 @@ // to call ClassError() with correct parameters. // status = STATUS_SUCCESS; - if (SRB_STATUS(Srb->SrbStatus) != SRB_STATUS_SUCCESS) { - - DBGTRACE(ClassDebugMCN, ("ClasspMediaChangeDetectionCompletion - failed - srb status=%s, sense=%s/%s/%s.", DBGGETSRBSTATUSSTR(Srb), DBGGETSENSECODESTR(Srb), DBGGETADSENSECODESTR(Srb), DBGGETADSENSEQUALIFIERSTR(Srb))); + if (SRB_STATUS(srb->SrbStatus) != SRB_STATUS_SUCCESS) { + + DBGTRACE(ClassDebugMCN, ("ClasspMediaChangeDetectionCompletion - failed - srb status=%s, sense=%s/%s/%s.", DBGGETSRBSTATUSSTR(srb), DBGGETSENSECODESTR(srb), DBGGETADSENSECODESTR(srb), DBGGETADSENSEQUALIFIERSTR(srb)));
ClassInterpretSenseInfo(DeviceObject, - Srb, + srb, IRP_MJ_SCSI, 0, 0, @@ -936,8 +932,8 @@ // free port-allocated sense buffer, if any. //
- if (PORT_ALLOCATED_SENSE(fdoExtension, Srb)) { - FREE_PORT_ALLOCATED_SENSE_BUFFER(fdoExtension, Srb); + if (PORT_ALLOCATED_SENSE(fdoExtension, srb)) { + FREE_PORT_ALLOCATED_SENSE_BUFFER(fdoExtension, srb); }
// @@ -945,7 +941,7 @@ //
ASSERT(IoGetNextIrpStackLocation(Irp)); - IoGetNextIrpStackLocation(Irp)->Parameters.Scsi.Srb = Srb; + IoGetNextIrpStackLocation(Irp)->Parameters.Scsi.Srb = srb;
// // Reset the MCN timer. @@ -2394,9 +2390,9 @@ //
PWSTR nullMultiSz; - PUCHAR vendorId; - PUCHAR productId; - PUCHAR revisionId; + PCSTR vendorId; + PCSTR productId; + PCSTR revisionId; ULONG length; ULONG offset;
@@ -2417,21 +2413,21 @@ if (deviceDescriptor->VendorIdOffset == 0) { vendorId = NULL; } else { - vendorId = (PUCHAR) deviceDescriptor + deviceDescriptor->VendorIdOffset; + vendorId = (PCSTR) deviceDescriptor + deviceDescriptor->VendorIdOffset; length = strlen(vendorId); }
if ( deviceDescriptor->ProductIdOffset == 0 ) { productId = NULL; } else { - productId = (PUCHAR) deviceDescriptor + deviceDescriptor->ProductIdOffset; + productId = (PCSTR) deviceDescriptor + deviceDescriptor->ProductIdOffset; length += strlen(productId); }
if ( deviceDescriptor->ProductRevisionOffset == 0 ) { revisionId = NULL; } else { - revisionId = (PUCHAR) deviceDescriptor + deviceDescriptor->ProductRevisionOffset; + revisionId = (PCSTR) deviceDescriptor + deviceDescriptor->ProductRevisionOffset; length += strlen(revisionId); }
@@ -2441,10 +2437,10 @@
deviceString.Length = (USHORT)( length ); deviceString.MaximumLength = deviceString.Length + 1; - deviceString.Buffer = (PUCHAR)ExAllocatePoolWithTag( NonPagedPool, - deviceString.MaximumLength, - CLASS_TAG_AUTORUN_DISABLE - ); + deviceString.Buffer = ExAllocatePoolWithTag( NonPagedPool, + deviceString.MaximumLength, + CLASS_TAG_AUTORUN_DISABLE + ); if (deviceString.Buffer == NULL) { DebugPrint((ClassDebugMCN, "ClassMediaChangeDisabledForHardware: Unable to alloc " @@ -2941,7 +2937,7 @@ //
ClassDisableMediaChangeDetection(FdoExtension); - InterlockedIncrement(&(fsContext->McnDisableCount)); + InterlockedIncrement((PLONG)&fsContext->McnDisableCount);
} else {
@@ -2950,7 +2946,7 @@ LEAVE; }
- InterlockedDecrement(&(fsContext->McnDisableCount)); + InterlockedDecrement((PLONG)&fsContext->McnDisableCount); ClassEnableMediaChangeDetection(FdoExtension); }
@@ -3144,7 +3140,7 @@ // resets CountDown uses InterlockedExchange which is also // atomic. // - countDown = InterlockedDecrement(&info->CountDown); + countDown = InterlockedDecrement((PLONG)&info->CountDown); if (countDown == 0) {
DebugPrint((4, "ClasspTimerTick: Send FP irp for %p\n", @@ -3165,7 +3161,7 @@
DebugPrint((1, "ClassTimerTick: Couldn't allocate " "item - try again in one minute\n")); - InterlockedExchange(&info->CountDown, 60); + InterlockedExchange((PLONG)&info->CountDown, 60);
} else {
@@ -3343,9 +3339,10 @@ NTAPI ClasspFailurePredict( IN PDEVICE_OBJECT DeviceObject, - IN PFAILURE_PREDICTION_INFO Info + IN PVOID Context ) { + PFAILURE_PREDICTION_INFO info = Context; PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = DeviceObject->DeviceExtension; PIO_WORKITEM workItem; STORAGE_PREDICT_FAILURE checkFailure; @@ -3353,7 +3350,7 @@
NTSTATUS status;
- ASSERT(Info != NULL); + ASSERT(info != NULL);
DebugPrint((1, "ClasspFailurePredict: Polling for failure\n"));
@@ -3364,8 +3361,8 @@ // the lock. //
- InterlockedExchange(&Info->CountDown, Info->Period); - workItem = InterlockedExchangePointer(&(Info->WorkQueueItem), NULL); + InterlockedExchange((PLONG)&info->CountDown, info->Period); + workItem = InterlockedExchangePointer(&info->WorkQueueItem, NULL);
if (ClasspCanSendPollingIrp(fdoExtension)) {
@@ -3613,11 +3610,11 @@
if (PollingPeriod != 0) {
- InterlockedExchange(&info->Period, PollingPeriod); - - } - - InterlockedExchange(&info->CountDown, info->Period); + InterlockedExchange((PLONG)&info->Period, PollingPeriod); + + } + + InterlockedExchange((PLONG)&info->CountDown, info->Period);
info->Method = FailurePredictionMethod; if (FailurePredictionMethod != FailurePredictionNone) {
Modified: trunk/reactos/drivers/storage/classpnp/class.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/classpnp/cl... ============================================================================== --- trunk/reactos/drivers/storage/classpnp/class.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/classpnp/class.c [iso-8859-1] Sun Nov 10 20:54:19 2013 @@ -238,7 +238,7 @@ status = IoAllocateDriverObjectExtension(DriverObject, CLASS_DRIVER_EXTENSION_KEY, sizeof(CLASS_DRIVER_EXTENSION), - &driverExtension); + (PVOID *)&driverExtension);
if(NT_SUCCESS(status)) {
@@ -1044,7 +1044,7 @@ if (NT_SUCCESS(status)) {
IoAdjustPagingPathCount( - &commonExtension->PagingPathCount, + (PLONG)&commonExtension->PagingPathCount, irpStack->Parameters.UsageNotification.InPath);
if (irpStack->Parameters.UsageNotification.InPath) { @@ -1097,13 +1097,13 @@ case DeviceUsageTypeHibernation: {
IoAdjustPagingPathCount( - &commonExtension->HibernationPathCount, + (PLONG)&commonExtension->HibernationPathCount, irpStack->Parameters.UsageNotification.InPath ); status = ClassForwardIrpSynchronous(commonExtension, Irp); if (!NT_SUCCESS(status)) { IoAdjustPagingPathCount( - &commonExtension->HibernationPathCount, + (PLONG)&commonExtension->HibernationPathCount, !irpStack->Parameters.UsageNotification.InPath ); } @@ -1113,13 +1113,13 @@
case DeviceUsageTypeDumpFile: { IoAdjustPagingPathCount( - &commonExtension->DumpPathCount, + (PLONG)&commonExtension->DumpPathCount, irpStack->Parameters.UsageNotification.InPath ); status = ClassForwardIrpSynchronous(commonExtension, Irp); if (!NT_SUCCESS(status)) { IoAdjustPagingPathCount( - &commonExtension->DumpPathCount, + (PLONG)&commonExtension->DumpPathCount, !irpStack->Parameters.UsageNotification.InPath ); } @@ -1362,7 +1362,7 @@ status = ClassGetDescriptor( commonExtension->LowerDeviceObject, &propertyId, - &fdoExtension->AdapterDescriptor); + (PSTORAGE_DESCRIPTOR_HEADER *)&fdoExtension->AdapterDescriptor);
if(!NT_SUCCESS(status)) {
@@ -1384,7 +1384,7 @@ status = ClassGetDescriptor( commonExtension->LowerDeviceObject, &propertyId, - &fdoExtension->DeviceDescriptor); + (PSTORAGE_DESCRIPTOR_HEADER *)&fdoExtension->DeviceDescriptor);
if(!NT_SUCCESS(status)) {
@@ -2113,7 +2113,7 @@ ClassAcquireRemoveLock(Fdo, irp);
IoSetCompletionRoutine(irp, - (PIO_COMPLETION_ROUTINE)ClassAsynchronousCompletion, + ClassAsynchronousCompletion, context, TRUE, TRUE, @@ -3453,7 +3453,7 @@ // count for the physical device //
- count = InterlockedIncrement(&fdoExtension->MediaChangeCount); + count = InterlockedIncrement((PLONG)&fdoExtension->MediaChangeCount); DebugPrint((ClassDebugSenseInfo, "ClassInterpretSenseInfo: " "Media change count for device %d incremented to %#lx\n", fdoExtension->DeviceNumber, count)); @@ -3918,7 +3918,7 @@ ULONG totalSize; ULONG senseBufferSize = 0; IO_ERROR_LOG_PACKET staticErrLogEntry = {0}; - CLASS_ERROR_LOG_DATA staticErrLogData = {0}; + CLASS_ERROR_LOG_DATA staticErrLogData = { { { 0 } } };
// // Calculate the total size of the error log entry. @@ -4215,7 +4215,7 @@ IN BOOLEAN Use6Byte ) { - PUCHAR limit; + PCHAR limit; ULONG parameterHeaderLength; PVOID result = NULL;
@@ -6516,9 +6516,11 @@ ClassSignalCompletion( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, - IN PKEVENT Event + IN PVOID Context ) { + PKEVENT Event = Context; + KeSetEvent(Event, IO_NO_INCREMENT, FALSE);
return STATUS_MORE_PROCESSING_REQUIRED; @@ -6566,7 +6568,7 @@ // one. //
- if(InterlockedIncrement(&(fdoExtension->EnumerationInterlock)) == 1) { + if(InterlockedIncrement((PLONG)&fdoExtension->EnumerationInterlock) == 1) { status = driverExtension->InitData.ClassEnumerateDevice(Fdo); }
@@ -6576,7 +6578,7 @@ Fdo, BusRelations, (PDEVICE_RELATIONS*)&Irp->IoStatus.Information); - InterlockedDecrement(&(fdoExtension->EnumerationInterlock)); + InterlockedDecrement((PLONG)&fdoExtension->EnumerationInterlock);
return Irp->IoStatus.Status; } // end ClassPnpQueryFdoRelations() @@ -6929,10 +6931,10 @@ ASSERT_FDO(Fdo); ASSERT(driverExtension->InitData.ClassEnumerateDevice != NULL);
- if(InterlockedIncrement(&(fdoExtension->EnumerationInterlock)) == 1) { + if(InterlockedIncrement((PLONG)&fdoExtension->EnumerationInterlock) == 1) { status = driverExtension->InitData.ClassEnumerateDevice(Fdo); } - InterlockedDecrement(&(fdoExtension->EnumerationInterlock)); + InterlockedDecrement((PLONG)&fdoExtension->EnumerationInterlock);
if(!NT_SUCCESS(status)) {
@@ -7124,7 +7126,7 @@ * to delete it ourselves. */ ClassAcquireChildLock(fdoExtension); - while (child = ClassRemoveChild(fdoExtension, NULL, FALSE)){ + while ((child = ClassRemoveChild(fdoExtension, NULL, FALSE))){
// // Yank the pdo. This routine will unlink the device from the @@ -7332,7 +7334,7 @@ NTSTATUS status; SCSI_ADDRESS scsiAddress; OBJECT_ATTRIBUTES objectAttributes; - PUCHAR buffer; + PSTR buffer; STRING string; UNICODE_STRING unicodeName; UNICODE_STRING unicodeRegistryPath; @@ -7447,7 +7449,7 @@
RtlInitUnicodeString(&unicodeName, L"DeviceName");
- sprintf(buffer, "%s%d", DeviceName, DeviceNumber); + sprintf(buffer, "%s%lu", DeviceName, DeviceNumber); RtlInitString(&string, buffer); status = RtlAnsiStringToUnicodeString(&unicodeData, &string, @@ -8704,11 +8706,12 @@ NTAPI ClasspRetryRequestDpc( IN PKDPC Dpc, - IN PDEVICE_OBJECT DeviceObject, + IN PVOID Context, IN PVOID Arg1, IN PVOID Arg2 ) { + PDEVICE_OBJECT deviceObject = Context; PFUNCTIONAL_DEVICE_EXTENSION fdoExtension; PCOMMON_DEVICE_EXTENSION commonExtension; PCLASS_PRIVATE_FDO_DATA fdoData; @@ -8716,9 +8719,9 @@ KIRQL irql;
- commonExtension = DeviceObject->DeviceExtension; + commonExtension = deviceObject->DeviceExtension; ASSERT(commonExtension->IsFdo); - fdoExtension = DeviceObject->DeviceExtension; + fdoExtension = deviceObject->DeviceExtension; fdoData = fdoExtension->PrivateFdoData;
Modified: trunk/reactos/drivers/storage/classpnp/classp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/classpnp/cl... ============================================================================== --- trunk/reactos/drivers/storage/classpnp/classp.h [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/classpnp/classp.h [iso-8859-1] Sun Nov 10 20:54:19 2013 @@ -508,25 +508,11 @@ return (SListHdr->Next == NULL); }
-NTSTATUS -NTAPI -DriverEntry( - IN PDRIVER_OBJECT DriverObject, - IN PUNICODE_STRING RegistryPath - ); - -VOID -NTAPI -ClassUnload( - IN PDRIVER_OBJECT DriverObject - ); - -NTSTATUS -NTAPI -ClassCreateClose( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); +DRIVER_INITIALIZE DriverEntry; + +DRIVER_UNLOAD ClassUnload; + +DRIVER_DISPATCH ClassCreateClose;
NTSTATUS NTAPI @@ -550,26 +536,11 @@ IN BOOLEAN Lock );
-NTSTATUS -NTAPI -ClassReadWrite( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); - -NTSTATUS -NTAPI -ClassDeviceControlDispatch( - PDEVICE_OBJECT DeviceObject, - PIRP Irp - ); - -NTSTATUS -NTAPI -ClassDispatchPnp( - PDEVICE_OBJECT DeviceObject, - PIRP Irp - ); +DRIVER_DISPATCH ClassReadWrite; + +DRIVER_DISPATCH ClassDeviceControlDispatch; + +DRIVER_DISPATCH ClassDispatchPnp;
NTSTATUS NTAPI @@ -584,31 +555,15 @@ IN PIRP Irp );
-NTSTATUS -NTAPI -ClassSystemControl( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); +DRIVER_DISPATCH ClassSystemControl;
// // Class internal routines //
-NTSTATUS -NTAPI -ClassAddDevice( - IN PDRIVER_OBJECT DriverObject, - IN OUT PDEVICE_OBJECT PhysicalDeviceObject - ); - -NTSTATUS -NTAPI -ClasspSendSynchronousCompletion( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, - IN PVOID Context - ); +DRIVER_ADD_DEVICE ClassAddDevice; + +IO_COMPLETION_ROUTINE ClasspSendSynchronousCompletion;
VOID NTAPI @@ -658,12 +613,7 @@ IN PDEVICE_CAPABILITIES Capabilities );
-VOID -NTAPI -ClasspStartIo( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); +DRIVER_STARTIO ClasspStartIo;
NTSTATUS NTAPI @@ -767,13 +717,7 @@ IN PDEVICE_OBJECT Fdo );
-NTSTATUS -NTAPI -ClassReleaseQueueCompletion( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, - IN PVOID Context - ); +IO_COMPLETION_ROUTINE ClassReleaseQueueCompletion;
VOID NTAPI @@ -792,12 +736,7 @@ // class power routines //
-NTSTATUS -NTAPI -ClassDispatchPower( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); +DRIVER_DISPATCH ClassDispatchPower;
NTSTATUS NTAPI @@ -832,14 +771,7 @@ IN PCLASS_PRIVATE_FDO_DATA FdoData );
-VOID -NTAPI -ClasspRetryRequestDpc( - IN PKDPC Dpc, - IN PDEVICE_OBJECT DeviceObject, - IN PVOID Arg1, - IN PVOID Arg2 - ); +KDEFERRED_ROUTINE ClasspRetryRequestDpc;
VOID NTAPI
Modified: trunk/reactos/drivers/storage/classpnp/create.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/classpnp/cr... ============================================================================== --- trunk/reactos/drivers/storage/classpnp/create.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/classpnp/create.c [iso-8859-1] Sun Nov 10 20:54:19 2013 @@ -27,7 +27,7 @@
ULONG BreakOnClose = 0;
-PUCHAR LockTypeStrings[] = { +PCSTR LockTypeStrings[] = { "Simple", "Secure", "Internal" @@ -194,10 +194,10 @@
status = AllocateDictionaryEntry( &commonExtension->FileObjectDictionary, - (ULONGLONG) irpStack->FileObject, + (ULONG_PTR)irpStack->FileObject, sizeof(FILE_OBJECT_EXTENSION), CLASS_TAG_FILE_OBJECT_EXTENSION, - &fsContext); + (PVOID *)&fsContext);
if(NT_SUCCESS(status)) {
@@ -340,7 +340,7 @@
do {
- InterlockedDecrement(&FsContext->LockCount); + InterlockedDecrement((PLONG)&FsContext->LockCount);
newDeviceLockCount = InterlockedDecrement(&fdoExtension->ProtectedLockCount); @@ -977,5 +977,5 @@ { PAGED_CODE(); return GetDictionaryEntry(&(CommonExtension->FileObjectDictionary), - (ULONGLONG) FileObject); + (ULONG_PTR)FileObject); }
Modified: trunk/reactos/drivers/storage/classpnp/debug.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/classpnp/de... ============================================================================== --- trunk/reactos/drivers/storage/classpnp/debug.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/classpnp/debug.c [iso-8859-1] Sun Nov 10 20:54:19 2013 @@ -63,7 +63,9 @@ #define CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFERS 512 #endif // CLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFERS
- #pragma data_seg("NONPAGE") + #ifdef ALLOC_DATA_PRAGMA + #pragma data_seg("NONPAGE") + #endif
@@ -178,8 +180,8 @@ //
ULONG index; - PUCHAR buffer; - index = InterlockedIncrement(&ClasspnpGlobals.Index); + PSTR buffer; + index = InterlockedIncrement((PLONG)&ClasspnpGlobals.Index); index %= ClasspnpGlobals.NumberOfBuffers; index *= (ULONG)ClasspnpGlobals.EachBufferSize;
Modified: trunk/reactos/drivers/storage/classpnp/debug.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/classpnp/de... ============================================================================== --- trunk/reactos/drivers/storage/classpnp/debug.h [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/classpnp/debug.h [iso-8859-1] Sun Nov 10 20:54:19 2013 @@ -53,7 +53,7 @@
ULONG Index; // index into buffer KSPIN_LOCK SpinLock; - PUCHAR Buffer; // requires spinlock to access + PSTR Buffer; // requires spinlock to access ULONG NumberOfBuffers; // number of buffers available SIZE_T EachBufferSize; // size of each buffer
Modified: trunk/reactos/drivers/storage/classpnp/power.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/classpnp/po... ============================================================================== --- trunk/reactos/drivers/storage/classpnp/power.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/classpnp/power.c [iso-8859-1] Sun Nov 10 20:54:19 2013 @@ -33,21 +33,9 @@ IN CLASS_POWER_OPTIONS Options );
-NTSTATUS -NTAPI -ClasspPowerDownCompletion( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, - IN PCLASS_POWER_CONTEXT Context - ); - -NTSTATUS -NTAPI -ClasspPowerUpCompletion( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, - IN PCLASS_POWER_CONTEXT Context - ); +IO_COMPLETION_ROUTINE ClasspPowerDownCompletion; + +IO_COMPLETION_ROUTINE ClasspPowerUpCompletion;
VOID NTAPI @@ -159,9 +147,10 @@ ClasspPowerUpCompletion( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, - IN PCLASS_POWER_CONTEXT Context + IN PVOID CompletionContext ) { + PCLASS_POWER_CONTEXT context = CompletionContext; PCOMMON_DEVICE_EXTENSION commonExtension = DeviceObject->DeviceExtension; PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = DeviceObject->DeviceExtension;
@@ -173,20 +162,20 @@
DebugPrint((1, "ClasspPowerUpCompletion: Device Object %p, Irp %p, " "Context %p\n", - DeviceObject, Irp, Context)); - - ASSERT(!TEST_FLAG(Context->Srb.SrbFlags, SRB_FLAGS_FREE_SENSE_BUFFER)); - ASSERT(!TEST_FLAG(Context->Srb.SrbFlags, SRB_FLAGS_PORT_DRIVER_ALLOCSENSE)); - ASSERT(Context->Options.PowerDown == FALSE); - ASSERT(Context->Options.HandleSpinUp); + DeviceObject, Irp, context)); + + ASSERT(!TEST_FLAG(context->Srb.SrbFlags, SRB_FLAGS_FREE_SENSE_BUFFER)); + ASSERT(!TEST_FLAG(context->Srb.SrbFlags, SRB_FLAGS_PORT_DRIVER_ALLOCSENSE)); + ASSERT(context->Options.PowerDown == FALSE); + ASSERT(context->Options.HandleSpinUp);
if(Irp->PendingReturned) { IoMarkIrpPending(Irp); }
- Context->PowerChangeState.PowerUp++; - - switch(Context->PowerChangeState.PowerUp) { + context->PowerChangeState.PowerUp++; + + switch(context->PowerChangeState.PowerUp) {
case PowerUpDeviceLocked: {
@@ -203,13 +192,13 @@ // request unless we can ignore failed locks //
- if((Context->Options.LockQueue == TRUE) && + if((context->Options.LockQueue == TRUE) && (!NT_SUCCESS(Irp->IoStatus.Status))) {
DebugPrint((1, "(%p)\tIrp status was %lx\n", Irp, Irp->IoStatus.Status)); DebugPrint((1, "(%p)\tSrb status was %lx\n", - Irp, Context->Srb.SrbStatus)); + Irp, context->Srb.SrbStatus));
// // Lock was not successful - throw down the power IRP @@ -217,8 +206,8 @@ // the queue. //
- Context->InUse = FALSE; - Context = NULL; + context->InUse = FALSE; + context = NULL;
// // Set the new power state @@ -255,16 +244,16 @@ return STATUS_MORE_PROCESSING_REQUIRED;
} else { - Context->QueueLocked = (UCHAR) Context->Options.LockQueue; + context->QueueLocked = (UCHAR) context->Options.LockQueue; }
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
- Context->PowerChangeState.PowerUp = PowerUpDeviceLocked; + context->PowerChangeState.PowerUp = PowerUpDeviceLocked;
IoSetCompletionRoutine(Irp, ClasspPowerUpCompletion, - Context, + context, TRUE, TRUE, TRUE); @@ -287,42 +276,42 @@ // Issue the start unit command to the device. //
- Context->Srb.Length = sizeof(SCSI_REQUEST_BLOCK); - Context->Srb.Function = SRB_FUNCTION_EXECUTE_SCSI; - - Context->Srb.SrbStatus = Context->Srb.ScsiStatus = 0; - Context->Srb.DataTransferLength = 0; - - Context->Srb.TimeOutValue = START_UNIT_TIMEOUT; - - Context->Srb.SrbFlags = SRB_FLAGS_NO_DATA_TRANSFER | + context->Srb.Length = sizeof(SCSI_REQUEST_BLOCK); + context->Srb.Function = SRB_FUNCTION_EXECUTE_SCSI; + + context->Srb.SrbStatus = context->Srb.ScsiStatus = 0; + context->Srb.DataTransferLength = 0; + + context->Srb.TimeOutValue = START_UNIT_TIMEOUT; + + context->Srb.SrbFlags = SRB_FLAGS_NO_DATA_TRANSFER | SRB_FLAGS_DISABLE_AUTOSENSE | SRB_FLAGS_DISABLE_SYNCH_TRANSFER | SRB_FLAGS_NO_QUEUE_FREEZE;
- if(Context->Options.LockQueue) { - SET_FLAG(Context->Srb.SrbFlags, SRB_FLAGS_BYPASS_LOCKED_QUEUE); + if(context->Options.LockQueue) { + SET_FLAG(context->Srb.SrbFlags, SRB_FLAGS_BYPASS_LOCKED_QUEUE); }
- Context->Srb.CdbLength = 6; - - cdb = (PCDB) (Context->Srb.Cdb); + context->Srb.CdbLength = 6; + + cdb = (PCDB) (context->Srb.Cdb); RtlZeroMemory(cdb, sizeof(CDB));
cdb->START_STOP.OperationCode = SCSIOP_START_STOP_UNIT; cdb->START_STOP.Start = 1;
- Context->PowerChangeState.PowerUp = PowerUpDeviceOn; + context->PowerChangeState.PowerUp = PowerUpDeviceOn;
IoSetCompletionRoutine(Irp, ClasspPowerUpCompletion, - Context, + context, TRUE, TRUE, TRUE);
- nextStack->Parameters.Scsi.Srb = &(Context->Srb); + nextStack->Parameters.Scsi.Srb = &(context->Srb); nextStack->MajorFunction = IRP_MJ_SCSI;
status = IoCallDriver(commonExtension->LowerDeviceObject, Irp); @@ -335,7 +324,7 @@ // we're done. //
- Context->FinalStatus = Irp->IoStatus.Status; + context->FinalStatus = Irp->IoStatus.Status; goto ClasspPowerUpCompletionFailure; }
@@ -348,32 +337,32 @@ // First deal with an error if one occurred. //
- if(SRB_STATUS(Context->Srb.SrbStatus) != SRB_STATUS_SUCCESS) { + if(SRB_STATUS(context->Srb.SrbStatus) != SRB_STATUS_SUCCESS) {
BOOLEAN retry;
DebugPrint((1, "%p\tError occured when issuing START_UNIT " "command to device. Srb %p, Status %x\n", Irp, - &Context->Srb, - Context->Srb.SrbStatus)); - - ASSERT(!(TEST_FLAG(Context->Srb.SrbStatus, + &context->Srb, + context->Srb.SrbStatus)); + + ASSERT(!(TEST_FLAG(context->Srb.SrbStatus, SRB_STATUS_QUEUE_FROZEN))); - ASSERT(Context->Srb.Function == SRB_FUNCTION_EXECUTE_SCSI); - - Context->RetryInterval = 0; + ASSERT(context->Srb.Function == SRB_FUNCTION_EXECUTE_SCSI); + + context->RetryInterval = 0;
retry = ClassInterpretSenseInfo( commonExtension->DeviceObject, - &Context->Srb, + &context->Srb, IRP_MJ_SCSI, IRP_MJ_POWER, - MAXIMUM_RETRIES - Context->RetryCount, + MAXIMUM_RETRIES - context->RetryCount, &status, - &Context->RetryInterval); - - if((retry == TRUE) && (Context->RetryCount-- != 0)) { + &context->RetryInterval); + + if((retry == TRUE) && (context->RetryCount-- != 0)) {
DebugPrint((1, "(%p)\tRetrying failed request\n", Irp));
@@ -382,18 +371,18 @@ // next time. //
- Context->PowerChangeState.PowerUp--; + context->PowerChangeState.PowerUp--;
RetryPowerRequest(commonExtension->DeviceObject, Irp, - Context); + context);
break;
} - + // reset retries - Context->RetryCount = MAXIMUM_RETRIES; + context->RetryCount = MAXIMUM_RETRIES;
}
@@ -401,22 +390,22 @@
DebugPrint((1, "(%p)\tPreviously spun device up\n", Irp));
- if (Context->QueueLocked) { + if (context->QueueLocked) { DebugPrint((1, "(%p)\tUnlocking queue\n", Irp));
- Context->Srb.Function = SRB_FUNCTION_UNLOCK_QUEUE; - Context->Srb.SrbFlags = SRB_FLAGS_BYPASS_LOCKED_QUEUE; - Context->Srb.SrbStatus = Context->Srb.ScsiStatus = 0; - Context->Srb.DataTransferLength = 0; - - nextStack->Parameters.Scsi.Srb = &(Context->Srb); + context->Srb.Function = SRB_FUNCTION_UNLOCK_QUEUE; + context->Srb.SrbFlags = SRB_FLAGS_BYPASS_LOCKED_QUEUE; + context->Srb.SrbStatus = context->Srb.ScsiStatus = 0; + context->Srb.DataTransferLength = 0; + + nextStack->Parameters.Scsi.Srb = &(context->Srb); nextStack->MajorFunction = IRP_MJ_SCSI;
- Context->PowerChangeState.PowerUp = PowerUpDeviceStarted; + context->PowerChangeState.PowerUp = PowerUpDeviceStarted;
IoSetCompletionRoutine(Irp, ClasspPowerUpCompletion, - Context, + context, TRUE, TRUE, TRUE); @@ -439,21 +428,21 @@ // error conditions .... //
- if (Context->QueueLocked) { + if (context->QueueLocked) { DebugPrint((1, "(%p)\tPreviously unlocked queue\n", Irp)); ASSERT(NT_SUCCESS(Irp->IoStatus.Status)); - ASSERT(Context->Srb.SrbStatus == SRB_STATUS_SUCCESS); + ASSERT(context->Srb.SrbStatus == SRB_STATUS_SUCCESS); } else { DebugPrint((1, "(%p)\tFall-through (queue not locked)\n", Irp)); }
DebugPrint((1, "(%p)\tFreeing srb and completing\n", Irp)); - Context->InUse = FALSE; - - status = Context->FinalStatus; + context->InUse = FALSE; + + status = context->FinalStatus; Irp->IoStatus.Status = status;
- Context = NULL; + context = NULL;
// // Set the new power state @@ -528,9 +517,10 @@ ClasspPowerDownCompletion( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, - IN PCLASS_POWER_CONTEXT Context + IN PVOID CompletionContext ) { + PCLASS_POWER_CONTEXT context = CompletionContext; PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = DeviceObject->DeviceExtension; PCOMMON_DEVICE_EXTENSION commonExtension = DeviceObject->DeviceExtension;
@@ -541,20 +531,20 @@
DebugPrint((1, "ClasspPowerDownCompletion: Device Object %p, " "Irp %p, Context %p\n", - DeviceObject, Irp, Context)); - - ASSERT(!TEST_FLAG(Context->Srb.SrbFlags, SRB_FLAGS_FREE_SENSE_BUFFER)); - ASSERT(!TEST_FLAG(Context->Srb.SrbFlags, SRB_FLAGS_PORT_DRIVER_ALLOCSENSE)); - ASSERT(Context->Options.PowerDown == TRUE); - ASSERT(Context->Options.HandleSpinDown); + DeviceObject, Irp, context)); + + ASSERT(!TEST_FLAG(context->Srb.SrbFlags, SRB_FLAGS_FREE_SENSE_BUFFER)); + ASSERT(!TEST_FLAG(context->Srb.SrbFlags, SRB_FLAGS_PORT_DRIVER_ALLOCSENSE)); + ASSERT(context->Options.PowerDown == TRUE); + ASSERT(context->Options.HandleSpinDown);
if(Irp->PendingReturned) { IoMarkIrpPending(Irp); }
- Context->PowerChangeState.PowerDown2++; - - switch(Context->PowerChangeState.PowerDown2) { + context->PowerChangeState.PowerDown2++; + + switch(context->PowerChangeState.PowerDown2) {
case PowerDownDeviceLocked2: {
@@ -562,7 +552,7 @@
DebugPrint((1, "(%p)\tPreviously sent power lock\n", Irp));
- if((Context->Options.LockQueue == TRUE) && + if((context->Options.LockQueue == TRUE) && (!NT_SUCCESS(Irp->IoStatus.Status))) {
DebugPrint((1, "(%p)\tIrp status was %lx\n", @@ -570,7 +560,7 @@ Irp->IoStatus.Status)); DebugPrint((1, "(%p)\tSrb status was %lx\n", Irp, - Context->Srb.SrbStatus)); + context->Srb.SrbStatus));
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
@@ -580,8 +570,8 @@ // the queue. //
- Context->InUse = FALSE; - Context = NULL; + context->InUse = FALSE; + context = NULL;
// // Set the new power state @@ -617,7 +607,7 @@ return STATUS_MORE_PROCESSING_REQUIRED;
} else { - Context->QueueLocked = (UCHAR) Context->Options.LockQueue; + context->QueueLocked = (UCHAR) context->Options.LockQueue; }
if (!TEST_FLAG(fdoExtension->PrivateFdoData->HackFlags, @@ -626,49 +616,49 @@ // // send SCSIOP_SYNCHRONIZE_CACHE // - - Context->Srb.Length = sizeof(SCSI_REQUEST_BLOCK); - Context->Srb.Function = SRB_FUNCTION_EXECUTE_SCSI; - - Context->Srb.TimeOutValue = fdoExtension->TimeOutValue; - - Context->Srb.SrbFlags = SRB_FLAGS_NO_DATA_TRANSFER | + + context->Srb.Length = sizeof(SCSI_REQUEST_BLOCK); + context->Srb.Function = SRB_FUNCTION_EXECUTE_SCSI; + + context->Srb.TimeOutValue = fdoExtension->TimeOutValue; + + context->Srb.SrbFlags = SRB_FLAGS_NO_DATA_TRANSFER | SRB_FLAGS_DISABLE_AUTOSENSE | SRB_FLAGS_DISABLE_SYNCH_TRANSFER | SRB_FLAGS_NO_QUEUE_FREEZE | SRB_FLAGS_BYPASS_LOCKED_QUEUE; - - Context->Srb.SrbStatus = Context->Srb.ScsiStatus = 0; - Context->Srb.DataTransferLength = 0; - - Context->Srb.CdbLength = 10; - - cdb = (PCDB) Context->Srb.Cdb; - + + context->Srb.SrbStatus = context->Srb.ScsiStatus = 0; + context->Srb.DataTransferLength = 0; + + context->Srb.CdbLength = 10; + + cdb = (PCDB) context->Srb.Cdb; + RtlZeroMemory(cdb, sizeof(CDB)); cdb->SYNCHRONIZE_CACHE10.OperationCode = SCSIOP_SYNCHRONIZE_CACHE; - + IoSetCompletionRoutine(Irp, ClasspPowerDownCompletion, - Context, + context, TRUE, TRUE, TRUE); - - nextStack->Parameters.Scsi.Srb = &(Context->Srb); + + nextStack->Parameters.Scsi.Srb = &(context->Srb); nextStack->MajorFunction = IRP_MJ_SCSI; - + status = IoCallDriver(commonExtension->LowerDeviceObject, Irp); - + DebugPrint((1, "(%p)\tIoCallDriver returned %lx\n", Irp, status)); break; - + } else { - + DebugPrint((1, "(%p)\tPower Down: not sending SYNCH_CACHE\n", DeviceObject)); - Context->PowerChangeState.PowerDown2++; - Context->Srb.SrbStatus = SRB_STATUS_SUCCESS; + context->PowerChangeState.PowerDown2++; + context->Srb.SrbStatus = SRB_STATUS_SUCCESS; // and fall through.... } // no break in case the device doesn't like synch_cache commands @@ -686,7 +676,7 @@ // SCSIOP_SYNCHRONIZE_CACHE was sent //
- if(SRB_STATUS(Context->Srb.SrbStatus) != SRB_STATUS_SUCCESS) { + if(SRB_STATUS(context->Srb.SrbStatus) != SRB_STATUS_SUCCESS) {
BOOLEAN retry;
@@ -694,24 +684,24 @@ "SYNCHRONIZE_CACHE command to device. " "Srb %p, Status %lx\n", Irp, - &Context->Srb, - Context->Srb.SrbStatus)); - - ASSERT(!(TEST_FLAG(Context->Srb.SrbStatus, + &context->Srb, + context->Srb.SrbStatus)); + + ASSERT(!(TEST_FLAG(context->Srb.SrbStatus, SRB_STATUS_QUEUE_FROZEN))); - ASSERT(Context->Srb.Function == SRB_FUNCTION_EXECUTE_SCSI); - - Context->RetryInterval = 0; + ASSERT(context->Srb.Function == SRB_FUNCTION_EXECUTE_SCSI); + + context->RetryInterval = 0; retry = ClassInterpretSenseInfo( commonExtension->DeviceObject, - &Context->Srb, + &context->Srb, IRP_MJ_SCSI, IRP_MJ_POWER, - MAXIMUM_RETRIES - Context->RetryCount, + MAXIMUM_RETRIES - context->RetryCount, &status, - &Context->RetryInterval); - - if((retry == TRUE) && (Context->RetryCount-- != 0)) { + &context->RetryInterval); + + if((retry == TRUE) && (context->RetryCount-- != 0)) {
DebugPrint((1, "(%p)\tRetrying failed request\n", Irp));
@@ -720,15 +710,15 @@ // the next time. //
- Context->PowerChangeState.PowerDown2--; + context->PowerChangeState.PowerDown2--; RetryPowerRequest(commonExtension->DeviceObject, Irp, - Context); + context); break; }
DebugPrint((1, "(%p)\tSYNCHRONIZE_CACHE not retried\n", Irp)); - Context->RetryCount = MAXIMUM_RETRIES; + context->RetryCount = MAXIMUM_RETRIES;
} // end !SRB_STATUS_SUCCESS
@@ -744,23 +734,23 @@ // Issue the start unit command to the device. //
- Context->Srb.Length = sizeof(SCSI_REQUEST_BLOCK); - Context->Srb.Function = SRB_FUNCTION_EXECUTE_SCSI; - - Context->Srb.TimeOutValue = START_UNIT_TIMEOUT; - - Context->Srb.SrbFlags = SRB_FLAGS_NO_DATA_TRANSFER | + context->Srb.Length = sizeof(SCSI_REQUEST_BLOCK); + context->Srb.Function = SRB_FUNCTION_EXECUTE_SCSI; + + context->Srb.TimeOutValue = START_UNIT_TIMEOUT; + + context->Srb.SrbFlags = SRB_FLAGS_NO_DATA_TRANSFER | SRB_FLAGS_DISABLE_AUTOSENSE | SRB_FLAGS_DISABLE_SYNCH_TRANSFER | SRB_FLAGS_NO_QUEUE_FREEZE | SRB_FLAGS_BYPASS_LOCKED_QUEUE;
- Context->Srb.SrbStatus = Context->Srb.ScsiStatus = 0; - Context->Srb.DataTransferLength = 0; - - Context->Srb.CdbLength = 6; - - cdb = (PCDB) Context->Srb.Cdb; + context->Srb.SrbStatus = context->Srb.ScsiStatus = 0; + context->Srb.DataTransferLength = 0; + + context->Srb.CdbLength = 6; + + cdb = (PCDB) context->Srb.Cdb; RtlZeroMemory(cdb, sizeof(CDB));
cdb->START_STOP.OperationCode = SCSIOP_START_STOP_UNIT; @@ -769,12 +759,12 @@
IoSetCompletionRoutine(Irp, ClasspPowerDownCompletion, - Context, + context, TRUE, TRUE, TRUE);
- nextStack->Parameters.Scsi.Srb = &(Context->Srb); + nextStack->Parameters.Scsi.Srb = &(context->Srb); nextStack->MajorFunction = IRP_MJ_SCSI;
status = IoCallDriver(commonExtension->LowerDeviceObject, Irp); @@ -792,31 +782,31 @@ // stop was sent //
- if(SRB_STATUS(Context->Srb.SrbStatus) != SRB_STATUS_SUCCESS) { + if(SRB_STATUS(context->Srb.SrbStatus) != SRB_STATUS_SUCCESS) {
BOOLEAN retry;
DebugPrint((1, "(%p)\tError occured when issueing STOP_UNIT " "command to device. Srb %p, Status %lx\n", Irp, - &Context->Srb, - Context->Srb.SrbStatus)); - - ASSERT(!(TEST_FLAG(Context->Srb.SrbStatus, + &context->Srb, + context->Srb.SrbStatus)); + + ASSERT(!(TEST_FLAG(context->Srb.SrbStatus, SRB_STATUS_QUEUE_FROZEN))); - ASSERT(Context->Srb.Function == SRB_FUNCTION_EXECUTE_SCSI); - - Context->RetryInterval = 0; + ASSERT(context->Srb.Function == SRB_FUNCTION_EXECUTE_SCSI); + + context->RetryInterval = 0; retry = ClassInterpretSenseInfo( commonExtension->DeviceObject, - &Context->Srb, + &context->Srb, IRP_MJ_SCSI, IRP_MJ_POWER, - MAXIMUM_RETRIES - Context->RetryCount, + MAXIMUM_RETRIES - context->RetryCount, &status, - &Context->RetryInterval); - - if((retry == TRUE) && (Context->RetryCount-- != 0)) { + &context->RetryInterval); + + if((retry == TRUE) && (context->RetryCount-- != 0)) {
DebugPrint((1, "(%p)\tRetrying failed request\n", Irp));
@@ -825,15 +815,15 @@ // the next time. //
- Context->PowerChangeState.PowerDown2--; + context->PowerChangeState.PowerDown2--; RetryPowerRequest(commonExtension->DeviceObject, Irp, - Context); + context); break; }
DebugPrint((1, "(%p)\tSTOP_UNIT not retried\n", Irp)); - Context->RetryCount = MAXIMUM_RETRIES; + context->RetryCount = MAXIMUM_RETRIES;
} // end !SRB_STATUS_SUCCESS
@@ -846,18 +836,18 @@ //
if (!NT_SUCCESS(status)) { - - PSENSE_DATA senseBuffer = Context->Srb.SenseInfoBuffer; - - if (TEST_FLAG(Context->Srb.SrbStatus, + + PSENSE_DATA senseBuffer = context->Srb.SenseInfoBuffer; + + if (TEST_FLAG(context->Srb.SrbStatus, SRB_STATUS_AUTOSENSE_VALID) && ((senseBuffer->SenseKey & 0xf) == SCSI_SENSE_NOT_READY) && (senseBuffer->AdditionalSenseCode == SCSI_ADSENSE_LUN_NOT_READY) && (senseBuffer->AdditionalSenseCodeQualifier == SCSI_SENSEQ_FORMAT_IN_PROGRESS) ) { ignoreError = FALSE; - Context->FinalStatus = STATUS_DEVICE_BUSY; - status = Context->FinalStatus; + context->FinalStatus = STATUS_DEVICE_BUSY; + status = context->FinalStatus; }
} @@ -874,7 +864,7 @@
IoSetCompletionRoutine(Irp, ClasspPowerDownCompletion, - Context, + context, TRUE, TRUE, TRUE); @@ -900,23 +890,23 @@
DebugPrint((1, "(%p)\tPreviously sent power irp\n", Irp));
- if (Context->QueueLocked) { + if (context->QueueLocked) {
DebugPrint((1, "(%p)\tUnlocking queue\n", Irp)); - - Context->Srb.Length = sizeof(SCSI_REQUEST_BLOCK); - - Context->Srb.SrbStatus = Context->Srb.ScsiStatus = 0; - Context->Srb.DataTransferLength = 0; - - Context->Srb.Function = SRB_FUNCTION_UNLOCK_QUEUE; - Context->Srb.SrbFlags = SRB_FLAGS_BYPASS_LOCKED_QUEUE; - nextStack->Parameters.Scsi.Srb = &(Context->Srb); + + context->Srb.Length = sizeof(SCSI_REQUEST_BLOCK); + + context->Srb.SrbStatus = context->Srb.ScsiStatus = 0; + context->Srb.DataTransferLength = 0; + + context->Srb.Function = SRB_FUNCTION_UNLOCK_QUEUE; + context->Srb.SrbFlags = SRB_FLAGS_BYPASS_LOCKED_QUEUE; + nextStack->Parameters.Scsi.Srb = &(context->Srb); nextStack->MajorFunction = IRP_MJ_SCSI;
IoSetCompletionRoutine(Irp, ClasspPowerDownCompletion, - Context, + context, TRUE, TRUE, TRUE); @@ -938,18 +928,18 @@ // error conditions .... //
- if (Context->QueueLocked == FALSE) { + if (context->QueueLocked == FALSE) { DebugPrint((1, "(%p)\tFall through (queue not locked)\n", Irp)); } else { DebugPrint((1, "(%p)\tPreviously unlocked queue\n", Irp)); ASSERT(NT_SUCCESS(Irp->IoStatus.Status)); - ASSERT(Context->Srb.SrbStatus == SRB_STATUS_SUCCESS); + ASSERT(context->Srb.SrbStatus == SRB_STATUS_SUCCESS); }
DebugPrint((1, "(%p)\tFreeing srb and completing\n", Irp)); - Context->InUse = FALSE; - status = Context->FinalStatus; // allow failure to propogate - Context = NULL; + context->InUse = FALSE; + status = context->FinalStatus; // allow failure to propogate + context = NULL;
if(Irp->PendingReturned) { IoMarkIrpPending(Irp);
Modified: trunk/reactos/drivers/storage/classpnp/utils.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/classpnp/ut... ============================================================================== --- trunk/reactos/drivers/storage/classpnp/utils.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/classpnp/utils.c [iso-8859-1] Sun Nov 10 20:54:19 2013 @@ -31,7 +31,7 @@ #endif
// custom string match -- careful! -BOOLEAN NTAPI ClasspMyStringMatches(IN PCHAR StringToMatch OPTIONAL, IN PCHAR TargetString) +BOOLEAN NTAPI ClasspMyStringMatches(IN PCSTR StringToMatch OPTIONAL, IN PCSTR TargetString) { ULONG length; // strlen returns an int, not size_t (!) PAGED_CODE(); @@ -217,10 +217,10 @@ IN PCLASS_SCAN_FOR_SPECIAL_HANDLER Function) { PSTORAGE_DEVICE_DESCRIPTOR deviceDescriptor; - PUCHAR vendorId; - PUCHAR productId; - PUCHAR productRevision; - UCHAR nullString[] = ""; + PCSTR vendorId; + PCSTR productId; + PCSTR productRevision; + CHAR nullString[] = ""; //ULONG j;
PAGED_CODE(); @@ -242,21 +242,21 @@
if (deviceDescriptor->VendorIdOffset != 0 && deviceDescriptor->VendorIdOffset != -1) { - vendorId = ((PUCHAR)deviceDescriptor); + vendorId = ((PCSTR)deviceDescriptor); vendorId += deviceDescriptor->VendorIdOffset; } else { vendorId = nullString; } if (deviceDescriptor->ProductIdOffset != 0 && deviceDescriptor->ProductIdOffset != -1) { - productId = ((PUCHAR)deviceDescriptor); + productId = ((PCSTR)deviceDescriptor); productId += deviceDescriptor->ProductIdOffset; } else { productId = nullString; } if (deviceDescriptor->VendorIdOffset != 0 && deviceDescriptor->VendorIdOffset != -1) { - productRevision = ((PUCHAR)deviceDescriptor); + productRevision = ((PCSTR)deviceDescriptor); productRevision += deviceDescriptor->ProductRevisionOffset; } else { productRevision = nullString; @@ -342,7 +342,7 @@ KeAcquireSpinLock(&fdoData->SpinLock, &oldIrql);
fdoData->Perf.SuccessfulIO = 0; // implicit interlock - errors = InterlockedIncrement(&FdoExtension->ErrorCount); + errors = InterlockedIncrement((PLONG)&FdoExtension->ErrorCount);
if (errors >= CLASS_ERROR_LEVEL_1) {
@@ -405,7 +405,7 @@ return; }
- succeeded = InterlockedIncrement(&fdoData->Perf.SuccessfulIO); + succeeded = InterlockedIncrement((PLONG)&fdoData->Perf.SuccessfulIO); if (succeeded < fdoData->Perf.ReEnableThreshhold) { return; } @@ -433,7 +433,7 @@ fdoData->Perf.SuccessfulIO = 0; // implicit interlock
ASSERT(FdoExtension->ErrorCount > 0); - errors = InterlockedDecrement(&FdoExtension->ErrorCount); + errors = InterlockedDecrement((PLONG)&FdoExtension->ErrorCount);
// // note: do in reverse order of the sets "just in case"
Modified: trunk/reactos/drivers/storage/classpnp/xferpkt.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/classpnp/xf... ============================================================================== --- trunk/reactos/drivers/storage/classpnp/xferpkt.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/classpnp/xferpkt.c [iso-8859-1] Sun Nov 10 20:54:19 2013 @@ -107,7 +107,7 @@ while (fdoData->NumFreeTransferPackets < MIN_INITIAL_TRANSFER_PACKETS){ PTRANSFER_PACKET pkt = NewTransferPacket(Fdo); if (pkt){ - InterlockedIncrement(&fdoData->NumTotalTransferPackets); + InterlockedIncrement((PLONG)&fdoData->NumTotalTransferPackets); EnqueueFreeTransferPacket(Fdo, pkt); } else { @@ -142,9 +142,9 @@
ASSERT(IsListEmpty(&fdoData->DeferredClientIrpList));
- while (pkt = DequeueFreeTransferPacket(Fdo, FALSE)){ + while ((pkt = DequeueFreeTransferPacket(Fdo, FALSE))){ DestroyTransferPacket(pkt); - InterlockedDecrement(&fdoData->NumTotalTransferPackets); + InterlockedDecrement((PLONG)&fdoData->NumTotalTransferPackets); }
ASSERT(fdoData->NumTotalTransferPackets == 0); @@ -225,7 +225,7 @@ ASSERT(!Pkt->SlistEntry.Next);
InterlockedPushEntrySList(&fdoData->FreeTransferPacketsList, &Pkt->SlistEntry); - newNumPkts = InterlockedIncrement(&fdoData->NumFreeTransferPackets); + newNumPkts = InterlockedIncrement((PLONG)&fdoData->NumFreeTransferPackets); ASSERT(newNumPkts <= fdoData->NumTotalTransferPackets);
/* @@ -264,7 +264,7 @@ pktToDelete = DequeueFreeTransferPacket(Fdo, FALSE); if (pktToDelete){ SimplePushSlist(&pktList, &pktToDelete->SlistEntry); - InterlockedDecrement(&fdoData->NumTotalTransferPackets); + InterlockedDecrement((PLONG)&fdoData->NumTotalTransferPackets); } else { DBGTRACE(ClassDebugTrace, ("Extremely unlikely condition (non-fatal): %d packets dequeued at once for Fdo %p. NumTotalTransferPackets=%d (1).", MaxWorkingSetTransferPackets, Fdo, fdoData->NumTotalTransferPackets)); @@ -273,7 +273,7 @@ } KeReleaseSpinLock(&fdoData->SpinLock, oldIrql);
- while (slistEntry = SimplePopSlist(&pktList)){ + while ((slistEntry = SimplePopSlist(&pktList))){ pktToDelete = CONTAINING_RECORD(slistEntry, TRANSFER_PACKET, SlistEntry); DestroyTransferPacket(pktToDelete); } @@ -303,7 +303,7 @@
pktToDelete = DequeueFreeTransferPacket(Fdo, FALSE); if (pktToDelete){ - InterlockedDecrement(&fdoData->NumTotalTransferPackets); + InterlockedDecrement((PLONG)&fdoData->NumTotalTransferPackets); } else { DBGTRACE(ClassDebugTrace, ("Extremely unlikely condition (non-fatal): %d packets dequeued at once for Fdo %p. NumTotalTransferPackets=%d (2).", MinWorkingSetTransferPackets, Fdo, fdoData->NumTotalTransferPackets)); @@ -333,7 +333,7 @@ slistEntry->Next = NULL; pkt = CONTAINING_RECORD(slistEntry, TRANSFER_PACKET, SlistEntry); ASSERT(fdoData->NumFreeTransferPackets > 0); - InterlockedDecrement(&fdoData->NumFreeTransferPackets); + InterlockedDecrement((PLONG)&fdoData->NumFreeTransferPackets); } else { if (AllocIfNeeded){ @@ -345,7 +345,7 @@ */ pkt = NewTransferPacket(Fdo); if (pkt){ - InterlockedIncrement(&fdoData->NumTotalTransferPackets); + InterlockedIncrement((PLONG)&fdoData->NumTotalTransferPackets); fdoData->DbgPeakNumTransferPackets = max(fdoData->DbgPeakNumTransferPackets, fdoData->NumTotalTransferPackets); } else {
Modified: trunk/reactos/include/ddk/classpnp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/classpnp.h?rev=... ============================================================================== --- trunk/reactos/include/ddk/classpnp.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/classpnp.h [iso-8859-1] Sun Nov 10 20:54:19 2013 @@ -1134,12 +1134,7 @@ ClassReleaseChildLock( _In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension);
-NTSTATUS -NTAPI -ClassSignalCompletion( - PDEVICE_OBJECT DeviceObject, - PIRP Irp, - PKEVENT Event); +IO_COMPLETION_ROUTINE ClassSignalCompletion;
VOID NTAPI