FreeBSD/sys/contrib/dev/acpica/components/namespace/nsalloc.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiNsInstallNode
 *
 * PARAMETERS:  WalkState       - Current state of the walk
 *              ParentNode      - The parent of the new Node
 *              Node            - The new Node to install
 *              Type            - ACPI object type of the new Node
 *
 * RETURN:      None
 *
 * DESCRIPTION: Initialize a new namespace node and install it amongst
 *              its peers.
 *
 *              Note: Current namespace lookup is linear search. This appears
 *              to be sufficient as namespace searches consume only a small
 *              fraction of the execution time of the ACPI subsystem.
 *
 ******************************************************************************/
AcpiNsInstallNode
PARAMETERS:  WalkState       - Current state of the walk
ParentNode      - The parent of the new Node
Node            - The new Node to install
Type            - ACPI object type of the new Node

None

Initialize a new namespace node and install it amongst
its peers.

Current namespace lookup is linear search. This appears
to be sufficient as namespace searches consume only a small
fraction of the execution time of the ACPI subsystem.
AcpiNsInstallNode PARAMETERS : WalkState - Current state of the walk ParentNode - The parent of the new Node Node - The new Node to install Type - ACPI object type of the new Node None Initialize a new namespace node and install it amongst its peers . Current namespace lookup is linear search . This appears to be sufficient as namespace searches consume only a small fraction of the execution time of the ACPI subsystem .
void
AcpiNsInstallNode (
    ACPI_WALK_STATE         *WalkState,
    ACPI_NAMESPACE_NODE     *ParentNode,    
    ACPI_NAMESPACE_NODE     *Node,          
    ACPI_OBJECT_TYPE        Type)
{
    ACPI_OWNER_ID           OwnerId = 0;
    ACPI_NAMESPACE_NODE     *ChildNode;
    ACPI_FUNCTION_TRACE (NsInstallNode);
    if (WalkState)
    {
        OwnerId = WalkState->OwnerId;
        if ((WalkState->MethodDesc) &&
            (ParentNode != WalkState->MethodNode))
        {
            WalkState->MethodDesc->Method.InfoFlags |=
                ACPI_METHOD_MODIFIED_NAMESPACE;
        }
    }
    Node->Peer = NULL;
    Node->Parent = ParentNode;
    ChildNode = ParentNode->Child;
    if (!ChildNode)
    {
        ParentNode->Child = Node;
    }
    else
    {
        while (ChildNode->Peer)
        {
            ChildNode = ChildNode->Peer;
        }
        ChildNode->Peer = Node;
    }
    Node->OwnerId = OwnerId;
    Node->Type = (UINT8) Type;
    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
        "%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n",
        AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type), Node, OwnerId,
        AcpiUtGetNodeName (ParentNode), AcpiUtGetTypeName (ParentNode->Type),
        ParentNode));
    return_VOID;
}
void AcpiNsInstallNode ( ACPI_WALK_STATE * WalkState , ACPI_NAMESPACE_NODE * ParentNode , ACPI_NAMESPACE_NODE * Node , ACPI_OBJECT_TYPE Type ) { ACPI_OWNER_ID OwnerId = 0 ; ACPI_NAMESPACE_NODE * ChildNode ; ACPI_FUNCTION_TRACE ( NsInstallNode ) ; if ( WalkState ) { OwnerId = WalkState -> OwnerId ; if ( ( WalkState -> MethodDesc ) && ( ParentNode != WalkState -> MethodNode ) ) { WalkState -> MethodDesc -> Method . InfoFlags |= ACPI_METHOD_MODIFIED_NAMESPACE ; } } Node -> Peer = NULL ; Node -> Parent = ParentNode ; ChildNode = ParentNode -> Child ; if ( ! ChildNode ) { ParentNode -> Child = Node ; } else { while ( ChildNode -> Peer ) { ChildNode = ChildNode -> Peer ; } ChildNode -> Peer = Node ; } Node -> OwnerId = OwnerId ; Node -> Type = ( UINT8 ) Type ; ACPI_DEBUG_PRINT ( ( ACPI_DB_NAMES , " \n " , AcpiUtGetNodeName ( Node ) , AcpiUtGetTypeName ( Node -> Type ) , Node , OwnerId , AcpiUtGetNodeName ( ParentNode ) , AcpiUtGetTypeName ( ParentNode -> Type ) , ParentNode ) ) ; return_VOID ; }
FUNCTION:    AcpiNsInstallNode
 PARAMETERS:  WalkState       - Current state of the walk
              ParentNode      - The parent of the new Node
              Node            - The new Node to install
              Type            - ACPI object type of the new Node
FUNCTION : AcpiNsInstallNode PARAMETERS : WalkState - Current state of the walk ParentNode - The parent of the new Node Node - The new Node to install Type - ACPI object type of the new Node
/* Parent */ /* New Child*/ /*
         * Get the owner ID from the Walk state. The owner ID is used to
         * track table deletion and deletion of objects created by methods.
         */ /*
             * A method is creating a new node that is not a child of the
             * method (it is non-local). Mark the executing method as having
             * modified the namespace. This is used for cleanup when the
             * method exits.
             */ /* Link the new entry into the parent and existing children */ /* Add node to the end of the peer list */ /* Init the new entry */