Author: fireball Date: Thu Oct 1 18:08:11 2009 New Revision: 43250 URL: http://svn.reactos.org/svn/reactos?rev=43250&view=rev Log: [fastfat_new] - Implement simple read support. - Rewrite FatMapUserBuffer, no exception raising necessary at this stage. - Silence FatReadBlocks dbgprint.
Modified: trunk/reactos/drivers/filesystems/fastfat_new/blockdev.c trunk/reactos/drivers/filesystems/fastfat_new/fastfat.c trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h trunk/reactos/drivers/filesystems/fastfat_new/fullfat.c trunk/reactos/drivers/filesystems/fastfat_new/rw.c Modified: trunk/reactos/drivers/filesystems/fastfat_new/blockdev.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat_new/blockdev.c?rev=43250&r1=43249&r2=43250&view=diff ============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/blockdev.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/blockdev.c [iso-8859-1] Thu Oct 1 18:08:11 2009 @@ -54,30 +54,6 @@ if (ARGUMENT_PRESENT(OutputBufferSize)) *OutputBufferSize = IoStatus.Information; return Status; -} - -PVOID -FatMapUserBuffer( - IN OUT PIRP Irp) -/* - * FUNCTION: - * - * - * ARGUMENTS: - * IrpContext = Pointer to FCB structure for the file. - * Irp = Pointer to the IRP structure - * RETURNS: Status Value. - * NOTES: - */ -{ - PVOID Address; - - if (Irp->MdlAddress == NULL) - return Irp->UserBuffer; - Address = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); - if (Address == NULL) - ExRaiseStatus( STATUS_INVALID_USER_BUFFER ); - return Address; } NTSTATUS Modified: trunk/reactos/drivers/filesystems/fastfat_new/fastfat.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat_new/fastfat.c?rev=43250&r1=43249&r2=43250&view=diff ============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fastfat.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/fastfat.c [iso-8859-1] Thu Oct 1 18:08:11 2009 @@ -394,5 +394,14 @@ ExReleaseResourceLite(&Vcb->Resource); } +PVOID +FASTCALL +FatMapUserBuffer(PIRP Irp) +{ + if (!Irp->MdlAddress) + return Irp->UserBuffer; + else + return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); +} /* EOF */ Modified: trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h?rev=43250&r1=43249&r2=43250&view=diff ============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h [iso-8859-1] Thu Oct 1 18:08:11 2009 @@ -65,10 +65,6 @@ IN PLARGE_INTEGER Offset, IN SIZE_T Length); -PVOID -FatMapUserBuffer( - IN OUT PIRP Irp); - /* ----------------------------------------------------------- dir.c */ NTSTATUS NTAPI @@ -158,6 +154,9 @@ TYPE_OF_OPEN TypeOfOpen, PVOID Fcb, PCCB Ccb); + +PVOID FASTCALL +FatMapUserBuffer(PIRP Irp); /* --------------------------------------------------------- fullfat.c */ Modified: trunk/reactos/drivers/filesystems/fastfat_new/fullfat.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat_new/fullfat.c?rev=43250&r1=43249&r2=43250&view=diff ============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fullfat.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/fullfat.c [iso-8859-1] Thu Oct 1 18:08:11 2009 @@ -46,7 +46,7 @@ PBCB Bcb; ULONG SectorSize = 512; // FIXME: hardcoding 512 is bad - DPRINT1("FatReadBlocks %p %d %d %p\n", DestBuffer, SectorAddress, Count, pParam); + DPRINT("FatReadBlocks %p %d %d %p\n", DestBuffer, SectorAddress, Count, pParam); /* Calculate the offset */ Offset.QuadPart = Int32x32To64(SectorAddress, SectorSize); Modified: trunk/reactos/drivers/filesystems/fastfat_new/rw.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat_new/rw.c?rev=43250&r1=43249&r2=43250&view=diff ============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/rw.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/rw.c [iso-8859-1] Thu Oct 1 18:08:11 2009 @@ -26,6 +26,8 @@ PFCB Fcb; PVCB Vcb; PCCB Ccb; + PVOID Buffer; + LONG BytesRead; FileObject = IrpSp->FileObject; NumberOfBytes = IrpSp->Parameters.Read.Length; @@ -40,7 +42,29 @@ DPRINT1("FatiRead() Fcb %p, Name %wZ, Offset %d, Length %d, Handle %p\n", Fcb, &FileObject->FileName, ByteOffset.LowPart, NumberOfBytes, Fcb->FatHandle); - return STATUS_NOT_IMPLEMENTED; + + /* Perform actual read */ + + if (IrpContext->MinorFunction & IRP_MN_MDL) + { + DPRINT1("MDL read\n"); + } + else + { + Buffer = FatMapUserBuffer(IrpContext->Irp); + DPRINT1("Normal cached read, buffer %p\n"); + + BytesRead = FF_Read(Fcb->FatHandle, NumberOfBytes, 1, Buffer); + DPRINT1("Read %d bytes\n", BytesRead); + + /* Indicate we read requested amount of bytes */ + IrpContext->Irp->IoStatus.Information = BytesRead; + IrpContext->Irp->IoStatus.Status = STATUS_SUCCESS; + } + + /* Complete the request */ + FatCompleteRequest(IrpContext, IrpContext->Irp, STATUS_SUCCESS); + return STATUS_SUCCESS; } NTSTATUS