-/* $Id: rawfs.c,v 1.11 2004/08/10 01:49:36 navaraf Exp $
+/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/rawfs.c
* PURPOSE: Raw filesystem driver
- * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
- * UPDATE HISTORY:
- * Created 13/04/2003
+ *
+ * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
*/
/* INCLUDES *****************************************************************/
-#include <ddk/ntddk.h>
-#include <ddk/ntifs.h>
-#include <reactos/bugcodes.h>
-
+#include <ntoskrnl.h>
#define NDEBUG
#include <internal/debug.h>
/* GLOBALS ******************************************************************/
-#define TAG_IRP TAG('R', 'I', 'R', 'P')
-
static PDRIVER_OBJECT RawFsDriverObject;
static PDEVICE_OBJECT DiskDeviceObject;
static PDEVICE_OBJECT CdromDeviceObject;
pDeviceObject,
Buffer,
WriteLength,
- WriteOffset,
- &Event,
+ WriteOffset,
+ &Event,
&IoStatus);
if (!Irp)
{
IN ULONG CtlCode,
IN PVOID InputBuffer,
IN ULONG InputBufferSize,
- IN OUT PVOID OutputBuffer,
+ IN OUT PVOID OutputBuffer,
IN OUT PULONG pOutputBufferSize)
{
ULONG OutputBufferSize = 0;
NTSTATUS Status;
DPRINT("RawFsBlockDeviceIoControl(DeviceObject %x, CtlCode %x, "
- "InputBuffer %x, InputBufferSize %x, OutputBuffer %x, "
- "POutputBufferSize %x (%x)\n", DeviceObject, CtlCode,
- InputBuffer, InputBufferSize, OutputBuffer, pOutputBufferSize,
+ "InputBuffer %x, InputBufferSize %x, OutputBuffer %x, "
+ "POutputBufferSize %x (%x)\n", DeviceObject, CtlCode,
+ InputBuffer, InputBufferSize, OutputBuffer, pOutputBufferSize,
pOutputBufferSize ? *pOutputBufferSize : 0);
if (pOutputBufferSize)
KeInitializeEvent(&Event, NotificationEvent, FALSE);
DPRINT("Building device I/O control request ...\n");
- Irp = IoBuildDeviceIoControlRequest(CtlCode,
- DeviceObject,
- InputBuffer,
- InputBufferSize,
+ Irp = IoBuildDeviceIoControlRequest(CtlCode,
+ DeviceObject,
+ InputBuffer,
+ InputBufferSize,
OutputBuffer,
- OutputBufferSize,
- FALSE,
- &Event,
+ OutputBufferSize,
+ FALSE,
+ &Event,
&IoStatus);
if (Irp == NULL)
{
memset(Fcb, 0, sizeof(RAWFS_FCB));
ExInitializeResourceLite(&Fcb->PagingIoResource);
ExInitializeResourceLite(&Fcb->MainResource);
-// FsRtlInitializeFileLock(&Fcb->FileLock, NULL, NULL);
+// FsRtlInitializeFileLock(&Fcb->FileLock, NULL, NULL);
return Fcb;
}
static VOID
RawFsDestroyFCB(IN PRAWFS_GLOBAL_DATA pGlobalData, IN PRAWFS_FCB pFcb)
{
- //FsRtlUninitializeFileLock(&pFcb->FileLock);
+ //FsRtlUninitializeFileLock(&pFcb->FileLock);
ExDeleteResourceLite(&pFcb->PagingIoResource);
ExDeleteResourceLite(&pFcb->MainResource);
ExFreeToNPagedLookasideList(&pGlobalData->FcbLookasideList, pFcb);
DPRINT("RawFsAllocateIrpContext(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
- assert(DeviceObject);
- assert(Irp);
+ ASSERT(DeviceObject);
+ ASSERT(Irp);
GlobalData = (PRAWFS_GLOBAL_DATA) DeviceObject->DeviceExtension;
IrpContext = ExAllocateFromNPagedLookasideList(&IrpContextLookasideList);
IrpContext->DeviceObject = DeviceObject;
IrpContext->DeviceExt = DeviceObject->DeviceExtension;
IrpContext->Stack = IoGetCurrentIrpStackLocation(Irp);
- assert(IrpContext->Stack);
+ ASSERT(IrpContext->Stack);
MajorFunction = IrpContext->MajorFunction = IrpContext->Stack->MajorFunction;
IrpContext->MinorFunction = IrpContext->Stack->MinorFunction;
IrpContext->FileObject = IrpContext->Stack->FileObject;
{
DPRINT("RawFsFreeIrpContext(IrpContext %x)\n", IrpContext);
- assert(IrpContext);
+ ASSERT(IrpContext);
ExFreeToNPagedLookasideList(&IrpContextLookasideList, IrpContext);
}
{
ULONG Count;
- assert(IrpContext != NULL);
- assert(IrpContext->Irp != NULL);
+ ASSERT(IrpContext != NULL);
+ ASSERT(IrpContext->Irp != NULL);
Count = InterlockedIncrement(&RawFsQueueCount);
FileObject = IoSp->FileObject;
DeviceExt = IrpContext->DeviceObject->DeviceExtension;
- if (FileObject->FileName.Length == 0 &&
+ if (FileObject->FileName.Length == 0 &&
FileObject->RelatedFileObject == NULL)
{
/* This a open operation for the volume itself */
return (STATUS_INSUFFICIENT_RESOURCES);
}
- FileObject->Flags |= FO_FCB_IS_VALID;
FileObject->SectionObjectPointer = &pFcb->SectionObjectPointers;
FileObject->FsContext = pFcb;
FileObject->FsContext2 = pCcb;
DPRINT("RawFsCreate(IrpContext %x)\n", IrpContext);
- assert(IrpContext);
-
+ ASSERT(IrpContext);
+
if (RawFsIsRawFileSystemDeviceObject(IrpContext->DeviceObject))
{
/* DeviceObject represents FileSystem instead of logical volume */
Status = RawFsCreateFile(IrpContext);
IrpContext->Irp->IoStatus.Status = Status;
- IoCompleteRequest(IrpContext->Irp,
+ IoCompleteRequest(IrpContext->Irp,
(CCHAR)(NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT));
RawFsFreeIrpContext(IrpContext);
DPRINT("RawFsMount(IrpContext %x)\n", IrpContext);
- assert(IrpContext);
+ ASSERT(IrpContext);
if (!RawFsIsRawFileSystemDeviceObject(IrpContext->DeviceObject))
{
DeviceObject->Flags |= DO_DIRECT_IO;
DeviceExt = (PVOID) DeviceObject->DeviceExtension;
RtlZeroMemory(DeviceExt, sizeof(RAWFS_DEVICE_EXTENSION));
-
+
/* Use same vpb as device disk */
DeviceObject->Vpb = IrpContext->Stack->Parameters.MountVolume.DeviceObject->Vpb;
DeviceExt->StorageDevice = IrpContext->Stack->Parameters.MountVolume.DeviceObject;
DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED;
DeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1;
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
-
+
KeInitializeSpinLock(&DeviceExt->FcbListLock);
InitializeListHead(&DeviceExt->FcbListHead);
NTSTATUS Status;
DPRINT("RawFsFileSystemControl(IrpContext %x)\n", IrpContext);
-
- assert (IrpContext);
+
+ ASSERT(IrpContext);
switch (IrpContext->MinorFunction)
{
DPRINT("RawFsDispatchRequest(IrpContext %x), MajorFunction %x\n",
IrpContext, IrpContext->MajorFunction);
- assert (IrpContext);
+ ASSERT(IrpContext);
switch (IrpContext->MajorFunction)
{
DPRINT("RawFsBuildRequest(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
- assert(DeviceObject);
- assert(Irp);
+ ASSERT(DeviceObject);
+ ASSERT(Irp);
IrpContext = RawFsAllocateIrpContext(DeviceObject, Irp);
if (IrpContext == NULL)