u8 acpi_ut_safe_strncat(char *dest, acpi_size dest_size, char *source, acpi_size max_transfer_length) { acpi_size actual_transfer_length; actual_transfer_length = ACPI_MIN(max_transfer_length, ACPI_STRLEN(source)); if ((ACPI_STRLEN(dest) + actual_transfer_length) >= dest_size) { return (TRUE); } ACPI_STRNCAT(dest, source, max_transfer_length); return (FALSE); }
BOOLEAN AcpiUtSafeStrncat ( char *Dest, ACPI_SIZE DestSize, char *Source, ACPI_SIZE MaxTransferLength) { ACPI_SIZE ActualTransferLength; ActualTransferLength = ACPI_MIN (MaxTransferLength, ACPI_STRLEN (Source)); if ((ACPI_STRLEN (Dest) + ActualTransferLength) >= DestSize) { return (TRUE); } ACPI_STRNCAT (Dest, Source, MaxTransferLength); return (FALSE); }
static char * AcpiGetTagPathname ( ACPI_NAMESPACE_NODE *BufferNode, ACPI_NAMESPACE_NODE *ResourceNode, UINT32 BitIndex) { ACPI_STATUS Status; UINT32 ResourceBitIndex; UINT8 ResourceTableIndex; ACPI_SIZE RequiredSize; char *Pathname; AML_RESOURCE *Aml; ACPI_PARSE_OBJECT *Op; char *InternalPath; char *Tag; /* Get the Op that contains the actual buffer data */ Op = BufferNode->Op->Common.Value.Arg; Op = Op->Common.Next; if (!Op) { return (NULL); } /* Get the individual resource descriptor and validate it */ Aml = ACPI_CAST_PTR (AML_RESOURCE, &Op->Named.Data[ResourceNode->Value]); Status = AcpiUtValidateResource (Aml, &ResourceTableIndex); if (ACPI_FAILURE (Status)) { return (NULL); } /* Get offset into this descriptor (from offset into entire buffer) */ ResourceBitIndex = BitIndex - ACPI_MUL_8 (ResourceNode->Value); /* Get the tag associated with this resource descriptor and offset */ Tag = AcpiDmGetResourceTag (ResourceBitIndex, Aml, ResourceTableIndex); if (!Tag) { return (NULL); } /* * Now that we know that we have a reference that can be converted to a * symbol, change the name of the resource to a unique name. */ AcpiDmUpdateResourceName (ResourceNode); /* Get the full pathname to the parent buffer */ RequiredSize = AcpiNsGetPathnameLength (BufferNode); if (!RequiredSize) { return (NULL); } Pathname = ACPI_ALLOCATE_ZEROED (RequiredSize + ACPI_PATH_SEGMENT_LENGTH); if (!Pathname) { return (NULL); } Status = AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname); if (ACPI_FAILURE (Status)) { return (NULL); } /* * Create the full path to the resource and tag by: remove the buffer name, * append the resource descriptor name, append a dot, append the tag name. * * TBD: Always using the full path is a bit brute force, the path can be * often be optimized with carats (if the original buffer namepath is a * single nameseg). This doesn't really matter, because these paths do not * end up in the final compiled AML, it's just an appearance issue for the * disassembled code. */ Pathname[ACPI_STRLEN (Pathname) - ACPI_NAME_SIZE] = 0; ACPI_STRNCAT (Pathname, ResourceNode->Name.Ascii, ACPI_NAME_SIZE); ACPI_STRCAT (Pathname, "."); ACPI_STRNCAT (Pathname, Tag, ACPI_NAME_SIZE); /* Internalize the namepath to AML format */ AcpiNsInternalizeName (Pathname, &InternalPath); ACPI_FREE (Pathname); return (InternalPath); }