[fastfat_new]
authorAleksey Bragin <aleksey@reactos.org>
Thu, 1 Oct 2009 13:21:28 +0000 (13:21 +0000)
committerAleksey Bragin <aleksey@reactos.org>
Thu, 1 Oct 2009 13:21:28 +0000 (13:21 +0000)
- 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

reactos/drivers/filesystems/fastfat_new/create.c
reactos/drivers/filesystems/fastfat_new/fastfat.rbuild
reactos/drivers/filesystems/fastfat_new/fat.c
reactos/drivers/filesystems/fastfat_new/fatstruc.h
reactos/drivers/filesystems/fastfat_new/fullfat.c
reactos/drivers/filesystems/fastfat_new/rw.c

index 846577a..0aec637 100644 (file)
@@ -59,7 +59,10 @@ FatiOpenExistingFile(IN PFAT_IRP_CONTEXT IrpContext,
                      IN BOOLEAN IsDosName)
 {
     IO_STATUS_BLOCK Iosb = {{0}};
+    OEM_STRING AnsiName;
+    CHAR AnsiNameBuf[512];
     PFCB Fcb;
+    NTSTATUS Status;
 
     /* Check for create file option and fail */
     if (CreateDisposition == FILE_CREATE)
@@ -73,6 +76,20 @@ FatiOpenExistingFile(IN PFAT_IRP_CONTEXT IrpContext,
     /* Create a new FCB for this file */
     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
 
     // This is usual file open branch, without overwriting!
index ac49fe0..f29c915 100644 (file)
@@ -4,10 +4,10 @@
        <bootstrap installbase="$(CDOUTPUT)" />
        <include base="fastfatn">.</include>
        <include base="ReactOS">include/reactos/libs/fullfat</include>
+       <library>fullfat</library>
        <library>ntoskrnl</library>
        <library>hal</library>
        <library>pseh</library>
-       <library>fullfat</library>
        <file>blockdev.c</file>
        <file>cleanup.c</file>
        <file>close.c</file>
index c1fa63a..db6d517 100644 (file)
@@ -484,11 +484,14 @@ FatInitializeVcb(IN PFAT_IRP_CONTEXT IrpContext,
     Vcb->StreamFileObject->SectionObjectPointer = &Vcb->SectionObjectPointers;
 
     /* At least full boot sector should be available */
-    Vcb->Header.FileSize.QuadPart = sizeof(PACKED_BOOT_SECTOR);
-    Vcb->Header.AllocationSize.QuadPart = sizeof(PACKED_BOOT_SECTOR);
+    //Vcb->Header.FileSize.QuadPart = sizeof(PACKED_BOOT_SECTOR);
+    //Vcb->Header.AllocationSize.QuadPart = sizeof(PACKED_BOOT_SECTOR);
     Vcb->Header.ValidDataLength.HighPart = MAXLONG;
     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 */
     Vcb->Condition = VcbGood;
 
index 64fb535..962e06e 100644 (file)
@@ -279,6 +279,8 @@ typedef struct _FCB
     UCHAR DirentFatFlags;
     /* File basic info */
     FILE_BASIC_INFORMATION BasicInfo;
+    /* FullFAT file handle */
+    FF_FILE *FatHandle;
     union
     {
         struct
index dcaf94b..cb1b835 100644 (file)
@@ -58,6 +58,7 @@ FatReadBlocks(FF_T_UINT8 *DestBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Cou
                   &Bcb,
                   &Buffer))
     {
+        ASSERT(FALSE);
         /* Mapping failed */
         return 0;
     }
index 3e543f8..d3693d8 100644 (file)
@@ -38,8 +38,8 @@ FatiRead(PFAT_IRP_CONTEXT IrpContext)
     
     OpenType = FatDecodeFileObject(FileObject, &Vcb, &Fcb, &Ccb);
 
-    DPRINT1("FatiRead() Fcb %p, Name %wZ, Offset %d, Length %d\n",
-        Fcb, &FileObject->FileName, ByteOffset.LowPart, NumberOfBytes);
+    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;
 }