deps/acpica/source/components/namespace/nsobject.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiNsAttachData
 *
 * PARAMETERS:  Node            - Namespace node
 *              Handler         - Handler to be associated with the data
 *              Data            - Data to be attached
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Low-level attach data. Create and attach a Data object.
 *
 ******************************************************************************/
AcpiNsAttachData
PARAMETERS:  Node            - Namespace node
Handler         - Handler to be associated with the data
Data            - Data to be attached

Status

Low-level attach data. Create and attach a Data object.
AcpiNsAttachData PARAMETERS : Node - Namespace node Handler - Handler to be associated with the data Data - Data to be attached Status Low - level attach data . Create and attach a Data object .
ACPI_STATUS
AcpiNsAttachData (
    ACPI_NAMESPACE_NODE     *Node,
    ACPI_OBJECT_HANDLER     Handler,
    void                    *Data)
{
    ACPI_OPERAND_OBJECT     *PrevObjDesc;
    ACPI_OPERAND_OBJECT     *ObjDesc;
    ACPI_OPERAND_OBJECT     *DataDesc;
    PrevObjDesc = NULL;
    ObjDesc = Node->Object;
    while (ObjDesc)
    {
        if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
            (ObjDesc->Data.Handler == Handler))
        {
            return (AE_ALREADY_EXISTS);
        }
        PrevObjDesc = ObjDesc;
        ObjDesc = ObjDesc->Common.NextObject;
    }
    DataDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_DATA);
    if (!DataDesc)
    {
        return (AE_NO_MEMORY);
    }
    DataDesc->Data.Handler = Handler;
    DataDesc->Data.Pointer = Data;
    if (PrevObjDesc)
    {
        PrevObjDesc->Common.NextObject = DataDesc;
    }
    else
    {
        Node->Object = DataDesc;
    }
    return (AE_OK);
}
ACPI_STATUS AcpiNsAttachData ( ACPI_NAMESPACE_NODE * Node , ACPI_OBJECT_HANDLER Handler , void * Data ) { ACPI_OPERAND_OBJECT * PrevObjDesc ; ACPI_OPERAND_OBJECT * ObjDesc ; ACPI_OPERAND_OBJECT * DataDesc ; PrevObjDesc = NULL ; ObjDesc = Node -> Object ; while ( ObjDesc ) { if ( ( ObjDesc -> Common . Type == ACPI_TYPE_LOCAL_DATA ) && ( ObjDesc -> Data . Handler == Handler ) ) { return ( AE_ALREADY_EXISTS ) ; } PrevObjDesc = ObjDesc ; ObjDesc = ObjDesc -> Common . NextObject ; } DataDesc = AcpiUtCreateInternalObject ( ACPI_TYPE_LOCAL_DATA ) ; if ( ! DataDesc ) { return ( AE_NO_MEMORY ) ; } DataDesc -> Data . Handler = Handler ; DataDesc -> Data . Pointer = Data ; if ( PrevObjDesc ) { PrevObjDesc -> Common . NextObject = DataDesc ; } else { Node -> Object = DataDesc ; } return ( AE_OK ) ; }
FUNCTION:    AcpiNsAttachData
 PARAMETERS:  Node            - Namespace node
              Handler         - Handler to be associated with the data
              Data            - Data to be attached
FUNCTION : AcpiNsAttachData PARAMETERS : Node - Namespace node Handler - Handler to be associated with the data Data - Data to be attached
/* We only allow one attachment per handler */ /* Create an internal object for the data */ /* Install the data object */