Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
   1 /*******************************************************************************
   2  *
   3  * Module Name: nsnames - Name manipulation and search
   4  *
   5  ******************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2011, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.


 206     ACPI_NAMESPACE_NODE     *NextNode;
 207 
 208 
 209     ACPI_FUNCTION_ENTRY ();
 210 
 211 
 212     /*
 213      * Compute length of pathname as 5 * number of name segments.
 214      * Go back up the parent tree to the root
 215      */
 216     Size = 0;
 217     NextNode = Node;
 218 
 219     while (NextNode && (NextNode != AcpiGbl_RootNode))
 220     {
 221         if (ACPI_GET_DESCRIPTOR_TYPE (NextNode) != ACPI_DESC_TYPE_NAMED)
 222         {
 223             ACPI_ERROR ((AE_INFO,
 224                 "Invalid Namespace Node (%p) while traversing namespace",
 225                 NextNode));
 226             return 0;
 227         }
 228         Size += ACPI_PATH_SEGMENT_LENGTH;
 229         NextNode = NextNode->Parent;
 230     }
 231 
 232     if (!Size)
 233     {
 234         Size = 1; /* Root node case */
 235     }
 236 
 237     return (Size + 1);  /* +1 for null string terminator */
 238 }
 239 
 240 
 241 /*******************************************************************************
 242  *
 243  * FUNCTION:    AcpiNsHandleToPathname
 244  *
 245  * PARAMETERS:  TargetHandle            - Handle of named object whose name is
 246  *                                        to be found


 282     /* Validate/Allocate/Clear caller buffer */
 283 
 284     Status = AcpiUtInitializeBuffer (Buffer, RequiredSize);
 285     if (ACPI_FAILURE (Status))
 286     {
 287         return_ACPI_STATUS (Status);
 288     }
 289 
 290     /* Build the path in the caller buffer */
 291 
 292     Status = AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer);
 293     if (ACPI_FAILURE (Status))
 294     {
 295         return_ACPI_STATUS (Status);
 296     }
 297 
 298     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X]\n",
 299         (char *) Buffer->Pointer, (UINT32) RequiredSize));
 300     return_ACPI_STATUS (AE_OK);
 301 }
 302 
 303 
   1 /*******************************************************************************
   2  *
   3  * Module Name: nsnames - Name manipulation and search
   4  *
   5  ******************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2014, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.


 206     ACPI_NAMESPACE_NODE     *NextNode;
 207 
 208 
 209     ACPI_FUNCTION_ENTRY ();
 210 
 211 
 212     /*
 213      * Compute length of pathname as 5 * number of name segments.
 214      * Go back up the parent tree to the root
 215      */
 216     Size = 0;
 217     NextNode = Node;
 218 
 219     while (NextNode && (NextNode != AcpiGbl_RootNode))
 220     {
 221         if (ACPI_GET_DESCRIPTOR_TYPE (NextNode) != ACPI_DESC_TYPE_NAMED)
 222         {
 223             ACPI_ERROR ((AE_INFO,
 224                 "Invalid Namespace Node (%p) while traversing namespace",
 225                 NextNode));
 226             return (0);
 227         }
 228         Size += ACPI_PATH_SEGMENT_LENGTH;
 229         NextNode = NextNode->Parent;
 230     }
 231 
 232     if (!Size)
 233     {
 234         Size = 1; /* Root node case */
 235     }
 236 
 237     return (Size + 1);  /* +1 for null string terminator */
 238 }
 239 
 240 
 241 /*******************************************************************************
 242  *
 243  * FUNCTION:    AcpiNsHandleToPathname
 244  *
 245  * PARAMETERS:  TargetHandle            - Handle of named object whose name is
 246  *                                        to be found


 282     /* Validate/Allocate/Clear caller buffer */
 283 
 284     Status = AcpiUtInitializeBuffer (Buffer, RequiredSize);
 285     if (ACPI_FAILURE (Status))
 286     {
 287         return_ACPI_STATUS (Status);
 288     }
 289 
 290     /* Build the path in the caller buffer */
 291 
 292     Status = AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer);
 293     if (ACPI_FAILURE (Status))
 294     {
 295         return_ACPI_STATUS (Status);
 296     }
 297 
 298     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X]\n",
 299         (char *) Buffer->Pointer, (UINT32) RequiredSize));
 300     return_ACPI_STATUS (AE_OK);
 301 }