/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL - See COPYING in the top level directory
- * FILE: ntoskrnl/ob/namespce.c
+ * FILE: ntoskrnl/ob/obname.c
* PURPOSE: Manages all functions related to the Object Manager name-
* space, such as finding objects or querying their names.
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
#include <debug.h>
BOOLEAN ObpCaseInsensitive = TRUE;
-POBJECT_DIRECTORY NameSpaceRoot;
+POBJECT_DIRECTORY ObpRootDirectoryObject;
POBJECT_DIRECTORY ObpTypeDirectoryObject;
/* DOS Device Prefix \??\ and \?? */
/* FIXME: Hack Hack! */
ObSystemDeviceMap = ExAllocatePoolWithTag(NonPagedPool,
sizeof(*ObSystemDeviceMap),
- TAG('O', 'b', 'D', 'm'));
+ 'mDbO');
+ if (!ObSystemDeviceMap) return STATUS_INSUFFICIENT_RESOURCES;
RtlZeroMemory(ObSystemDeviceMap, sizeof(*ObSystemDeviceMap));
/* Return status */
/* Get object structures */
ObjectHeader = OBJECT_TO_OBJECT_HEADER(Object);
- ObjectNameInfo = ObpAcquireNameInformation(ObjectHeader);
+ ObjectNameInfo = ObpReferenceNameInfo(ObjectHeader);
ObjectType = ObjectHeader->Type;
/*
!(ObjectHeader->Flags & OB_FLAG_PERMANENT))
{
/* Setup a lookup context */
- ObpInitializeDirectoryLookup(&Context);
+ ObpInitializeLookupContext(&Context);
/* Lock the directory */
ObpAcquireDirectoryLockExclusive(ObjectNameInfo->Directory, &Context);
&Context);
if (Object)
{
- /* Lock the object type */
- ObpEnterObjectTypeMutex(ObjectType);
+ /* Lock the object */
+ ObpAcquireObjectLock(ObjectHeader);
/* Make sure we can still delete the object */
if (!(ObjectHeader->HandleCount) &&
}
/* Release the lock */
- ObpLeaveObjectTypeMutex(ObjectType);
+ ObpReleaseObjectLock(ObjectHeader);
}
/* Cleanup after lookup */
- ObpCleanupDirectoryLookup(&Context);
+ ObpReleaseLookupContext(&Context);
/* Remove another query reference since we added one on top */
- ObpReleaseNameInformation(ObjectNameInfo);
+ ObpDereferenceNameInfo(ObjectNameInfo);
/* Check if we were inserted in a directory */
if (Directory)
{
/* We were, so first remove the extra reference we had added */
- ObpReleaseNameInformation(ObjectNameInfo);
+ ObpDereferenceNameInfo(ObjectNameInfo);
/* Now dereference the object as well */
ObDereferenceObject(Object);
else
{
/* Remove the reference we added */
- ObpReleaseNameInformation(ObjectNameInfo);
+ ObpDereferenceNameInfo(ObjectNameInfo);
}
}
POBJECT_HEADER ObjectHeader;
UNICODE_STRING ComponentName, RemainingName;
BOOLEAN Reparse = FALSE, SymLink = FALSE;
- PDEVICE_MAP DeviceMap = NULL;
POBJECT_DIRECTORY Directory = NULL, ParentDirectory = NULL, RootDirectory;
POBJECT_DIRECTORY ReferencedDirectory = NULL, ReferencedParentDirectory = NULL;
KIRQL CalloutIrql;
InsertObject);
/* Initialize starting state */
- ObpInitializeDirectoryLookup(LookupContext);
+ ObpInitializeLookupContext(LookupContext);
*FoundObject = NULL;
Status = STATUS_SUCCESS;
Object = NULL;
{
/* Reparsed to the root directory, so start over */
ObDereferenceObject(RootDirectory);
- RootDirectory = NameSpaceRoot;
+ RootDirectory = ObpRootDirectoryObject;
/* Don't use this anymore, since we're starting at root */
RootHandle = NULL;
else
{
/* We did not get a Root Directory, so use the root */
- RootDirectory = NameSpaceRoot;
+ RootDirectory = ObpRootDirectoryObject;
/* It must start with a path separator */
if (!(ObjectName->Length) ||
else
{
ParseFromRoot:
- /* Check if we have a device map */
- if (DeviceMap)
- {
- /* Dereference it */
- //ObfDereferenceDeviceMap(DeviceMap);
- DeviceMap = NULL;
- }
+ /* FIXME: Check if we have a device map */
/* Check if this is a possible DOS name */
if (!((ULONG_PTR)(ObjectName->Buffer) & 7))
if (ObjectNameInfo->Name.Buffer)
{
/* Free it */
- ExFreePool(ObjectNameInfo->Name.Buffer);
+ ExFreePoolWithTag(ObjectNameInfo->Name.Buffer, OB_NAME_TAG );
}
/* Write new one */
InterlockedExchangeAdd(&ObjectHeader->PointerCount, 1);
/* Cleanup from the first lookup */
- ObpCleanupDirectoryLookup(LookupContext);
+ ObpReleaseLookupContext(LookupContext);
/* Check if we have a referenced directory */
if (ReferencedDirectory)
/* Start at Root */
ParentDirectory = NULL;
- RootDirectory = NameSpaceRoot;
+ RootDirectory = ObpRootDirectoryObject;
/* Check for reparse status */
if (Status == STATUS_REPARSE_OBJECT)
goto ParseFromRoot;
}
}
- else if (RootDirectory == NameSpaceRoot)
+ else if (RootDirectory == ObpRootDirectoryObject)
{
/* We got STATUS_REPARSE but are at the Root Directory */
Object = NULL;
if (!NT_SUCCESS(Status))
{
/* Cleanup after lookup */
- ObpCleanupDirectoryLookup(LookupContext);
+ ObpReleaseLookupContext(LookupContext);
}
/* Check if we have a device map and dereference it if so */
* enough right at the beginning, not work our way through
* and find out at the end
*/
- if (Object == NameSpaceRoot)
+ if (Object == ObpRootDirectoryObject)
{
/* Size of the '\' string */
NameSize = sizeof(OBJ_NAME_PATH_SEPARATOR);
NameSize = sizeof(OBJ_NAME_PATH_SEPARATOR) + LocalInfo->Name.Length;
/* Loop inside the directory to get the top-most one (meaning root) */
- while ((ParentDirectory != NameSpaceRoot) && (ParentDirectory))
+ while ((ParentDirectory != ObpRootDirectoryObject) && (ParentDirectory))
{
/* Get the Name Information */
LocalInfo = OBJECT_HEADER_TO_NAME_INFO(
*--ObjectName = UNICODE_NULL;
/* Check if the object is actually the Root directory */
- if (Object == NameSpaceRoot)
+ if (Object == ObpRootDirectoryObject)
{
/* This is already the Root Directory, return "\\" */
*--ObjectName = OBJ_NAME_PATH_SEPARATOR;
/* Now parse the Parent directories until we reach the top */
ParentDirectory = LocalInfo->Directory;
- while ((ParentDirectory != NameSpaceRoot) && (ParentDirectory))
+ while ((ParentDirectory != ObpRootDirectoryObject) && (ParentDirectory))
{
/* Get the name information */
LocalInfo = OBJECT_HEADER_TO_NAME_INFO(