Author: ekohl
Date: Sun May 7 15:14:41 2006
New Revision: 21825
URL:
http://svn.reactos.ru/svn/reactos?rev=21825&view=rev
Log:
Update Indentation (tab->4spaces).
Modified:
trunk/reactos/drivers/filesystems/ms/create.c
trunk/reactos/drivers/filesystems/ms/finfo.c
trunk/reactos/drivers/filesystems/ms/fsctrl.c
trunk/reactos/drivers/filesystems/ms/msfs.c
trunk/reactos/drivers/filesystems/ms/msfs.h
trunk/reactos/drivers/filesystems/ms/msfs.rbuild
trunk/reactos/drivers/filesystems/ms/rw.c
Modified: trunk/reactos/drivers/filesystems/ms/create.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/ms/crea…
==============================================================================
--- trunk/reactos/drivers/filesystems/ms/create.c (original)
+++ trunk/reactos/drivers/filesystems/ms/create.c Sun May 7 15:14:41 2006
@@ -2,9 +2,9 @@
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
- * FILE: services/fs/ms/create.c
+ * FILE: drivers/filesystems/ms/create.c
* PURPOSE: Mailslot filesystem
- * PROGRAMMER: Eric Kohl <ekohl(a)rz-online.de>
+ * PROGRAMMER: Eric Kohl
*/
/* INCLUDES ******************************************************************/
@@ -19,300 +19,296 @@
NTSTATUS DEFAULTAPI
MsfsCreate(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
+ PIRP Irp)
{
- PIO_STACK_LOCATION IoStack;
- PFILE_OBJECT FileObject;
- PMSFS_DEVICE_EXTENSION DeviceExtension;
- PMSFS_FCB Fcb;
- PMSFS_CCB Ccb;
- PMSFS_FCB current = NULL;
- PLIST_ENTRY current_entry;
- KIRQL oldIrql;
-
- DPRINT("MsfsCreate(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
-
- IoStack = IoGetCurrentIrpStackLocation(Irp);
- DeviceExtension = DeviceObject->DeviceExtension;
- FileObject = IoStack->FileObject;
-
- DPRINT("Mailslot name: %wZ\n", &FileObject->FileName);
-
- Ccb = ExAllocatePool(NonPagedPool, sizeof(MSFS_CCB));
- if (Ccb == NULL)
- {
- Irp->IoStatus.Status = STATUS_NO_MEMORY;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return(STATUS_NO_MEMORY);
- }
-
- KeLockMutex(&DeviceExtension->FcbListLock);
- current_entry = DeviceExtension->FcbListHead.Flink;
- while (current_entry != &DeviceExtension->FcbListHead)
- {
- current = CONTAINING_RECORD(current_entry,
- MSFS_FCB,
- FcbListEntry);
-
- if (!RtlCompareUnicodeString(&FileObject->FileName, ¤t->Name,
TRUE))
- {
- break;
- }
-
- current_entry = current_entry->Flink;
- }
-
- if (current_entry == &DeviceExtension->FcbListHead)
- {
- ExFreePool(Ccb);
- KeUnlockMutex(&DeviceExtension->FcbListLock);
-
- Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return(STATUS_UNSUCCESSFUL);
- }
-
- Fcb = current;
-
- KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
- InsertTailList(&Fcb->CcbListHead, &Ccb->CcbListEntry);
- KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
-
- Fcb->ReferenceCount++;
-
- Ccb->Fcb = Fcb;
-
- KeUnlockMutex(&DeviceExtension->FcbListLock);
-
- FileObject->FsContext = Fcb;
- FileObject->FsContext2 = Ccb;
- FileObject->Flags |= FO_MAILSLOT;
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return(STATUS_SUCCESS);
+ PIO_STACK_LOCATION IoStack;
+ PFILE_OBJECT FileObject;
+ PMSFS_DEVICE_EXTENSION DeviceExtension;
+ PMSFS_FCB Fcb;
+ PMSFS_CCB Ccb;
+ PMSFS_FCB current = NULL;
+ PLIST_ENTRY current_entry;
+ KIRQL oldIrql;
+
+ DPRINT("MsfsCreate(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
+
+ IoStack = IoGetCurrentIrpStackLocation(Irp);
+ DeviceExtension = DeviceObject->DeviceExtension;
+ FileObject = IoStack->FileObject;
+
+ DPRINT("Mailslot name: %wZ\n", &FileObject->FileName);
+
+ Ccb = ExAllocatePool(NonPagedPool, sizeof(MSFS_CCB));
+ if (Ccb == NULL)
+ {
+ Irp->IoStatus.Status = STATUS_NO_MEMORY;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_NO_MEMORY;
+ }
+
+ KeLockMutex(&DeviceExtension->FcbListLock);
+ current_entry = DeviceExtension->FcbListHead.Flink;
+ while (current_entry != &DeviceExtension->FcbListHead)
+ {
+ current = CONTAINING_RECORD(current_entry,
+ MSFS_FCB,
+ FcbListEntry);
+
+ if (!RtlCompareUnicodeString(&FileObject->FileName, ¤t->Name,
TRUE))
+ break;
+
+ current_entry = current_entry->Flink;
+ }
+
+ if (current_entry == &DeviceExtension->FcbListHead)
+ {
+ ExFreePool(Ccb);
+ KeUnlockMutex(&DeviceExtension->FcbListLock);
+
+ Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ Fcb = current;
+
+ KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
+ InsertTailList(&Fcb->CcbListHead, &Ccb->CcbListEntry);
+ KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
+
+ Fcb->ReferenceCount++;
+
+ Ccb->Fcb = Fcb;
+
+ KeUnlockMutex(&DeviceExtension->FcbListLock);
+
+ FileObject->FsContext = Fcb;
+ FileObject->FsContext2 = Ccb;
+ FileObject->Flags |= FO_MAILSLOT;
+
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return STATUS_SUCCESS;
}
NTSTATUS DEFAULTAPI
MsfsCreateMailslot(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
+ PIRP Irp)
{
- PEXTENDED_IO_STACK_LOCATION IoStack;
- PFILE_OBJECT FileObject;
- PMSFS_DEVICE_EXTENSION DeviceExtension;
- PMSFS_FCB Fcb;
- PMSFS_CCB Ccb;
- KIRQL oldIrql;
- PLIST_ENTRY current_entry;
- PMSFS_FCB current;
- PMAILSLOT_CREATE_PARAMETERS Buffer;
-
- DPRINT("MsfsCreateMailslot(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
-
- IoStack = (PEXTENDED_IO_STACK_LOCATION)IoGetCurrentIrpStackLocation(Irp);
- DeviceExtension = DeviceObject->DeviceExtension;
- FileObject = IoStack->FileObject;
- Buffer = IoStack->Parameters.CreateMailslot.Parameters;
-
- DPRINT("Mailslot name: %wZ\n", &FileObject->FileName);
-
- Fcb = ExAllocatePool(NonPagedPool, sizeof(MSFS_FCB));
- if (Fcb == NULL)
- {
- Irp->IoStatus.Status = STATUS_NO_MEMORY;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return(STATUS_NO_MEMORY);
- }
-
- Fcb->Name.Length = FileObject->FileName.Length;
- Fcb->Name.MaximumLength = Fcb->Name.Length + sizeof(UNICODE_NULL);
- Fcb->Name.Buffer = ExAllocatePool(NonPagedPool, Fcb->Name.MaximumLength);
- if (Fcb->Name.Buffer == NULL)
- {
- ExFreePool(Fcb);
-
- Irp->IoStatus.Status = STATUS_NO_MEMORY;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return(STATUS_NO_MEMORY);
- }
-
- RtlCopyUnicodeString(&Fcb->Name, &FileObject->FileName);
-
- Ccb = ExAllocatePool(NonPagedPool, sizeof(MSFS_CCB));
- if (Ccb == NULL)
- {
- ExFreePool(Fcb->Name.Buffer);
- ExFreePool(Fcb);
-
- Irp->IoStatus.Status = STATUS_NO_MEMORY;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return(STATUS_NO_MEMORY);
- }
-
- Fcb->ReferenceCount = 0;
- InitializeListHead(&Fcb->CcbListHead);
- KeInitializeSpinLock(&Fcb->CcbListLock);
-
- Fcb->MaxMessageSize = Buffer->MaximumMessageSize;
- Fcb->MessageCount = 0;
- Fcb->TimeOut = Buffer->ReadTimeout;
- KeInitializeEvent(&Fcb->MessageEvent,
- NotificationEvent,
- FALSE);
-
- InitializeListHead(&Fcb->MessageListHead);
- KeInitializeSpinLock(&Fcb->MessageListLock);
-
- KeLockMutex(&DeviceExtension->FcbListLock);
- current_entry = DeviceExtension->FcbListHead.Flink;
- while (current_entry != &DeviceExtension->FcbListHead)
- {
- current = CONTAINING_RECORD(current_entry,
- MSFS_FCB,
- FcbListEntry);
-
- if (!RtlCompareUnicodeString(&Fcb->Name, ¤t->Name, TRUE))
- {
- break;
- }
-
- current_entry = current_entry->Flink;
- }
-
- if (current_entry != &DeviceExtension->FcbListHead)
- {
- ExFreePool(Fcb->Name.Buffer);
- ExFreePool(Fcb);
-
- Fcb = current;
- }
- else
- {
- InsertTailList(&DeviceExtension->FcbListHead,
- &Fcb->FcbListEntry);
- }
-
- KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
- InsertTailList(&Fcb->CcbListHead, &Ccb->CcbListEntry);
- KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
-
- Fcb->ReferenceCount++;
- Fcb->ServerCcb = Ccb;
- Ccb->Fcb = Fcb;
-
- KeUnlockMutex(&DeviceExtension->FcbListLock);
-
- FileObject->FsContext = Fcb;
- FileObject->FsContext2 = Ccb;
- FileObject->Flags |= FO_MAILSLOT;
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return(STATUS_SUCCESS);
+ PEXTENDED_IO_STACK_LOCATION IoStack;
+ PFILE_OBJECT FileObject;
+ PMSFS_DEVICE_EXTENSION DeviceExtension;
+ PMSFS_FCB Fcb;
+ PMSFS_CCB Ccb;
+ KIRQL oldIrql;
+ PLIST_ENTRY current_entry;
+ PMSFS_FCB current;
+ PMAILSLOT_CREATE_PARAMETERS Buffer;
+
+ DPRINT("MsfsCreateMailslot(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
+
+ IoStack = (PEXTENDED_IO_STACK_LOCATION)IoGetCurrentIrpStackLocation(Irp);
+ DeviceExtension = DeviceObject->DeviceExtension;
+ FileObject = IoStack->FileObject;
+ Buffer = IoStack->Parameters.CreateMailslot.Parameters;
+
+ DPRINT("Mailslot name: %wZ\n", &FileObject->FileName);
+
+ Fcb = ExAllocatePool(NonPagedPool, sizeof(MSFS_FCB));
+ if (Fcb == NULL)
+ {
+ Irp->IoStatus.Status = STATUS_NO_MEMORY;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return STATUS_NO_MEMORY;
+ }
+
+ Fcb->Name.Length = FileObject->FileName.Length;
+ Fcb->Name.MaximumLength = Fcb->Name.Length + sizeof(UNICODE_NULL);
+ Fcb->Name.Buffer = ExAllocatePool(NonPagedPool, Fcb->Name.MaximumLength);
+ if (Fcb->Name.Buffer == NULL)
+ {
+ ExFreePool(Fcb);
+
+ Irp->IoStatus.Status = STATUS_NO_MEMORY;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return STATUS_NO_MEMORY;
+ }
+
+ RtlCopyUnicodeString(&Fcb->Name, &FileObject->FileName);
+
+ Ccb = ExAllocatePool(NonPagedPool, sizeof(MSFS_CCB));
+ if (Ccb == NULL)
+ {
+ ExFreePool(Fcb->Name.Buffer);
+ ExFreePool(Fcb);
+
+ Irp->IoStatus.Status = STATUS_NO_MEMORY;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return STATUS_NO_MEMORY;
+ }
+
+ Fcb->ReferenceCount = 0;
+ InitializeListHead(&Fcb->CcbListHead);
+ KeInitializeSpinLock(&Fcb->CcbListLock);
+
+ Fcb->MaxMessageSize = Buffer->MaximumMessageSize;
+ Fcb->MessageCount = 0;
+ Fcb->TimeOut = Buffer->ReadTimeout;
+ KeInitializeEvent(&Fcb->MessageEvent,
+ NotificationEvent,
+ FALSE);
+
+ InitializeListHead(&Fcb->MessageListHead);
+ KeInitializeSpinLock(&Fcb->MessageListLock);
+
+ KeLockMutex(&DeviceExtension->FcbListLock);
+ current_entry = DeviceExtension->FcbListHead.Flink;
+ while (current_entry != &DeviceExtension->FcbListHead)
+ {
+ current = CONTAINING_RECORD(current_entry,
+ MSFS_FCB,
+ FcbListEntry);
+
+ if (!RtlCompareUnicodeString(&Fcb->Name, ¤t->Name, TRUE))
+ break;
+
+ current_entry = current_entry->Flink;
+ }
+
+ if (current_entry != &DeviceExtension->FcbListHead)
+ {
+ ExFreePool(Fcb->Name.Buffer);
+ ExFreePool(Fcb);
+
+ Fcb = current;
+ }
+ else
+ {
+ InsertTailList(&DeviceExtension->FcbListHead,
+ &Fcb->FcbListEntry);
+ }
+
+ KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
+ InsertTailList(&Fcb->CcbListHead, &Ccb->CcbListEntry);
+ KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
+
+ Fcb->ReferenceCount++;
+ Fcb->ServerCcb = Ccb;
+ Ccb->Fcb = Fcb;
+
+ KeUnlockMutex(&DeviceExtension->FcbListLock);
+
+ FileObject->FsContext = Fcb;
+ FileObject->FsContext2 = Ccb;
+ FileObject->Flags |= FO_MAILSLOT;
+
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return STATUS_SUCCESS;
}
NTSTATUS DEFAULTAPI
MsfsClose(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
+ PIRP Irp)
{
- PIO_STACK_LOCATION IoStack;
- PFILE_OBJECT FileObject;
- PMSFS_DEVICE_EXTENSION DeviceExtension;
- PMSFS_FCB Fcb;
- PMSFS_CCB Ccb;
- PMSFS_MESSAGE Message;
- KIRQL oldIrql;
-
- DPRINT("MsfsClose(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
-
- IoStack = IoGetCurrentIrpStackLocation(Irp);
- DeviceExtension = DeviceObject->DeviceExtension;
- FileObject = IoStack->FileObject;
-
- KeLockMutex(&DeviceExtension->FcbListLock);
-
- if (DeviceExtension->FcbListHead.Flink == &DeviceExtension->FcbListHead)
- {
- KeUnlockMutex(&DeviceExtension->FcbListLock);
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return(STATUS_SUCCESS);
- }
-
- Fcb = FileObject->FsContext;
- Ccb = FileObject->FsContext2;
-
- DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
-
- Fcb->ReferenceCount--;
- if (Fcb->ServerCcb == Ccb)
- {
- /* delete all messages from message-list */
- KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
-
- while (Fcb->MessageListHead.Flink != &Fcb->MessageListHead)
- {
- Message = CONTAINING_RECORD(Fcb->MessageListHead.Flink,
- MSFS_MESSAGE,
- MessageListEntry);
- RemoveEntryList(Fcb->MessageListHead.Flink);
- ExFreePool(Message);
- }
- Fcb->MessageCount = 0;
-
- KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
- Fcb->ServerCcb = NULL;
- }
-
- KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
- RemoveEntryList(&Ccb->CcbListEntry);
- KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
- ExFreePool(Ccb);
- FileObject->FsContext2 = NULL;
-
- if (Fcb->ReferenceCount == 0)
- {
- DPRINT1("ReferenceCount == 0: Deleting mailslot data\n");
- RemoveEntryList(&Fcb->FcbListEntry);
- ExFreePool(Fcb->Name.Buffer);
- ExFreePool(Fcb);
- }
-
- KeUnlockMutex(&DeviceExtension->FcbListLock);
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return(STATUS_SUCCESS);
+ PIO_STACK_LOCATION IoStack;
+ PFILE_OBJECT FileObject;
+ PMSFS_DEVICE_EXTENSION DeviceExtension;
+ PMSFS_FCB Fcb;
+ PMSFS_CCB Ccb;
+ PMSFS_MESSAGE Message;
+ KIRQL oldIrql;
+
+ DPRINT("MsfsClose(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
+
+ IoStack = IoGetCurrentIrpStackLocation(Irp);
+ DeviceExtension = DeviceObject->DeviceExtension;
+ FileObject = IoStack->FileObject;
+
+ KeLockMutex(&DeviceExtension->FcbListLock);
+
+ if (DeviceExtension->FcbListHead.Flink == &DeviceExtension->FcbListHead)
+ {
+ KeUnlockMutex(&DeviceExtension->FcbListLock);
+
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return STATUS_SUCCESS;
+ }
+
+ Fcb = FileObject->FsContext;
+ Ccb = FileObject->FsContext2;
+
+ DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
+
+ Fcb->ReferenceCount--;
+ if (Fcb->ServerCcb == Ccb)
+ {
+ /* delete all messages from message-list */
+ KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
+
+ while (Fcb->MessageListHead.Flink != &Fcb->MessageListHead)
+ {
+ Message = CONTAINING_RECORD(Fcb->MessageListHead.Flink,
+ MSFS_MESSAGE,
+ MessageListEntry);
+ RemoveEntryList(Fcb->MessageListHead.Flink);
+ ExFreePool(Message);
+ }
+
+ Fcb->MessageCount = 0;
+
+ KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
+ Fcb->ServerCcb = NULL;
+ }
+
+ KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
+ RemoveEntryList(&Ccb->CcbListEntry);
+ KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
+ ExFreePool(Ccb);
+ FileObject->FsContext2 = NULL;
+
+ if (Fcb->ReferenceCount == 0)
+ {
+ DPRINT1("ReferenceCount == 0: Deleting mailslot data\n");
+ RemoveEntryList(&Fcb->FcbListEntry);
+ ExFreePool(Fcb->Name.Buffer);
+ ExFreePool(Fcb);
+ }
+
+ KeUnlockMutex(&DeviceExtension->FcbListLock);
+
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return STATUS_SUCCESS;
}
/* EOF */
Modified: trunk/reactos/drivers/filesystems/ms/finfo.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/ms/finf…
==============================================================================
--- trunk/reactos/drivers/filesystems/ms/finfo.c (original)
+++ trunk/reactos/drivers/filesystems/ms/finfo.c Sun May 7 15:14:41 2006
@@ -2,9 +2,9 @@
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
- * FILE: services/fs/ms/finfo.c
+ * FILE: drivers/filesystems/ms/finfo.c
* PURPOSE: Mailslot filesystem
- * PROGRAMMER: Eric Kohl <ekohl(a)rz-online.de>
+ * PROGRAMMER: Eric Kohl
*/
/* INCLUDES ******************************************************************/
@@ -19,176 +19,175 @@
static NTSTATUS
MsfsQueryMailslotInformation(PMSFS_FCB Fcb,
- PFILE_MAILSLOT_QUERY_INFORMATION Buffer,
- PULONG BufferLength)
+ PFILE_MAILSLOT_QUERY_INFORMATION Buffer,
+ PULONG BufferLength)
{
- KIRQL oldIrql;
+ KIRQL oldIrql;
- if (*BufferLength < sizeof(FILE_MAILSLOT_QUERY_INFORMATION))
- return(STATUS_BUFFER_OVERFLOW);
+ if (*BufferLength < sizeof(FILE_MAILSLOT_QUERY_INFORMATION))
+ return STATUS_BUFFER_OVERFLOW;
- Buffer->MaximumMessageSize = Fcb->MaxMessageSize;
- Buffer->ReadTimeout = Fcb->TimeOut;
+ Buffer->MaximumMessageSize = Fcb->MaxMessageSize;
+ Buffer->ReadTimeout = Fcb->TimeOut;
- KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
- Buffer->MessagesAvailable = Fcb->MessageCount;
- if (Fcb->MessageCount == 0)
- {
- Buffer->NextMessageSize = MAILSLOT_NO_MESSAGE;
- }
- else
- {
- /* FIXME: read size of first message (head) */
- Buffer->NextMessageSize = 0;
- }
- KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
+ KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
+ Buffer->MessagesAvailable = Fcb->MessageCount;
+ if (Fcb->MessageCount == 0)
+ {
+ Buffer->NextMessageSize = MAILSLOT_NO_MESSAGE;
+ }
+ else
+ {
+ /* FIXME: read size of first message (head) */
+ Buffer->NextMessageSize = 0;
+ }
+ KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
- *BufferLength -= sizeof(FILE_MAILSLOT_QUERY_INFORMATION);
+ *BufferLength -= sizeof(FILE_MAILSLOT_QUERY_INFORMATION);
- return(STATUS_SUCCESS);
+ return STATUS_SUCCESS;
}
static NTSTATUS
MsfsSetMailslotInformation(PMSFS_FCB Fcb,
- PFILE_MAILSLOT_SET_INFORMATION Buffer,
- PULONG BufferLength)
+ PFILE_MAILSLOT_SET_INFORMATION Buffer,
+ PULONG BufferLength)
{
- if (*BufferLength < sizeof(FILE_MAILSLOT_SET_INFORMATION))
- return(STATUS_BUFFER_OVERFLOW);
+ if (*BufferLength < sizeof(FILE_MAILSLOT_SET_INFORMATION))
+ return STATUS_BUFFER_OVERFLOW;
- Fcb->TimeOut = *Buffer->ReadTimeout;
+ Fcb->TimeOut = *Buffer->ReadTimeout;
- return(STATUS_SUCCESS);
+ return STATUS_SUCCESS;
}
NTSTATUS DEFAULTAPI
MsfsQueryInformation(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
+ PIRP Irp)
{
- PIO_STACK_LOCATION IoStack;
- FILE_INFORMATION_CLASS FileInformationClass;
- PFILE_OBJECT FileObject;
- PMSFS_DEVICE_EXTENSION DeviceExtension;
- PMSFS_FCB Fcb;
- PMSFS_CCB Ccb;
- PVOID SystemBuffer;
- ULONG BufferLength;
- NTSTATUS Status;
+ PIO_STACK_LOCATION IoStack;
+ FILE_INFORMATION_CLASS FileInformationClass;
+ PFILE_OBJECT FileObject;
+ PMSFS_DEVICE_EXTENSION DeviceExtension;
+ PMSFS_FCB Fcb;
+ PMSFS_CCB Ccb;
+ PVOID SystemBuffer;
+ ULONG BufferLength;
+ NTSTATUS Status;
- DPRINT("MsfsQueryInformation(DeviceObject %p Irp %p)\n", DeviceObject,
Irp);
+ DPRINT("MsfsQueryInformation(DeviceObject %p Irp %p)\n",
+ DeviceObject, Irp);
- IoStack = IoGetCurrentIrpStackLocation (Irp);
- FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
- DeviceExtension = DeviceObject->DeviceExtension;
- FileObject = IoStack->FileObject;
- Fcb = (PMSFS_FCB)FileObject->FsContext;
- Ccb = (PMSFS_CCB)FileObject->FsContext2;
+ IoStack = IoGetCurrentIrpStackLocation (Irp);
+ FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
+ DeviceExtension = DeviceObject->DeviceExtension;
+ FileObject = IoStack->FileObject;
+ Fcb = (PMSFS_FCB)FileObject->FsContext;
+ Ccb = (PMSFS_CCB)FileObject->FsContext2;
- DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
+ DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
- /* querying information is not permitted on client side */
- if (Fcb->ServerCcb != Ccb)
- {
- Status = STATUS_ACCESS_DENIED;
+ /* querying information is not permitted on client side */
+ if (Fcb->ServerCcb != Ccb)
+ {
+ Status = STATUS_ACCESS_DENIED;
- Irp->IoStatus.Status = Status;
- Irp->IoStatus.Information = 0;
+ Irp->IoStatus.Status = Status;
+ Irp->IoStatus.Information = 0;
- IoCompleteRequest(Irp,
- IO_NO_INCREMENT);
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return(Status);
- }
+ return Status;
+ }
- SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
- BufferLength = IoStack->Parameters.QueryFile.Length;
+ SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
+ BufferLength = IoStack->Parameters.QueryFile.Length;
- switch (FileInformationClass)
- {
- case FileMailslotQueryInformation:
- Status = MsfsQueryMailslotInformation(Fcb,
- SystemBuffer,
- &BufferLength);
- break;
- default:
- Status = STATUS_NOT_IMPLEMENTED;
- }
+ switch (FileInformationClass)
+ {
+ case FileMailslotQueryInformation:
+ Status = MsfsQueryMailslotInformation(Fcb,
+ SystemBuffer,
+ &BufferLength);
+ break;
- Irp->IoStatus.Status = Status;
- if (NT_SUCCESS(Status))
- Irp->IoStatus.Information =
- IoStack->Parameters.QueryFile.Length - BufferLength;
- else
- Irp->IoStatus.Information = 0;
- IoCompleteRequest(Irp,
- IO_NO_INCREMENT);
+ default:
+ Status = STATUS_NOT_IMPLEMENTED;
+ }
- return(Status);
+ Irp->IoStatus.Status = Status;
+ if (NT_SUCCESS(Status))
+ Irp->IoStatus.Information =
+ IoStack->Parameters.QueryFile.Length - BufferLength;
+ else
+ Irp->IoStatus.Information = 0;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return Status;
}
NTSTATUS DEFAULTAPI
MsfsSetInformation(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
+ PIRP Irp)
{
- PIO_STACK_LOCATION IoStack;
- FILE_INFORMATION_CLASS FileInformationClass;
- PFILE_OBJECT FileObject;
- PMSFS_FCB Fcb;
- PMSFS_CCB Ccb;
- PVOID SystemBuffer;
- ULONG BufferLength;
- NTSTATUS Status;
+ PIO_STACK_LOCATION IoStack;
+ FILE_INFORMATION_CLASS FileInformationClass;
+ PFILE_OBJECT FileObject;
+ PMSFS_FCB Fcb;
+ PMSFS_CCB Ccb;
+ PVOID SystemBuffer;
+ ULONG BufferLength;
+ NTSTATUS Status;
- DPRINT("MsfsSetInformation(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
+ DPRINT("MsfsSetInformation(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
- IoStack = IoGetCurrentIrpStackLocation (Irp);
- FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
- FileObject = IoStack->FileObject;
- Fcb = (PMSFS_FCB)FileObject->FsContext;
- Ccb = (PMSFS_CCB)FileObject->FsContext2;
+ IoStack = IoGetCurrentIrpStackLocation (Irp);
+ FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
+ FileObject = IoStack->FileObject;
+ Fcb = (PMSFS_FCB)FileObject->FsContext;
+ Ccb = (PMSFS_CCB)FileObject->FsContext2;
- DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
+ DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
- /* setting information is not permitted on client side */
- if (Fcb->ServerCcb != Ccb)
- {
- Status = STATUS_ACCESS_DENIED;
+ /* setting information is not permitted on client side */
+ if (Fcb->ServerCcb != Ccb)
+ {
+ Status = STATUS_ACCESS_DENIED;
- Irp->IoStatus.Status = Status;
- Irp->IoStatus.Information = 0;
+ Irp->IoStatus.Status = Status;
+ Irp->IoStatus.Information = 0;
- IoCompleteRequest(Irp,
- IO_NO_INCREMENT);
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return(Status);
- }
+ return Status;
+ }
- SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
- BufferLength = IoStack->Parameters.QueryFile.Length;
+ SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
+ BufferLength = IoStack->Parameters.QueryFile.Length;
- DPRINT("FileInformationClass %d\n", FileInformationClass);
- DPRINT("SystemBuffer %x\n", SystemBuffer);
+ DPRINT("FileInformationClass %d\n", FileInformationClass);
+ DPRINT("SystemBuffer %x\n", SystemBuffer);
- switch (FileInformationClass)
- {
- case FileMailslotSetInformation:
- Status = MsfsSetMailslotInformation(Fcb,
- SystemBuffer,
- &BufferLength);
- break;
+ switch (FileInformationClass)
+ {
+ case FileMailslotSetInformation:
+ Status = MsfsSetMailslotInformation(Fcb,
+ SystemBuffer,
+ &BufferLength);
+ break;
+
default:
- Status = STATUS_NOT_IMPLEMENTED;
- }
+ Status = STATUS_NOT_IMPLEMENTED;
+ }
- Irp->IoStatus.Status = Status;
- Irp->IoStatus.Information = 0;
- IoCompleteRequest(Irp,
- IO_NO_INCREMENT);
+ Irp->IoStatus.Status = Status;
+ Irp->IoStatus.Information = 0;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return(Status);
+ return Status;
}
/* EOF */
Modified: trunk/reactos/drivers/filesystems/ms/fsctrl.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/ms/fsct…
==============================================================================
--- trunk/reactos/drivers/filesystems/ms/fsctrl.c (original)
+++ trunk/reactos/drivers/filesystems/ms/fsctrl.c Sun May 7 15:14:41 2006
@@ -2,9 +2,9 @@
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
- * FILE: services/fs/ms/fsctrl.c
+ * FILE: drivers/filesystems/ms/fsctrl.c
* PURPOSE: Mailslot filesystem
- * PROGRAMMER: Eric Kohl <ekohl(a)rz-online.de>
+ * PROGRAMMER: Eric Kohl
*/
/* INCLUDES ******************************************************************/
@@ -19,52 +19,37 @@
NTSTATUS DEFAULTAPI
MsfsFileSystemControl(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
+ PIRP Irp)
{
- PIO_STACK_LOCATION IoStack;
- PFILE_OBJECT FileObject;
- PMSFS_FCB Fcb;
- PMSFS_CCB Ccb;
- NTSTATUS Status;
+ PIO_STACK_LOCATION IoStack;
+ PFILE_OBJECT FileObject;
+ PMSFS_FCB Fcb;
+ PMSFS_CCB Ccb;
+ NTSTATUS Status;
- DPRINT1("MsfsFileSystemControl(DeviceObject %p Irp %p)\n", DeviceObject,
Irp);
+ DPRINT1("MsfsFileSystemControl(DeviceObject %p Irp %p)\n", DeviceObject,
Irp);
- IoStack = IoGetCurrentIrpStackLocation(Irp);
- FileObject = IoStack->FileObject;
- Fcb = FileObject->FsContext;
- Ccb = FileObject->FsContext2;
+ IoStack = IoGetCurrentIrpStackLocation(Irp);
+ FileObject = IoStack->FileObject;
+ Fcb = FileObject->FsContext;
+ Ccb = FileObject->FsContext2;
- DPRINT1("Mailslot name: %wZ\n", &Fcb->Name);
+ DPRINT1("Mailslot name: %wZ\n", &Fcb->Name);
- switch (IoStack->Parameters.FileSystemControl.FsControlCode)
- {
+ switch (IoStack->Parameters.FileSystemControl.FsControlCode)
+ {
#if 0
- case FSCTL_WAIT_PIPE:
- break;
-
- case FSCTL_LISTEN:
- break;
-
- case FSCTL_SET_STATE:
- break;
-
- case FSCTL_GET_STATE:
- {
-
-
- break;
- }
#endif
- default:
- Status = STATUS_NOT_IMPLEMENTED;
- }
+ default:
+ Status = STATUS_NOT_IMPLEMENTED;
+ }
- Irp->IoStatus.Status = Status;
- Irp->IoStatus.Information = 0;
- IoCompleteRequest (Irp, IO_NO_INCREMENT);
+ Irp->IoStatus.Status = Status;
+ Irp->IoStatus.Information = 0;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return(Status);
+ return Status;
}
/* EOF */
Modified: trunk/reactos/drivers/filesystems/ms/msfs.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/ms/msfs…
==============================================================================
--- trunk/reactos/drivers/filesystems/ms/msfs.c (original)
+++ trunk/reactos/drivers/filesystems/ms/msfs.c Sun May 7 15:14:41 2006
@@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel
* FILE: services/fs/ms/msfs.c
* PURPOSE: Mailslot filesystem
- * PROGRAMMER: Eric Kohl <ekohl(a)rz-online.de>
+ * PROGRAMMER: Eric Kohl
*/
/* INCLUDES ******************************************************************/
@@ -19,63 +19,63 @@
NTSTATUS NTAPI
DriverEntry(PDRIVER_OBJECT DriverObject,
- PUNICODE_STRING RegistryPath)
+ PUNICODE_STRING RegistryPath)
{
- PMSFS_DEVICE_EXTENSION DeviceExtension;
- PDEVICE_OBJECT DeviceObject;
- UNICODE_STRING DeviceName;
- NTSTATUS Status;
+ PMSFS_DEVICE_EXTENSION DeviceExtension;
+ PDEVICE_OBJECT DeviceObject;
+ UNICODE_STRING DeviceName;
+ NTSTATUS Status;
- DPRINT("Mailslot FSD 0.0.1\n");
+ DPRINT("Mailslot FSD 0.0.1\n");
- DriverObject->Flags = 0;
- DriverObject->MajorFunction[IRP_MJ_CREATE] = MsfsCreate;
- DriverObject->MajorFunction[IRP_MJ_CREATE_MAILSLOT] =
- MsfsCreateMailslot;
- DriverObject->MajorFunction[IRP_MJ_CLOSE] = MsfsClose;
- DriverObject->MajorFunction[IRP_MJ_READ] = MsfsRead;
- DriverObject->MajorFunction[IRP_MJ_WRITE] = MsfsWrite;
- DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
- MsfsQueryInformation;
- DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
- MsfsSetInformation;
-// DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
-// MsfsDirectoryControl;
-// DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = MsfsFlushBuffers;
-// DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = MsfsShutdown;
-// DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY] =
-// MsfsQuerySecurity;
-// DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] =
-// MsfsSetSecurity;
- DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
- MsfsFileSystemControl;
+ DriverObject->Flags = 0;
+ DriverObject->MajorFunction[IRP_MJ_CREATE] = MsfsCreate;
+ DriverObject->MajorFunction[IRP_MJ_CREATE_MAILSLOT] =
+ MsfsCreateMailslot;
+ DriverObject->MajorFunction[IRP_MJ_CLOSE] = MsfsClose;
+ DriverObject->MajorFunction[IRP_MJ_READ] = MsfsRead;
+ DriverObject->MajorFunction[IRP_MJ_WRITE] = MsfsWrite;
+ DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
+ MsfsQueryInformation;
+ DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
+ MsfsSetInformation;
+// DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
+// MsfsDirectoryControl;
+// DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = MsfsFlushBuffers;
+// DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = MsfsShutdown;
+// DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY] =
+// MsfsQuerySecurity;
+// DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] =
+// MsfsSetSecurity;
+ DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
+ MsfsFileSystemControl;
- DriverObject->DriverUnload = NULL;
+ DriverObject->DriverUnload = NULL;
- RtlInitUnicodeString(&DeviceName,
- L"\\Device\\MailSlot");
- Status = IoCreateDevice(DriverObject,
- sizeof(MSFS_DEVICE_EXTENSION),
- &DeviceName,
- FILE_DEVICE_MAILSLOT,
- 0,
- FALSE,
- &DeviceObject);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
+ RtlInitUnicodeString(&DeviceName,
+ L"\\Device\\MailSlot");
+ Status = IoCreateDevice(DriverObject,
+ sizeof(MSFS_DEVICE_EXTENSION),
+ &DeviceName,
+ FILE_DEVICE_MAILSLOT,
+ 0,
+ FALSE,
+ &DeviceObject);
+ if (!NT_SUCCESS(Status))
+ {
+ return Status;
+ }
- /* initialize the device object */
- DeviceObject->Flags = DO_DIRECT_IO;
+ /* initialize the device object */
+ DeviceObject->Flags = DO_DIRECT_IO;
- /* initialize device extension */
- DeviceExtension = DeviceObject->DeviceExtension;
- InitializeListHead(&DeviceExtension->FcbListHead);
- KeInitializeMutex(&DeviceExtension->FcbListLock,
- 0);
+ /* initialize device extension */
+ DeviceExtension = DeviceObject->DeviceExtension;
+ InitializeListHead(&DeviceExtension->FcbListHead);
+ KeInitializeMutex(&DeviceExtension->FcbListLock,
+ 0);
- return(STATUS_SUCCESS);
+ return STATUS_SUCCESS;
}
/* EOF */
Modified: trunk/reactos/drivers/filesystems/ms/msfs.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/ms/msfs…
==============================================================================
--- trunk/reactos/drivers/filesystems/ms/msfs.h (original)
+++ trunk/reactos/drivers/filesystems/ms/msfs.h Sun May 7 15:14:41 2006
@@ -1,5 +1,13 @@
-#ifndef __SERVICES_FS_MS_MSFS_H
-#define __SERVICES_FS_MS_MSFS_H
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * FILE: services/fs/ms/msfs.h
+ * PURPOSE: Mailslot filesystem
+ * PROGRAMMER: Eric Kohl
+ */
+
+#ifndef __DRIVERS_FS_MS_MSFS_H
+#define __DRIVERS_FS_MS_MSFS_H
#include <ntifs.h>
#include <ndk/ntndk.h>
@@ -22,37 +30,40 @@
typedef struct _MSFS_DEVICE_EXTENSION
{
- LIST_ENTRY FcbListHead;
- KMUTEX FcbListLock;
+ LIST_ENTRY FcbListHead;
+ KMUTEX FcbListLock;
} MSFS_DEVICE_EXTENSION, *PMSFS_DEVICE_EXTENSION;
+
typedef struct _MSFS_FCB
{
- UNICODE_STRING Name;
- LIST_ENTRY FcbListEntry;
- KSPIN_LOCK CcbListLock;
- LIST_ENTRY CcbListHead;
- struct _MSFS_CCB *ServerCcb;
- ULONG ReferenceCount;
- LARGE_INTEGER TimeOut;
- KEVENT MessageEvent;
- ULONG MaxMessageSize;
- ULONG MessageCount;
- KSPIN_LOCK MessageListLock;
- LIST_ENTRY MessageListHead;
+ UNICODE_STRING Name;
+ LIST_ENTRY FcbListEntry;
+ KSPIN_LOCK CcbListLock;
+ LIST_ENTRY CcbListHead;
+ struct _MSFS_CCB *ServerCcb;
+ ULONG ReferenceCount;
+ LARGE_INTEGER TimeOut;
+ KEVENT MessageEvent;
+ ULONG MaxMessageSize;
+ ULONG MessageCount;
+ KSPIN_LOCK MessageListLock;
+ LIST_ENTRY MessageListHead;
} MSFS_FCB, *PMSFS_FCB;
+
typedef struct _MSFS_CCB
{
- LIST_ENTRY CcbListEntry;
- PMSFS_FCB Fcb;
+ LIST_ENTRY CcbListEntry;
+ PMSFS_FCB Fcb;
} MSFS_CCB, *PMSFS_CCB;
+
typedef struct _MSFS_MESSAGE
{
- LIST_ENTRY MessageListEntry;
- ULONG Size;
- UCHAR Buffer[1];
+ LIST_ENTRY MessageListEntry;
+ ULONG Size;
+ UCHAR Buffer[1];
} MSFS_MESSAGE, *PMSFS_MESSAGE;
@@ -78,6 +89,6 @@
NTSTATUS NTAPI
DriverEntry(PDRIVER_OBJECT DriverObject,
- PUNICODE_STRING RegistryPath);
+ PUNICODE_STRING RegistryPath);
-#endif /* __SERVICES_FS_NP_NPFS_H */
+#endif /* __DRIVERS_FS_MS_MSFS_H */
Modified: trunk/reactos/drivers/filesystems/ms/msfs.rbuild
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/ms/msfs…
==============================================================================
--- trunk/reactos/drivers/filesystems/ms/msfs.rbuild (original)
+++ trunk/reactos/drivers/filesystems/ms/msfs.rbuild Sun May 7 15:14:41 2006
@@ -1,6 +1,6 @@
<module name="msfs" type="kernelmodedriver"
installbase="system32/drivers" installname="msfs.sys">
<include base="msfs">.</include>
- <define name="__USE_W32API" />
+ <define name="__USE_W32API" />
<library>ntoskrnl</library>
<library>hal</library>
<file>create.c</file>
Modified: trunk/reactos/drivers/filesystems/ms/rw.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/ms/rw.c…
==============================================================================
--- trunk/reactos/drivers/filesystems/ms/rw.c (original)
+++ trunk/reactos/drivers/filesystems/ms/rw.c Sun May 7 15:14:41 2006
@@ -2,9 +2,9 @@
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
- * FILE: services/fs/ms/rw.c
+ * FILE: drivers/filesystems/ms/rw.c
* PURPOSE: Mailslot filesystem
- * PROGRAMMER: Eric Kohl <ekohl(a)rz-online.de>
+ * PROGRAMMER: Eric Kohl
*/
/* INCLUDES ******************************************************************/
@@ -19,155 +19,156 @@
NTSTATUS DEFAULTAPI
MsfsRead(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
+ PIRP Irp)
{
- PIO_STACK_LOCATION IoStack;
- PFILE_OBJECT FileObject;
- PMSFS_FCB Fcb;
- PMSFS_CCB Ccb;
- PMSFS_MESSAGE Message;
- KIRQL oldIrql;
- ULONG Length;
- ULONG LengthRead = 0;
- PVOID Buffer;
- NTSTATUS Status;
+ PIO_STACK_LOCATION IoStack;
+ PFILE_OBJECT FileObject;
+ PMSFS_FCB Fcb;
+ PMSFS_CCB Ccb;
+ PMSFS_MESSAGE Message;
+ KIRQL oldIrql;
+ ULONG Length;
+ ULONG LengthRead = 0;
+ PVOID Buffer;
+ NTSTATUS Status;
- DPRINT("MsfsRead(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
+ DPRINT("MsfsRead(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
- IoStack = IoGetCurrentIrpStackLocation (Irp);
- FileObject = IoStack->FileObject;
- Fcb = (PMSFS_FCB)FileObject->FsContext;
- Ccb = (PMSFS_CCB)FileObject->FsContext2;
+ IoStack = IoGetCurrentIrpStackLocation (Irp);
+ FileObject = IoStack->FileObject;
+ Fcb = (PMSFS_FCB)FileObject->FsContext;
+ Ccb = (PMSFS_CCB)FileObject->FsContext2;
- DPRINT("MailslotName: %wZ\n", &Fcb->Name);
+ DPRINT("MailslotName: %wZ\n", &Fcb->Name);
- /* reading is not permitted on client side */
- if (Fcb->ServerCcb != Ccb)
- {
- Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
- Irp->IoStatus.Information = 0;
+ /* reading is not permitted on client side */
+ if (Fcb->ServerCcb != Ccb)
+ {
+ Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
+ Irp->IoStatus.Information = 0;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return(STATUS_ACCESS_DENIED);
+ return STATUS_ACCESS_DENIED;
+ }
+
+ Length = IoStack->Parameters.Read.Length;
+ if (Irp->MdlAddress)
+ Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
+ else
+ Buffer = Irp->UserBuffer;
+
+ Status = KeWaitForSingleObject(&Fcb->MessageEvent,
+ UserRequest,
+ KernelMode,
+ FALSE,
+ NULL); /* FIXME: handle timeout */
+ if ((NT_SUCCESS(Status)) && (Fcb->MessageCount > 0))
+ {
+ /* copy current message into buffer */
+ Message = CONTAINING_RECORD(Fcb->MessageListHead.Flink,
+ MSFS_MESSAGE,
+ MessageListEntry);
+
+ memcpy(Buffer, &Message->Buffer, min(Message->Size,Length));
+ LengthRead = Message->Size;
+
+ KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
+ RemoveHeadList(&Fcb->MessageListHead);
+ KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
+
+ ExFreePool(Message);
+ Fcb->MessageCount--;
+ if (Fcb->MessageCount == 0)
+ {
+ KeClearEvent(&Fcb->MessageEvent);
+ }
}
- Length = IoStack->Parameters.Read.Length;
- if (Irp->MdlAddress)
- Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
- else
- Buffer = Irp->UserBuffer;
+ Irp->IoStatus.Status = Status;
+ Irp->IoStatus.Information = LengthRead;
- Status = KeWaitForSingleObject(&Fcb->MessageEvent,
- UserRequest,
- KernelMode,
- FALSE,
- NULL); /* FIXME: handle timeout */
- if ((NT_SUCCESS(Status)) && (Fcb->MessageCount > 0))
- {
- /* copy current message into buffer */
- Message = CONTAINING_RECORD(Fcb->MessageListHead.Flink,
- MSFS_MESSAGE,
- MessageListEntry);
- memcpy(Buffer, &Message->Buffer, min(Message->Size,Length));
- LengthRead = Message->Size;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
- KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
- RemoveHeadList(&Fcb->MessageListHead);
- KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
-
- ExFreePool(Message);
- Fcb->MessageCount--;
- if (Fcb->MessageCount == 0)
- {
- KeClearEvent(&Fcb->MessageEvent);
- }
- }
-
- Irp->IoStatus.Status = Status;
- Irp->IoStatus.Information = LengthRead;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return(Status);
+ return Status;
}
NTSTATUS DEFAULTAPI
MsfsWrite(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
+ PIRP Irp)
{
- PIO_STACK_LOCATION IoStack;
- PFILE_OBJECT FileObject;
- PMSFS_FCB Fcb;
- PMSFS_CCB Ccb;
- PMSFS_MESSAGE Message;
- KIRQL oldIrql;
- ULONG Length;
- PVOID Buffer;
+ PIO_STACK_LOCATION IoStack;
+ PFILE_OBJECT FileObject;
+ PMSFS_FCB Fcb;
+ PMSFS_CCB Ccb;
+ PMSFS_MESSAGE Message;
+ KIRQL oldIrql;
+ ULONG Length;
+ PVOID Buffer;
- DPRINT("MsfsWrite(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
+ DPRINT("MsfsWrite(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
- IoStack = IoGetCurrentIrpStackLocation (Irp);
- FileObject = IoStack->FileObject;
- Fcb = (PMSFS_FCB)FileObject->FsContext;
- Ccb = (PMSFS_CCB)FileObject->FsContext2;
+ IoStack = IoGetCurrentIrpStackLocation (Irp);
+ FileObject = IoStack->FileObject;
+ Fcb = (PMSFS_FCB)FileObject->FsContext;
+ Ccb = (PMSFS_CCB)FileObject->FsContext2;
- DPRINT("MailslotName: %wZ\n", &Fcb->Name);
+ DPRINT("MailslotName: %wZ\n", &Fcb->Name);
- /* writing is not permitted on server side */
- if (Fcb->ServerCcb == Ccb)
- {
- Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
- Irp->IoStatus.Information = 0;
+ /* writing is not permitted on server side */
+ if (Fcb->ServerCcb == Ccb)
+ {
+ Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
+ Irp->IoStatus.Information = 0;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return(STATUS_ACCESS_DENIED);
- }
+ return STATUS_ACCESS_DENIED;
+ }
- Length = IoStack->Parameters.Write.Length;
- if (Irp->MdlAddress)
- Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
- else
- Buffer = Irp->UserBuffer;
+ Length = IoStack->Parameters.Write.Length;
+ if (Irp->MdlAddress)
+ Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
+ else
+ Buffer = Irp->UserBuffer;
- DPRINT("Length: %lu Message: %s\n", Length, (PUCHAR)Buffer);
+ DPRINT("Length: %lu Message: %s\n", Length, (PUCHAR)Buffer);
- /* Allocate new message */
- Message = ExAllocatePool(NonPagedPool,
- sizeof(MSFS_MESSAGE) + Length);
- if (Message == NULL)
- {
- Irp->IoStatus.Status = STATUS_NO_MEMORY;
- Irp->IoStatus.Information = 0;
+ /* Allocate new message */
+ Message = ExAllocatePool(NonPagedPool,
+ sizeof(MSFS_MESSAGE) + Length);
+ if (Message == NULL)
+ {
+ Irp->IoStatus.Status = STATUS_NO_MEMORY;
+ Irp->IoStatus.Information = 0;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return(STATUS_NO_MEMORY);
- }
+ return STATUS_NO_MEMORY;
+ }
- Message->Size = Length;
- memcpy(&Message->Buffer, Buffer, Length);
+ Message->Size = Length;
+ memcpy(&Message->Buffer, Buffer, Length);
- KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
- InsertTailList(&Fcb->MessageListHead, &Message->MessageListEntry);
- KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
+ KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
+ InsertTailList(&Fcb->MessageListHead, &Message->MessageListEntry);
+ KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
- Fcb->MessageCount++;
- if (Fcb->MessageCount == 1)
- {
- KeSetEvent(&Fcb->MessageEvent,
- 0,
- FALSE);
- }
+ Fcb->MessageCount++;
+ if (Fcb->MessageCount == 1)
+ {
+ KeSetEvent(&Fcb->MessageEvent,
+ 0,
+ FALSE);
+ }
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = Length;
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = Length;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return(STATUS_SUCCESS);
+ return STATUS_SUCCESS;
}
/* EOF */