Author: fireball
Date: Fri May 4 22:34:48 2007
New Revision: 26636
URL:
http://svn.reactos.org/svn/reactos?rev=26636&view=rev
Log:
- Add fundamental VCB structure, and function to initialize it.
- Add common headers to all xCB structures.
- All development is being done according to Rajeev Nagar's book and some parts are
inspired by its accompanying FSD sample.
Modified:
trunk/reactos/drivers/filesystems/npfs_new/npfs.c
trunk/reactos/drivers/filesystems/npfs_new/npfs.h
Modified: trunk/reactos/drivers/filesystems/npfs_new/npfs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/npfs.c (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/npfs.c Fri May 4 22:34:48 2007
@@ -14,6 +14,8 @@
#include <debug.h>
ULONG NpfsDebugLevel = NPFS_DL_API_TRACE;
+
+static VOID NpfsInitializeVcb(PNPFS_VCB Vcb);
/* FUNCTIONS *****************************************************************/
@@ -67,6 +69,9 @@
/* initialize the device extension */
DeviceExtension = DeviceObject->DeviceExtension;
+
+ NpfsInitializeVcb(&DeviceExtension->Vcb);
+
InitializeListHead(&DeviceExtension->PipeListHead);
InitializeListHead(&DeviceExtension->ThreadListHead);
KeInitializeMutex(&DeviceExtension->PipeListLock, 0);
@@ -78,6 +83,22 @@
DeviceExtension->MaxQuota = 64 * PAGE_SIZE;
return STATUS_SUCCESS;
+}
+
+static VOID
+NpfsInitializeVcb(PNPFS_VCB Vcb)
+{
+ /* Initialize Volume Control Block, it's one per whole named pipe
+ file system. */
+
+ NpfsDbgPrint(NPFS_DL_API_TRACE, "NpfsInitializeVcb(), Vcb = %p\n", Vcb);
+
+ /* Zero-init whole VCB */
+ RtlZeroMemory(Vcb, sizeof(NPFS_VCB));
+
+ /* Initialize the common header */
+ Vcb->NodeTypeCode = NPFS_NODETYPE_VCB;
+ Vcb->NodeByteSize = sizeof(NPFS_VCB);
}
VOID NTAPI
Modified: trunk/reactos/drivers/filesystems/npfs_new/npfs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/npfs.h (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/npfs.h Fri May 4 22:34:48 2007
@@ -11,20 +11,23 @@
#define NPFS_DL_NONE 0x00000000
#define NPFS_DL_API_TRACE 0x00000001
-typedef struct _NPFS_DEVICE_EXTENSION
+/* Node type codes for NPFS */
+#define NPFS_NODETYPE_VCB 0x401
+#define NPFS_NODETYPE_DCB 0x402
+#define NPFS_NODETYPE_FCB 0x404
+#define NPFS_NODETYPE_CCB 0x406
+
+typedef struct _NPFS_VCB
{
- LIST_ENTRY PipeListHead;
- LIST_ENTRY ThreadListHead;
- KMUTEX PipeListLock;
- ULONG EmptyWaiterCount;
- ULONG MinQuota;
- ULONG DefaultQuota;
- ULONG MaxQuota;
-} NPFS_DEVICE_EXTENSION, *PNPFS_DEVICE_EXTENSION;
+ /* Common node header */
+ CSHORT NodeTypeCode;
+ CSHORT NodeByteSize;
+
+} NPFS_VCB, *PNPFS_VCB;
typedef struct _NPFS_FCB
{
- FSRTL_COMMON_FCB_HEADER RFCB;
+ FSRTL_COMMON_FCB_HEADER RFCB; /* Includes common node header */
UNICODE_STRING PipeName;
LIST_ENTRY PipeListEntry;
KMUTEX CcbListLock;
@@ -46,6 +49,10 @@
typedef struct _NPFS_CCB
{
+ /* Common node header */
+ CSHORT NodeTypeCode;
+ CSHORT NodeByteSize;
+
LIST_ENTRY CcbListEntry;
struct _NPFS_CCB* OtherSide;
struct ETHREAD *Thread;
@@ -67,6 +74,20 @@
FAST_MUTEX DataListLock; /* Data queue lock */
} NPFS_CCB, *PNPFS_CCB;
+
+typedef struct _NPFS_DEVICE_EXTENSION
+{
+ LIST_ENTRY PipeListHead;
+ LIST_ENTRY ThreadListHead;
+ KMUTEX PipeListLock;
+ ULONG EmptyWaiterCount;
+ ULONG MinQuota;
+ ULONG DefaultQuota;
+ ULONG MaxQuota;
+
+ NPFS_VCB Vcb;
+} NPFS_DEVICE_EXTENSION, *PNPFS_DEVICE_EXTENSION;
+
typedef struct _NPFS_CONTEXT
{
@@ -90,7 +111,6 @@
LIST_ENTRY Entry;
PNPFS_CCB Ccb;
} NPFS_WAITER_ENTRY, *PNPFS_WAITER_ENTRY;
-
extern NPAGED_LOOKASIDE_LIST NpfsPipeDataLookasideList;