Author: fireball
Date: Tue Oct 20 14:51:13 2009
New Revision: 43646
URL:
http://svn.reactos.org/svn/reactos?rev=43646&view=rev
Log:
[fastfat_new]
- Implement root directory open operation.
- Add OpenCount counter to FCB.
Modified:
trunk/reactos/drivers/filesystems/fastfat_new/create.c
trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.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] Tue Oct 20
14:51:13 2009
@@ -23,10 +23,64 @@
IN ULONG CreateDisposition)
{
IO_STATUS_BLOCK Iosb;
-
- DPRINT1("Opening root directory\n");
-
- Iosb.Status = STATUS_NOT_IMPLEMENTED;
+ PFCB Dcb;
+ NTSTATUS Status;
+ PCCB Ccb;
+
+ /* Reference our DCB */
+ Dcb = Vcb->RootDcb;
+
+ DPRINT("Opening root directory\n");
+
+ /* Exclusively lock this DCB */
+ (VOID)FatAcquireExclusiveFcb(IrpContext, Dcb);
+
+ do
+ {
+ /* Validate parameters */
+ if (CreateDisposition != FILE_OPEN &&
+ CreateDisposition != FILE_OPEN_IF)
+ {
+ Iosb.Status = STATUS_ACCESS_DENIED;
+ break;
+ }
+
+ // TODO: Check file access
+
+ /* Is it a first time open? */
+ if (Dcb->OpenCount == 0)
+ {
+ /* Set share access */
+ IoSetShareAccess(*DesiredAccess,
+ ShareAccess,
+ FileObject,
+ &Dcb->ShareAccess);
+ }
+ else
+ {
+ /* Check share access */
+ Status = IoCheckShareAccess(*DesiredAccess,
+ ShareAccess,
+ FileObject,
+ &Dcb->ShareAccess,
+ TRUE);
+ }
+
+ /* Set file object pointers */
+ Ccb = FatCreateCcb(IrpContext);
+ FatSetFileObject(FileObject, UserDirectoryOpen, Dcb, Ccb);
+
+ /* Increment counters */
+ Dcb->OpenCount++;
+ Vcb->OpenFileCount++;
+
+ /* Set success statuses */
+ Iosb.Status = STATUS_SUCCESS;
+ Iosb.Information = FILE_OPENED;
+ } while (FALSE);
+
+ /* Release the DCB lock */
+ FatReleaseFcb(IrpContext, Dcb);
return Iosb;
}
Modified: trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h [iso-8859-1] Tue Oct 20
14:51:13 2009
@@ -305,6 +305,8 @@
ULONG OutstandingAsyncWrites;
/* The outstanding async writes sync event */
PKEVENT OutstandingAsyncEvent;
+ /* Counters */
+ ULONG OpenCount;
union
{
struct