[fastfat_new]

- Implement simple read support.
- Rewrite FatMapUserBuffer, no exception raising necessary at this stage.
- Silence FatReadBlocks dbgprint.

svn path=/trunk/; revision=43250
This commit is contained in:
Aleksey Bragin
2009-10-01 16:08:11 +00:00
parent c57385622a
commit 43ef29d7ef
5 changed files with 38 additions and 30 deletions
@@ -56,30 +56,6 @@ FatDiskIoControl_(
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
FatLockUserBuffer (
IN PFAT_IRP_CONTEXT IrpContext,
@@ -394,5 +394,14 @@ FatReleaseVcb(IN PFAT_IRP_CONTEXT IrpContext,
ExReleaseResourceLite(&Vcb->Resource);
}
PVOID
FASTCALL
FatMapUserBuffer(PIRP Irp)
{
if (!Irp->MdlAddress)
return Irp->UserBuffer;
else
return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority);
}
/* EOF */
@@ -65,10 +65,6 @@ FatPerformVirtualNonCachedIo(
IN PLARGE_INTEGER Offset,
IN SIZE_T Length);
PVOID
FatMapUserBuffer(
IN OUT PIRP Irp);
/* ----------------------------------------------------------- dir.c */
NTSTATUS NTAPI
@@ -159,6 +155,9 @@ FatSetFileObject(PFILE_OBJECT FileObject,
PVOID Fcb,
PCCB Ccb);
PVOID FASTCALL
FatMapUserBuffer(PIRP Irp);
/* --------------------------------------------------------- fullfat.c */
FF_T_SINT32
@@ -46,7 +46,7 @@ FatReadBlocks(FF_T_UINT8 *DestBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Cou
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);
+25 -1
View File
@@ -26,6 +26,8 @@ FatiRead(PFAT_IRP_CONTEXT IrpContext)
PFCB Fcb;
PVCB Vcb;
PCCB Ccb;
PVOID Buffer;
LONG BytesRead;
FileObject = IrpSp->FileObject;
NumberOfBytes = IrpSp->Parameters.Read.Length;
@@ -40,7 +42,29 @@ FatiRead(PFAT_IRP_CONTEXT IrpContext)
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