Author: janderwald
Date: Fri Feb 17 12:07:17 2012
New Revision: 55669
URL:
http://svn.reactos.org/svn/reactos?rev=55669&view=rev
Log:
[CDROM_NEW]
- Misc build fixes for mingw and msvc with cmake
Added:
trunk/reactos/drivers/storage/class/cdrom_new/CMakeLists.txt (with props)
Modified:
trunk/reactos/drivers/storage/class/CMakeLists.txt
trunk/reactos/drivers/storage/class/cdrom_new/cdrom.c
trunk/reactos/drivers/storage/class/cdrom_new/cdrom.h
trunk/reactos/drivers/storage/class/cdrom_new/ioctl.c
trunk/reactos/drivers/storage/class/cdrom_new/mmc.c
Modified: trunk/reactos/drivers/storage/class/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/CMak…
==============================================================================
--- trunk/reactos/drivers/storage/class/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/drivers/storage/class/CMakeLists.txt [iso-8859-1] Fri Feb 17 12:07:17
2012
@@ -1,5 +1,5 @@
-
add_subdirectory(cdrom)
+add_subdirectory(cdrom_new)
add_subdirectory(class2)
add_subdirectory(disk)
add_subdirectory(disk_new)
Added: trunk/reactos/drivers/storage/class/cdrom_new/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/cdro…
==============================================================================
--- trunk/reactos/drivers/storage/class/cdrom_new/CMakeLists.txt (added)
+++ trunk/reactos/drivers/storage/class/cdrom_new/CMakeLists.txt [iso-8859-1] Fri Feb 17
12:07:17 2012
@@ -1,0 +1,15 @@
+include_directories(..)
+
+add_library(cdrom_new SHARED cdrom.c data.c ioctl.c mmc.c sec.c)
+
+target_link_libraries(cdrom_new libcntpr wdmguid)
+if(ARCH MATCHES i386)
+ if(MSVC)
+ add_target_compile_flags(cdrom_new "/Gz")
+ else()
+ add_target_compile_flags(cdrom_new "-mrtd -fno-builtin -Wno-unused-variable
-Wno-pointer-sign")
+ endif()
+endif()
+
+set_module_type(cdrom_new kernelmodedriver)
+add_importlibs(cdrom_new classpnp ntoskrnl hal)
Propchange: trunk/reactos/drivers/storage/class/cdrom_new/CMakeLists.txt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/drivers/storage/class/cdrom_new/cdrom.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/cdro…
==============================================================================
--- trunk/reactos/drivers/storage/class/cdrom_new/cdrom.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/storage/class/cdrom_new/cdrom.c [iso-8859-1] Fri Feb 17 12:07:17
2012
@@ -114,7 +114,7 @@
status = IoAllocateDriverObjectExtension(DriverObject,
CDROM_DRIVER_EXTENSION_ID,
sizeof(CDROM_DRIVER_EXTENSION),
- &driverExtension);
+ (PVOID*)&driverExtension);
if (!NT_SUCCESS(status)) {
TraceLog((CdromDebugWarning,
@@ -555,7 +555,7 @@
PVOID senseData = NULL;
ULONG timeOut;
- PCDROM_DATA cddata;
+ PCDROM_DATA cddata = NULL;
BOOLEAN changerDevice;
BOOLEAN isMmcDevice = FALSE;
@@ -3366,7 +3366,7 @@
}
if ((startingOffset.QuadPart > commonExtension->PartitionLength.QuadPart) ||
- (transferByteCount & fdoExtension->DiskGeometry.BytesPerSector - 1)) {
+ (transferByteCount & (fdoExtension->DiskGeometry.BytesPerSector - 1))) {
//
// Fail request with status of invalid parameters.
@@ -3390,18 +3390,18 @@
IN PVOID Context
)
{
- PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = DeviceObject->DeviceExtension;
- PCOMMON_DEVICE_EXTENSION commonExtension = DeviceObject->DeviceExtension;
-
- PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation(Irp);
- PCDROM_DATA cdData = (PCDROM_DATA)(commonExtension->DriverData);
- BOOLEAN use6Byte = TEST_FLAG(cdData->XAFlags, XA_USE_6_BYTE);
PIO_STACK_LOCATION realIrpStack;
PIO_STACK_LOCATION realIrpNextStack;
- PSCSI_REQUEST_BLOCK srb = Context;
PIRP realIrp = NULL;
NTSTATUS status;
BOOLEAN retry;
+ PSCSI_REQUEST_BLOCK srb = Context;
+ PFUNCTIONAL_DEVICE_EXTENSION fdoExtension = DeviceObject->DeviceExtension;
+ PCOMMON_DEVICE_EXTENSION commonExtension = DeviceObject->DeviceExtension;
+ PCDROM_DATA cdData = (PCDROM_DATA)(commonExtension->DriverData);
+ PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation(Irp);
+ BOOLEAN use6Byte = TEST_FLAG(cdData->XAFlags, XA_USE_6_BYTE);
+ ULONG retryCount;
//
// Extract the 'real' irp from the irpstack.
@@ -3454,7 +3454,17 @@
retry = TRUE;
}
- if (retry && realIrpNextStack->Parameters.Others.Argument1--) {
+ //
+ // get current retry count
+ //
+ retryCount = PtrToUlong(realIrpNextStack->Parameters.Others.Argument1);
+
+ if (retry && retryCount) {
+
+ //
+ // decrement retryCount and update
+ //
+ realIrpNextStack->Parameters.Others.Argument1 = UlongToPtr(retryCount-1);
if (((ULONG)(ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1)) {
@@ -5923,6 +5933,8 @@
ULONG pickDvdRegion;
ULONG defaultDvdRegion;
ULONG dvdRegion;
+ ULONG a, b;
+
PAGED_CODE();
@@ -5948,8 +5960,7 @@
}
- ULONG a, b;
-
+
a = max(sizeof(DVD_DESCRIPTOR_HEADER) +
sizeof(DVD_COPYRIGHT_DESCRIPTOR),
sizeof(DVD_READ_STRUCTURE)
@@ -6434,7 +6445,9 @@
NTSTATUS
--*/
-NTSTATUS
+
+VOID
+NTAPI
CdRomMmcErrorHandler(
IN PDEVICE_OBJECT Fdo,
IN PSCSI_REQUEST_BLOCK Srb,
@@ -6600,8 +6613,6 @@
} // end of SenseKey switch
} // end of SRB_STATUS_AUTOSENSE_VALID
-
- return STATUS_SUCCESS;
}
/*++
@@ -6748,6 +6759,7 @@
--*/
NTSTATUS
+NTAPI
CdRomShutdownFlushCompletion(
IN PDEVICE_OBJECT Fdo,
IN PIRP NewIrp,
@@ -6836,7 +6848,7 @@
newIrpStack = IoGetCurrentIrpStackLocation(newIrp);
newIrpStack->DeviceObject = Fdo;
IoSetCompletionRoutine(newIrp,
- CdRomShutdownFlushCompletion,
+ (PIO_COMPLETION_ROUTINE)CdRomShutdownFlushCompletion,
OriginalIrp,
TRUE, TRUE, TRUE);
IoSetNextIrpStackLocation(newIrp);
Modified: trunk/reactos/drivers/storage/class/cdrom_new/cdrom.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/cdro…
==============================================================================
--- trunk/reactos/drivers/storage/class/cdrom_new/cdrom.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/storage/class/cdrom_new/cdrom.h [iso-8859-1] Fri Feb 17 12:07:17
2012
@@ -45,7 +45,7 @@
CdromDebug = z, // set bit 0x00000000 in nt!kd_cdrom_mask
#endif
CdromDebugFeatures = 32 // set bit 0x80000000 in nt!kd_cdrom_mask
-};
+}CdromError;
#define CDROM_GET_CONFIGURATION_TIMEOUT (0x4)
@@ -744,7 +744,8 @@
OUT PBOOLEAN IsMmc
);
-NTSTATUS
+VOID
+NTAPI
CdRomMmcErrorHandler(
IN PDEVICE_OBJECT Fdo,
IN PSCSI_REQUEST_BLOCK Srb,
Modified: trunk/reactos/drivers/storage/class/cdrom_new/ioctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/cdro…
==============================================================================
--- trunk/reactos/drivers/storage/class/cdrom_new/ioctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/storage/class/cdrom_new/ioctl.c [iso-8859-1] Fri Feb 17 12:07:17
2012
@@ -2086,6 +2086,7 @@
NTSTATUS status;
BOOLEAN retry;
+ ULONG retryCount;
//
// Extract the 'real' irp from the irpstack.
@@ -2231,7 +2232,17 @@
}
- if (retry && realIrpNextStack->Parameters.Others.Argument1--) {
+ //
+ // get current retry count
+ //
+ retryCount = PtrToUlong(realIrpNextStack->Parameters.Others.Argument1);
+
+ if (retry && retryCount) {
+
+ //
+ // update retry count
+ //
+ realIrpNextStack->Parameters.Others.Argument1 = UlongToPtr(retryCount-1);
if (((ULONG)(ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1)) {
@@ -2844,6 +2855,7 @@
PIRP realIrp = NULL;
NTSTATUS status;
BOOLEAN retry;
+ ULONG retryCount;
//
// Extract the 'real' irp from the irpstack.
@@ -2901,7 +2913,18 @@
retry = TRUE;
}
- if (retry && realIrpNextStack->Parameters.Others.Argument1--) {
+ //
+ // get current retry count
+ //
+ retryCount = PtrToUlong(realIrpNextStack->Parameters.Others.Argument1);
+
+ if (retry && retryCount) {
+
+ //
+ // update retry count
+ //
+ realIrpNextStack->Parameters.Others.Argument1 = UlongToPtr(retryCount-1);
+
if (((ULONG)(ULONG_PTR)realIrpNextStack->Parameters.Others.Argument1)) {
Modified: trunk/reactos/drivers/storage/class/cdrom_new/mmc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/cdro…
==============================================================================
--- trunk/reactos/drivers/storage/class/cdrom_new/mmc.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/storage/class/cdrom_new/mmc.c [iso-8859-1] Fri Feb 17 12:07:17
2012
@@ -837,6 +837,7 @@
}
NTSTATUS
+NTAPI
CdRomUpdateMmcDriveCapabilitiesCompletion(
IN PDEVICE_OBJECT Unused,
IN PIRP Irp,
@@ -851,6 +852,9 @@
PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation(Irp);
NTSTATUS status = STATUS_UNSUCCESSFUL;
PIRP delayedIrp;
+ ULONG retryCount;
+ LARGE_INTEGER delay;
+
// completion routine should retry as neccessary.
// when success, clear the flag to allow startio to proceed.
@@ -910,9 +914,19 @@
retry = TRUE;
}
- if (retry && irpStack->Parameters.Others.Argument4--) {
-
- LARGE_INTEGER delay;
+ //
+ // get current retry count
+ //
+ retryCount = PtrToUlong(irpStack->Parameters.Others.Argument1);
+
+ if (retry && retryCount) {
+
+ //
+ // update retry count
+ //
+ irpStack->Parameters.Others.Argument1 = UlongToPtr(retryCount-1);
+
+
delay.QuadPart = retryInterval;
delay.QuadPart *= (LONGLONG)1000 * 1000 * 10;
@@ -1038,7 +1052,7 @@
nextStack->Parameters.Scsi.Srb = srb;
irp->MdlAddress = mmcData->CapabilitiesMdl;
irp->AssociatedIrp.SystemBuffer = mmcData->CapabilitiesBuffer;
- IoSetCompletionRoutine(irp, CdRomUpdateMmcDriveCapabilitiesCompletion, Fdo,
+ IoSetCompletionRoutine(irp,
(PIO_COMPLETION_ROUTINE)CdRomUpdateMmcDriveCapabilitiesCompletion, Fdo,
TRUE, TRUE, TRUE);
return;