nsnames.c (71867) | nsnames.c (73561) |
---|---|
1/******************************************************************************* 2 * 3 * Module Name: nsnames - Name manipulation and search | 1/******************************************************************************* 2 * 3 * Module Name: nsnames - Name manipulation and search |
4 * $Revision: 53 $ | 4 * $Revision: 54 $ |
5 * 6 ******************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. --- 201 unchanged lines hidden (view full) --- 214 } 215 216 return_PTR (NameBuffer); 217} 218 219 220/******************************************************************************* 221 * | 5 * 6 ******************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. --- 201 unchanged lines hidden (view full) --- 214 } 215 216 return_PTR (NameBuffer); 217} 218 219 220/******************************************************************************* 221 * |
222 * FUNCTION: AcpiNsGetPathnameLength 223 * 224 * PARAMETERS: Node - Namespace node 225 * 226 * RETURN: Length of path, including prefix 227 * 228 * DESCRIPTION: Get the length of the pathname string for this node 229 * 230 ******************************************************************************/ 231 232UINT32 233AcpiNsGetPathnameLength ( 234 ACPI_NAMESPACE_NODE *Node) 235{ 236 UINT32 Size; 237 ACPI_NAMESPACE_NODE *NextNode; 238 239 /* 240 * Compute length of pathname as 5 * number of name segments. 241 * Go back up the parent tree to the root 242 */ 243 for (Size = 0, NextNode = Node; 244 AcpiNsGetParentObject (NextNode); 245 NextNode = AcpiNsGetParentObject (NextNode)) 246 { 247 Size += PATH_SEGMENT_LENGTH; 248 } 249 250 /* Special case for size still 0 - no parent for "special" nodes */ 251 252 if (!Size) 253 { 254 Size = PATH_SEGMENT_LENGTH; 255 } 256 257 return (Size + 1); 258} 259 260 261 262/******************************************************************************* 263 * |
|
222 * FUNCTION: AcpiNsHandleToPathname 223 * 224 * PARAMETERS: TargetHandle - Handle of named object whose name is 225 * to be found 226 * BufSize - Size of the buffer provided 227 * UserBuffer - Where the pathname is returned 228 * 229 * RETURN: Status, Buffer is filled with pathname if status is AE_OK --- 7 unchanged lines hidden (view full) --- 237ACPI_STATUS 238AcpiNsHandleToPathname ( 239 ACPI_HANDLE TargetHandle, 240 UINT32 *BufSize, 241 NATIVE_CHAR *UserBuffer) 242{ 243 ACPI_STATUS Status = AE_OK; 244 ACPI_NAMESPACE_NODE *Node; | 264 * FUNCTION: AcpiNsHandleToPathname 265 * 266 * PARAMETERS: TargetHandle - Handle of named object whose name is 267 * to be found 268 * BufSize - Size of the buffer provided 269 * UserBuffer - Where the pathname is returned 270 * 271 * RETURN: Status, Buffer is filled with pathname if status is AE_OK --- 7 unchanged lines hidden (view full) --- 279ACPI_STATUS 280AcpiNsHandleToPathname ( 281 ACPI_HANDLE TargetHandle, 282 UINT32 *BufSize, 283 NATIVE_CHAR *UserBuffer) 284{ 285 ACPI_STATUS Status = AE_OK; 286 ACPI_NAMESPACE_NODE *Node; |
245 ACPI_NAMESPACE_NODE *NextNode; | |
246 UINT32 PathLength; | 287 UINT32 PathLength; |
247 UINT32 Size; | |
248 UINT32 UserBufSize; 249 ACPI_NAME Name; | 288 UINT32 UserBufSize; 289 ACPI_NAME Name; |
290 UINT32 Size; |
|
250 251 FUNCTION_TRACE_PTR ("NsHandleToPathname", TargetHandle); 252 253 254 if (!AcpiGbl_RootNode || !TargetHandle) 255 { 256 /* 257 * If the name space has not been initialized, --- 4 unchanged lines hidden (view full) --- 262 } 263 264 Node = AcpiNsConvertHandleToEntry (TargetHandle); 265 if (!Node) 266 { 267 return_ACPI_STATUS (AE_BAD_PARAMETER); 268 } 269 | 291 292 FUNCTION_TRACE_PTR ("NsHandleToPathname", TargetHandle); 293 294 295 if (!AcpiGbl_RootNode || !TargetHandle) 296 { 297 /* 298 * If the name space has not been initialized, --- 4 unchanged lines hidden (view full) --- 303 } 304 305 Node = AcpiNsConvertHandleToEntry (TargetHandle); 306 if (!Node) 307 { 308 return_ACPI_STATUS (AE_BAD_PARAMETER); 309 } 310 |
270 /* 271 * Compute length of pathname as 5 * number of name segments. 272 * Go back up the parent tree to the root 273 */ 274 for (Size = 0, NextNode = Node; 275 AcpiNsGetParentObject (NextNode); 276 NextNode = AcpiNsGetParentObject (NextNode)) 277 { 278 Size += PATH_SEGMENT_LENGTH; 279 } | |
280 | 311 |
281 /* Special case for size still 0 - no parent for "special" nodes */ 282 283 if (!Size) 284 { 285 Size = PATH_SEGMENT_LENGTH; 286 } 287 | |
288 /* Set return length to the required path length */ 289 | 312 /* Set return length to the required path length */ 313 |
290 PathLength = Size + 1; | 314 PathLength = AcpiNsGetPathnameLength (Node); 315 Size = PathLength - 1; 316 |
291 UserBufSize = *BufSize; 292 *BufSize = PathLength; 293 294 /* Check if the user buffer is sufficiently large */ 295 296 if (PathLength > UserBufSize) 297 { 298 Status = AE_BUFFER_OVERFLOW; --- 43 unchanged lines hidden --- | 317 UserBufSize = *BufSize; 318 *BufSize = PathLength; 319 320 /* Check if the user buffer is sufficiently large */ 321 322 if (PathLength > UserBufSize) 323 { 324 Status = AE_BUFFER_OVERFLOW; --- 43 unchanged lines hidden --- |