[fastfat_new]

- Open a file in FatiOpenExistingFile by means of FullFAT library.
- Fix incorrect fullfat placement in fasfat.rbuild.
- Hack StreamFileObject to be 5Gb in length instead of 512 bytes. It'll be set to the size of an underlying physical device later.
- Add FF file handle to FCB structure.

svn path=/trunk/; revision=43247
This commit is contained in:
Aleksey Bragin 2009-10-01 13:21:28 +00:00
parent 4a81976dfd
commit 8f8f77367c
6 changed files with 28 additions and 5 deletions

View file

@ -59,7 +59,10 @@ FatiOpenExistingFile(IN PFAT_IRP_CONTEXT IrpContext,
IN BOOLEAN IsDosName) IN BOOLEAN IsDosName)
{ {
IO_STATUS_BLOCK Iosb = {{0}}; IO_STATUS_BLOCK Iosb = {{0}};
OEM_STRING AnsiName;
CHAR AnsiNameBuf[512];
PFCB Fcb; PFCB Fcb;
NTSTATUS Status;
/* Check for create file option and fail */ /* Check for create file option and fail */
if (CreateDisposition == FILE_CREATE) if (CreateDisposition == FILE_CREATE)
@ -73,6 +76,20 @@ FatiOpenExistingFile(IN PFAT_IRP_CONTEXT IrpContext,
/* Create a new FCB for this file */ /* Create a new FCB for this file */
Fcb = FatCreateFcb(IrpContext, Vcb, ParentDcb); Fcb = FatCreateFcb(IrpContext, Vcb, ParentDcb);
/* Convert the name to ANSI */
AnsiName.Buffer = AnsiNameBuf;
AnsiName.Length = 0;
AnsiName.MaximumLength = sizeof(AnsiNameBuf);
RtlZeroMemory(AnsiNameBuf, sizeof(AnsiNameBuf));
Status = RtlUpcaseUnicodeStringToCountedOemString(&AnsiName, &FileObject->FileName, FALSE);
if (!NT_SUCCESS(Status))
{
ASSERT(FALSE);
}
/* Open the file with FullFAT */
Fcb->FatHandle = FF_Open(Vcb->Ioman, AnsiName.Buffer, FF_MODE_READ, NULL);
// TODO: Check if overwrite is needed // TODO: Check if overwrite is needed
// This is usual file open branch, without overwriting! // This is usual file open branch, without overwriting!

View file

@ -4,10 +4,10 @@
<bootstrap installbase="$(CDOUTPUT)" /> <bootstrap installbase="$(CDOUTPUT)" />
<include base="fastfatn">.</include> <include base="fastfatn">.</include>
<include base="ReactOS">include/reactos/libs/fullfat</include> <include base="ReactOS">include/reactos/libs/fullfat</include>
<library>fullfat</library>
<library>ntoskrnl</library> <library>ntoskrnl</library>
<library>hal</library> <library>hal</library>
<library>pseh</library> <library>pseh</library>
<library>fullfat</library>
<file>blockdev.c</file> <file>blockdev.c</file>
<file>cleanup.c</file> <file>cleanup.c</file>
<file>close.c</file> <file>close.c</file>

View file

@ -484,11 +484,14 @@ FatInitializeVcb(IN PFAT_IRP_CONTEXT IrpContext,
Vcb->StreamFileObject->SectionObjectPointer = &Vcb->SectionObjectPointers; Vcb->StreamFileObject->SectionObjectPointer = &Vcb->SectionObjectPointers;
/* At least full boot sector should be available */ /* At least full boot sector should be available */
Vcb->Header.FileSize.QuadPart = sizeof(PACKED_BOOT_SECTOR); //Vcb->Header.FileSize.QuadPart = sizeof(PACKED_BOOT_SECTOR);
Vcb->Header.AllocationSize.QuadPart = sizeof(PACKED_BOOT_SECTOR); //Vcb->Header.AllocationSize.QuadPart = sizeof(PACKED_BOOT_SECTOR);
Vcb->Header.ValidDataLength.HighPart = MAXLONG; Vcb->Header.ValidDataLength.HighPart = MAXLONG;
Vcb->Header.ValidDataLength.LowPart = MAXULONG; Vcb->Header.ValidDataLength.LowPart = MAXULONG;
Vcb->Header.AllocationSize.QuadPart = Int32x32To64(5*1024, 1024*1024); //HACK: 5 Gb
Vcb->Header.FileSize.QuadPart = Vcb->Header.AllocationSize.QuadPart;
/* Set VCB to a good condition */ /* Set VCB to a good condition */
Vcb->Condition = VcbGood; Vcb->Condition = VcbGood;

View file

@ -279,6 +279,8 @@ typedef struct _FCB
UCHAR DirentFatFlags; UCHAR DirentFatFlags;
/* File basic info */ /* File basic info */
FILE_BASIC_INFORMATION BasicInfo; FILE_BASIC_INFORMATION BasicInfo;
/* FullFAT file handle */
FF_FILE *FatHandle;
union union
{ {
struct struct

View file

@ -58,6 +58,7 @@ FatReadBlocks(FF_T_UINT8 *DestBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Cou
&Bcb, &Bcb,
&Buffer)) &Buffer))
{ {
ASSERT(FALSE);
/* Mapping failed */ /* Mapping failed */
return 0; return 0;
} }

View file

@ -38,8 +38,8 @@ FatiRead(PFAT_IRP_CONTEXT IrpContext)
OpenType = FatDecodeFileObject(FileObject, &Vcb, &Fcb, &Ccb); OpenType = FatDecodeFileObject(FileObject, &Vcb, &Fcb, &Ccb);
DPRINT1("FatiRead() Fcb %p, Name %wZ, Offset %d, Length %d\n", DPRINT1("FatiRead() Fcb %p, Name %wZ, Offset %d, Length %d, Handle %p\n",
Fcb, &FileObject->FileName, ByteOffset.LowPart, NumberOfBytes); Fcb, &FileObject->FileName, ByteOffset.LowPart, NumberOfBytes, Fcb->FatHandle);
return STATUS_NOT_IMPLEMENTED; return STATUS_NOT_IMPLEMENTED;
} }