Author: fireball
Date: Fri Oct 16 20:39:38 2009
New Revision: 43517
URL:
http://svn.reactos.org/svn/reactos?rev=43517&view=rev
Log:
[fastfat_new]
- Improve FatCreateDcb so that it sets the dir name.
- Implement relative file object open.
Modified:
trunk/reactos/drivers/filesystems/fastfat_new/create.c
trunk/reactos/drivers/filesystems/fastfat_new/dir.c
trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h
Modified: trunk/reactos/drivers/filesystems/fastfat_new/create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/create.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/create.c [iso-8859-1] Fri Oct 16
20:39:38 2009
@@ -126,8 +126,7 @@
}
/* Create a new DCB for this directory */
- Fcb = FatCreateDcb(IrpContext, Vcb, ParentDcb);
- Fcb->FatHandle = FileHandle;
+ Fcb = FatCreateDcb(IrpContext, Vcb, ParentDcb, FileHandle);
/* Set share access */
IoSetShareAccess(*DesiredAccess, ShareAccess, FileObject, &Fcb->ShareAccess);
@@ -332,9 +331,9 @@
ULONG CreateDisposition;
/* Control blocks */
- PVCB Vcb, DecodedVcb;
- PFCB Fcb, NextFcb;
- PCCB Ccb;
+ PVCB Vcb, DecodedVcb, RelatedVcb;
+ PFCB Fcb, NextFcb, RelatedDcb;
+ PCCB Ccb, RelatedCcb;
PFCB ParentDcb;
/* IRP data */
@@ -357,6 +356,7 @@
UNICODE_STRING RemainingPart, FirstName, NextName;
OEM_STRING AnsiFirstName;
FF_ERROR FfError;
+ TYPE_OF_OPEN TypeOfOpen;
Iosb.Status = STATUS_SUCCESS;
@@ -533,8 +533,42 @@
/* Check if this is a relative open */
if (RelatedFO)
{
- // RelatedFO will be a parent directory
- UNIMPLEMENTED;
+ /* Decode the file object */
+ TypeOfOpen = FatDecodeFileObject(RelatedFO,
+ &RelatedVcb,
+ &RelatedDcb,
+ &RelatedCcb);
+
+ /* Check open type */
+ if (TypeOfOpen != UserFileOpen &&
+ TypeOfOpen != UserDirectoryOpen)
+ {
+ DPRINT1("Invalid file object!\n");
+
+ /* Cleanup and return */
+ FatReleaseVcb(IrpContext, Vcb);
+ return STATUS_OBJECT_PATH_NOT_FOUND;
+ }
+
+ /* File path must be relative */
+ if (FileName.Length != 0 &&
+ FileName.Buffer[0] == L'\\')
+ {
+ /* The name is absolute, fail */
+ FatReleaseVcb(IrpContext, Vcb);
+ return STATUS_OBJECT_NAME_INVALID;
+ }
+
+ /* Make sure volume is the same */
+ ASSERT(RelatedVcb == Vcb);
+
+ /* Save VPB */
+ FileObject->Vpb = RelatedFO->Vpb;
+
+ /* Set parent DCB */
+ ParentDcb = RelatedDcb;
+
+ DPRINT1("Opening file '%wZ' relatively to '%wZ'\n",
&FileName, &ParentDcb->FullFileName);
}
else
{
@@ -743,7 +777,8 @@
/* Create a DCB for this entry */
ParentDcb = FatCreateDcb(IrpContext,
Vcb,
- ParentDcb);
+ ParentDcb,
+ NULL);
/* Set its name */
FatSetFullNameInFcb(ParentDcb, &FirstName);
Modified: trunk/reactos/drivers/filesystems/fastfat_new/dir.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/dir.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/dir.c [iso-8859-1] Fri Oct 16 20:39:38
2009
@@ -127,7 +127,8 @@
NTAPI
FatCreateDcb(IN PFAT_IRP_CONTEXT IrpContext,
IN PVCB Vcb,
- IN PFCB ParentDcb)
+ IN PFCB ParentDcb,
+ IN FF_FILE *FileHandle)
{
PFCB Fcb;
@@ -162,6 +163,13 @@
/* Initialize parent dcb list */
InitializeListHead(&Fcb->Dcb.ParentDcbList);
+ /* Set FullFAT handle */
+ Fcb->FatHandle = FileHandle;
+
+ /* Set names */
+ if (FileHandle)
+ FatSetFcbNames(IrpContext, Fcb);
+
return Fcb;
}
Modified: trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h [iso-8859-1] Fri Oct 16
20:39:38 2009
@@ -84,7 +84,8 @@
PFCB NTAPI
FatCreateDcb(IN PFAT_IRP_CONTEXT IrpContext,
IN PVCB Vcb,
- IN PFCB ParentDcb);
+ IN PFCB ParentDcb,
+ IN FF_FILE *FileHandle);
/* -------------------------------------------------------- create.c */