- Implemented InterlockedBitTestAndReset, InterlockedBitTestAndSet, InterlockedExchan...
[reactos.git] / reactos / ntoskrnl / fs / mcb.c
index 734d639..abc255d 100644 (file)
@@ -1,23 +1,28 @@
-/* $Id: mcb.c,v 1.5 2002/09/08 10:23:20 chorns Exp $
+/* $Id$
  *
- * reactos/ntoskrnl/fs/mcb.c
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/fs/mcb.c
+ * PURPOSE:         No purpose listed.
  *
+ * PROGRAMMERS:     No programmer listed.
  */
-#include <ddk/ntddk.h>
-#include <ddk/ntifs.h>
 
+#include <ntoskrnl.h>
 #include <internal/debug.h>
 
 /**********************************************************************
  * NAME                                                        EXPORTED
  *
  * DESCRIPTION
- *     
+ *
  * ARGUMENTS
  *
  * RETURN VALUE
  *
  * NOTES
+ *
+ * @unimplemented
  */
 BOOLEAN STDCALL
 FsRtlAddLargeMcbEntry(IN PLARGE_MCB Mcb,
@@ -25,24 +30,30 @@ FsRtlAddLargeMcbEntry(IN PLARGE_MCB Mcb,
                      IN LONGLONG Lbn,
                      IN LONGLONG SectorCount)
 {
-  UNIMPLEMENTED
+  UNIMPLEMENTED;
   return(FALSE);
 }
 
-
-VOID
-STDCALL
-FsRtlAddMcbEntry (
-       DWORD   Unknown0,
-       DWORD   Unknown1,
-       DWORD   Unknown2,
-       DWORD   Unknown3
-       )
+/*
+ * FsRtlAddMcbEntry: Obsolete
+ *
+ * @implemented
+ */
+BOOLEAN STDCALL
+FsRtlAddMcbEntry (IN PMCB     Mcb,
+                 IN VBN      Vbn,
+                 IN LBN      Lbn,
+                 IN ULONG    SectorCount)
 {
-       UNIMPLEMENTED
+  return FsRtlAddLargeMcbEntry(& Mcb->DummyFieldThatSizesThisStructureCorrectly,
+                              (LONGLONG) Vbn,
+                              (LONGLONG) Lbn,
+                              (LONGLONG) SectorCount);
 }
 
-
+/*
+ * @unimplemented
+ */
 BOOLEAN STDCALL
 FsRtlGetNextLargeMcbEntry(IN PLARGE_MCB Mcb,
                          IN ULONG RunIndex,
@@ -50,45 +61,69 @@ FsRtlGetNextLargeMcbEntry(IN PLARGE_MCB Mcb,
                          OUT PLONGLONG Lbn,
                          OUT PLONGLONG SectorCount)
 {
-  UNIMPLEMENTED
+  UNIMPLEMENTED;
   return(FALSE);
 }
 
 
-VOID
-STDCALL
-FsRtlGetNextMcbEntry (
-       DWORD   Unknown0,
-       DWORD   Unknown1,
-       DWORD   Unknown2,
-       DWORD   Unknown3,
-       DWORD   Unknown4
-       )
+/*
+ * @implemented
+ */
+BOOLEAN STDCALL
+FsRtlGetNextMcbEntry (IN PMCB     Mcb,
+                     IN ULONG    RunIndex,
+                     OUT PVBN    Vbn,
+                     OUT PLBN    Lbn,
+                     OUT PULONG  SectorCount)
 {
-       UNIMPLEMENTED
+  BOOLEAN Return = FALSE;
+  LONGLONG llVbn;
+  LONGLONG llLbn;
+  LONGLONG llSectorCount;
+
+  /* Call the Large version */
+  Return = FsRtlGetNextLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly,
+                                     RunIndex,
+                                     &llVbn,
+                                     &llLbn,
+                                     &llSectorCount);
+
+  /* Return everything typecasted */
+  *Vbn = (ULONG)llVbn;
+  *Lbn = (ULONG)llLbn;
+  *SectorCount = (ULONG)llSectorCount;
+
+  /* And return the original value */
+  return(Return);
 }
 
 
+/*
+ * @unimplemented
+ */
 VOID STDCALL
 FsRtlInitializeLargeMcb(IN PLARGE_MCB Mcb,
                        IN POOL_TYPE PoolType)
 {
-  UNIMPLEMENTED
-       Mcb->PoolType = PoolType;
+  UNIMPLEMENTED;
+  Mcb->BaseMcb.PoolType = PoolType;
 }
 
-
-VOID
-STDCALL
-FsRtlInitializeMcb (
-       DWORD   Unknown0,
-       DWORD   Unknown1
-       )
+/*
+ * FsRtlInitializeMcb: Obsolete
+ * @implemented
+ */
+VOID STDCALL
+FsRtlInitializeMcb (IN PMCB         Mcb,
+                   IN POOL_TYPE    PoolType)
 {
-       UNIMPLEMENTED
+  FsRtlInitializeLargeMcb(& Mcb->DummyFieldThatSizesThisStructureCorrectly, PoolType);
 }
 
 
+/*
+ * @unimplemented
+ */
 BOOLEAN STDCALL
 FsRtlLookupLargeMcbEntry(IN PLARGE_MCB Mcb,
                         IN LONGLONG Vbn,
@@ -98,129 +133,248 @@ FsRtlLookupLargeMcbEntry(IN PLARGE_MCB Mcb,
                         OUT PLONGLONG SectorCountFromStartingLbn OPTIONAL,
                         OUT PULONG Index OPTIONAL)
 {
-  UNIMPLEMENTED
+  UNIMPLEMENTED;
   return(FALSE);
 }
 
+/*
+ * @unimplemented
+ */
+BOOLEAN
+STDCALL
+FsRtlLookupLastLargeMcbEntryAndIndex (
+    IN PLARGE_MCB OpaqueMcb,
+    OUT PLONGLONG LargeVbn,
+    OUT PLONGLONG LargeLbn,
+    OUT PULONG Index
+    )
+{
+  UNIMPLEMENTED;
+  return(FALSE);
+}
 
+/*
+ * @unimplemented
+ */
+PFSRTL_PER_STREAM_CONTEXT
+STDCALL
+FsRtlLookupPerStreamContextInternal (
+    IN PFSRTL_ADVANCED_FCB_HEADER StreamContext,
+    IN PVOID OwnerId OPTIONAL,
+    IN PVOID InstanceId OPTIONAL
+    )
+{
+  UNIMPLEMENTED;
+  return(FALSE);
+}
+
+/*
+ * @unimplemented
+ */
+PVOID /* PFSRTL_PER_FILE_OBJECT_CONTEXT*/
+STDCALL
+FsRtlLookupPerFileObjectContext (
+    IN PFSRTL_ADVANCED_FCB_HEADER StreamContext,
+    IN PVOID OwnerId OPTIONAL,
+    IN PVOID InstanceId OPTIONAL
+    )
+{
+  UNIMPLEMENTED;
+  return(FALSE);
+}
+
+/*
+ * @unimplemented
+ */
 BOOLEAN STDCALL
 FsRtlLookupLastLargeMcbEntry(IN PLARGE_MCB Mcb,
                             OUT PLONGLONG Vbn,
                             OUT PLONGLONG Lbn)
 {
-  UNIMPLEMENTED
+  UNIMPLEMENTED;
   return(FALSE);
 }
 
 
-VOID
-STDCALL
-FsRtlLookupLastMcbEntry (
-       DWORD   Unknown0,
-       DWORD   Unknown1,
-       DWORD   Unknown2
-       )
+/*
+ * @implemented
+ */
+BOOLEAN STDCALL
+FsRtlLookupLastMcbEntry(IN PMCB Mcb,
+                        OUT PVBN Vbn,
+                        OUT PLBN Lbn)
 {
-       UNIMPLEMENTED
+  BOOLEAN Return = FALSE;
+  LONGLONG llVbn;
+  LONGLONG llLbn;
+
+  /* Call the Large version */
+  Return = FsRtlLookupLastLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly,
+                                        &llVbn,
+                                        &llLbn);
+
+  /* Return everything typecasted */
+  *Vbn = (ULONG)llVbn;
+  *Lbn = (ULONG)llLbn;
+
+  /* And return the original value */
+  return(Return);
 }
 
 
-VOID
-STDCALL
-FsRtlLookupMcbEntry (
-       DWORD   Unknown0,
-       DWORD   Unknown1,
-       DWORD   Unknown2,
-       DWORD   Unknown3,
-       DWORD   Unknown4
-       )
+/*
+ * @implemented
+ */
+BOOLEAN STDCALL
+FsRtlLookupMcbEntry(IN PMCB Mcb,
+                    IN VBN Vbn,
+                    OUT PLBN Lbn,
+                    OUT PULONG SectorCount OPTIONAL,
+                    OUT PULONG Index)
 {
-       UNIMPLEMENTED
+  BOOLEAN Return = FALSE;
+  LONGLONG llLbn;
+  LONGLONG llSectorCount;
+
+  /* Call the Large version */
+  Return = FsRtlLookupLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly,
+                                    (LONGLONG)Vbn,
+                                    &llLbn,
+                                    &llSectorCount,
+                                    NULL,
+                                    NULL,
+                                    Index);
+
+  /* Return everything typecasted */
+  *Lbn = (ULONG)llLbn;
+  if (SectorCount) *SectorCount = (ULONG)llSectorCount;
+
+  /* And return the original value */
+  return(Return);
 }
 
 
+/*
+ * @implemented
+ */
 ULONG STDCALL
 FsRtlNumberOfRunsInLargeMcb(IN PLARGE_MCB Mcb)
 {
-  UNIMPLEMENTED
-  return(0);
+  ULONG NumberOfRuns;
+  ExAcquireFastMutex (Mcb->FastMutex);
+  NumberOfRuns=Mcb->BaseMcb.MaximumPairCount;
+  ExReleaseFastMutex (Mcb->FastMutex);
+  return(NumberOfRuns);
 }
 
 
-VOID
-STDCALL
-FsRtlNumberOfRunsInMcb (
-       DWORD   Unknown0
-       )
+/*
+ * FsRtlNumberOfRunsInMcb: Obsolete
+ *
+ * @implemented
+ */
+ULONG STDCALL
+FsRtlNumberOfRunsInMcb (IN PMCB Mcb)
 {
-       UNIMPLEMENTED
+  return FsRtlNumberOfRunsInLargeMcb(& Mcb->DummyFieldThatSizesThisStructureCorrectly);
 }
 
 
+/*
+ * @unimplemented
+ */
 VOID STDCALL
 FsRtlRemoveLargeMcbEntry(IN PLARGE_MCB Mcb,
                         IN LONGLONG Vbn,
                         IN LONGLONG SectorCount)
 {
-  UNIMPLEMENTED
+  UNIMPLEMENTED;
 }
 
 
+/*
+ * @implemented
+ */
+VOID STDCALL
+FsRtlRemoveMcbEntry (IN PMCB     Mcb,
+                    IN VBN      Vbn,
+                    IN ULONG    SectorCount)
+{
+    /* Call the large function */
+      return FsRtlRemoveLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly,
+                                      (LONGLONG)Vbn,
+                                      (LONGLONG)SectorCount);
+}
+
+
+/*
+ * @unimplemented
+ */
 VOID
 STDCALL
-FsRtlRemoveMcbEntry (
-       DWORD   Unknown0,
-       DWORD   Unknown1,
-       DWORD   Unknown2
-       )
+FsRtlResetLargeMcb (
+    IN PLARGE_MCB Mcb,
+    IN BOOLEAN SelfSynchronized
+    )
 {
-       UNIMPLEMENTED
+  UNIMPLEMENTED;
 }
 
-
+/*
+ * @unimplemented
+ */
 BOOLEAN STDCALL
 FsRtlSplitLargeMcb(IN PLARGE_MCB Mcb,
                   IN LONGLONG Vbn,
                   IN LONGLONG Amount)
 {
-  UNIMPLEMENTED
+  UNIMPLEMENTED;
   return(FALSE);
 }
 
 
+/*
+ * @unimplemented
+ */
 VOID STDCALL
 FsRtlTruncateLargeMcb(IN PLARGE_MCB Mcb,
                      IN LONGLONG Vbn)
 {
-  UNIMPLEMENTED
+  UNIMPLEMENTED;
 }
 
 
-VOID
-STDCALL
-FsRtlTruncateMcb (
-       DWORD   Unknown0,
-       DWORD   Unknown1
-       )
+/*
+ * FsRtlTruncateMcb: Obsolete
+ *
+ * @implemented
+ */
+VOID STDCALL
+FsRtlTruncateMcb (IN PMCB Mcb,
+                 IN VBN  Vbn)
 {
-       UNIMPLEMENTED
+  FsRtlTruncateLargeMcb (& Mcb->DummyFieldThatSizesThisStructureCorrectly, (LONGLONG) Vbn);
 }
 
 
+/*
+ * @unimplemented
+ */
 VOID STDCALL
 FsRtlUninitializeLargeMcb(IN PLARGE_MCB Mcb)
 {
   UNIMPLEMENTED;
 }
 
-
-VOID
-STDCALL
-FsRtlUninitializeMcb (
-       DWORD   Unknown0
-       )
+/*
+ * FsRtlUninitializeMcb: Obsolete
+ *
+ * @implemented
+ */
+VOID STDCALL
+FsRtlUninitializeMcb (IN PMCB Mcb)
 {
-       UNIMPLEMENTED
+  FsRtlUninitializeLargeMcb(& Mcb->DummyFieldThatSizesThisStructureCorrectly);
 }