Skip to content

Commit

Permalink
Rename nameseg copy macro for clarity
Browse files Browse the repository at this point in the history
ACPI_MOVE_NAME changed to ACPI_COPY_NAMESEG
This clarifies (1) this is a copy operation, and
(2) it operates on ACPI NameSegs.
Improves understanding of the code.
  • Loading branch information
acpibob committed Feb 22, 2019
1 parent 3132320 commit 19c18d3
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions source/common/dmrestag.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,13 +823,13 @@ AcpiGetTagPathname (
* disassembled code.
*/
PathnameEnd = Pathname + (RequiredSize - ACPI_NAME_SIZE - 1);
ACPI_MOVE_NAME (PathnameEnd, ResourceNode->Name.Ascii);
ACPI_COPY_NAMESEG (PathnameEnd, ResourceNode->Name.Ascii);

PathnameEnd += ACPI_NAME_SIZE;
*PathnameEnd = '.';

PathnameEnd++;
ACPI_MOVE_NAME (PathnameEnd, Tag);
ACPI_COPY_NAMESEG (PathnameEnd, Tag);

/* Internalize the namepath to AML format */

Expand Down
6 changes: 3 additions & 3 deletions source/compiler/aslcodegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,11 +556,11 @@ CgWriteTableHeader (
*/
if (AcpiGbl_CaptureComments)
{
ACPI_MOVE_NAME (AcpiGbl_TableSig, Child->Asl.Value.String);
ACPI_COPY_NAMESEG (AcpiGbl_TableSig, Child->Asl.Value.String);
Child->Asl.Value.String = ACPI_SIG_XXXX;
}

ACPI_MOVE_NAME (AslGbl_TableHeader.Signature, Child->Asl.Value.String);
ACPI_COPY_NAMESEG (AslGbl_TableHeader.Signature, Child->Asl.Value.String);

/* Revision */

Expand Down Expand Up @@ -593,7 +593,7 @@ CgWriteTableHeader (

/* Compiler ID */

ACPI_MOVE_NAME (AslGbl_TableHeader.AslCompilerId, ASL_CREATOR_ID);
ACPI_COPY_NAMESEG (AslGbl_TableHeader.AslCompilerId, ASL_CREATOR_ID);

/* Compiler version */

Expand Down
2 changes: 1 addition & 1 deletion source/compiler/aslutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ UtAttachNameseg (
UtPadNameWithUnderscores (Name, PaddedNameSeg);
}

ACPI_MOVE_NAME (Op->Asl.NameSeg, PaddedNameSeg);
ACPI_COPY_NAMESEG (Op->Asl.NameSeg, PaddedNameSeg);
}


Expand Down
2 changes: 1 addition & 1 deletion source/components/namespace/nsnames.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ AcpiNsHandleToName (
/* Just copy the ACPI name from the Node and zero terminate it */

NodeName = AcpiUtGetNodeName (Node);
ACPI_MOVE_NAME (Buffer->Pointer, NodeName);
ACPI_COPY_NAMESEG (Buffer->Pointer, NodeName);
((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0;

ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%4.4s\n", (char *) Buffer->Pointer));
Expand Down
2 changes: 1 addition & 1 deletion source/components/namespace/nsutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ AcpiNsExternalizeName (

/* Copy and validate the 4-char name segment */

ACPI_MOVE_NAME (&(*ConvertedName)[j],
ACPI_COPY_NAMESEG (&(*ConvertedName)[j],
&InternalName[NamesIndex]);
AcpiUtRepairName (&(*ConvertedName)[j]);

Expand Down
2 changes: 1 addition & 1 deletion source/components/tables/tbfind.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ AcpiTbFindTable (
/* Normalize the input strings */

memset (&Header, 0, sizeof (ACPI_TABLE_HEADER));
ACPI_MOVE_NAME (Header.Signature, Signature);
ACPI_COPY_NAMESEG (Header.Signature, Signature);
strncpy (Header.OemId, OemId, ACPI_OEM_ID_SIZE);
strncpy (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE);

Expand Down
2 changes: 1 addition & 1 deletion source/components/utilities/utstring.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ AcpiUtRepairName (
return;
}

ACPI_MOVE_NAME (&OriginalName, Name);
ACPI_COPY_NAMESEG (&OriginalName, Name);

/* Check each character in the name */

Expand Down
4 changes: 2 additions & 2 deletions source/include/actypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,10 @@ typedef UINT64 ACPI_INTEGER;

#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b)))
#define ACPI_MOVE_NAME(dest,src) (*ACPI_CAST_PTR (UINT32, (dest)) = *ACPI_CAST_PTR (UINT32, (src)))
#define ACPI_COPY_NAMESEG(dest,src) (*ACPI_CAST_PTR (UINT32, (dest)) = *ACPI_CAST_PTR (UINT32, (src)))
#else
#define ACPI_COMPARE_NAME(a,b) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
#define ACPI_MOVE_NAME(dest,src) (strncpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
#define ACPI_COPY_NAMESEG(dest,src) (strncpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
#endif

/* Support for the special RSDP signature (8 characters) */
Expand Down
2 changes: 1 addition & 1 deletion source/os_specific/efi/osefitbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ OslAddTableToList (
return (AE_NO_MEMORY);
}

ACPI_MOVE_NAME (NewInfo->Signature, Signature);
ACPI_COPY_NAMESEG (NewInfo->Signature, Signature);

if (!Gbl_TableListHead)
{
Expand Down
8 changes: 4 additions & 4 deletions source/os_specific/service_layers/osbsdtbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,18 +862,18 @@ OslAddTablesToList(

case 1:

ACPI_MOVE_NAME (NewInfo->Signature,
ACPI_COPY_NAMESEG (NewInfo->Signature,
Gbl_Revision ? ACPI_SIG_XSDT : ACPI_SIG_RSDT);
break;

case 2:

ACPI_MOVE_NAME (NewInfo->Signature, ACPI_SIG_FACS);
ACPI_COPY_NAMESEG (NewInfo->Signature, ACPI_SIG_FACS);
break;

default:

ACPI_MOVE_NAME (NewInfo->Signature, ACPI_SIG_DSDT);
ACPI_COPY_NAMESEG (NewInfo->Signature, ACPI_SIG_DSDT);

}

Expand Down Expand Up @@ -932,7 +932,7 @@ OslAddTablesToList(
return (AE_NO_MEMORY);
}

ACPI_MOVE_NAME (NewInfo->Signature, Table->Signature);
ACPI_COPY_NAMESEG (NewInfo->Signature, Table->Signature);

AcpiOsUnmapMemory (Table, sizeof (*Table));

Expand Down
4 changes: 2 additions & 2 deletions source/os_specific/service_layers/oslinuxtbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ OslAddTableToList (
return (AE_NO_MEMORY);
}

ACPI_MOVE_NAME (NewInfo->Signature, Signature);
ACPI_COPY_NAMESEG (NewInfo->Signature, Signature);

if (!Gbl_TableListHead)
{
Expand Down Expand Up @@ -1479,7 +1479,7 @@ OslTableNameFromFile (

/* Extract signature */

ACPI_MOVE_NAME (Signature, Filename);
ACPI_COPY_NAMESEG (Signature, Filename);
return (AE_OK);
}

Expand Down
4 changes: 2 additions & 2 deletions source/tools/acpidump/apfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,11 @@ ApWriteToBinaryFile (

if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
{
ACPI_MOVE_NAME (Filename, ACPI_RSDP_NAME);
ACPI_COPY_NAMESEG (Filename, ACPI_RSDP_NAME);
}
else
{
ACPI_MOVE_NAME (Filename, Table->Signature);
ACPI_COPY_NAMESEG (Filename, Table->Signature);
}

Filename[0] = (char) tolower ((int) Filename[0]);
Expand Down
10 changes: 5 additions & 5 deletions source/tools/acpiexec/aetables.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,13 @@ AeInitializeTableHeader (
UINT32 Length)
{

ACPI_MOVE_NAME (Header->Signature, Signature);
ACPI_COPY_NAMESEG (Header->Signature, Signature);
Header->Length = Length;

Header->OemRevision = 0x1001;
memcpy (Header->OemId, "Intel ", ACPI_OEM_ID_SIZE);
memcpy (Header->OemTableId, "AcpiExec", ACPI_OEM_TABLE_ID_SIZE);
ACPI_MOVE_NAME (Header->AslCompilerId, "INTL");
ACPI_COPY_NAMESEG (Header->AslCompilerId, "INTL");
Header->AslCompilerRevision = ACPI_CA_VERSION;

/* Set the checksum, must set to zero first */
Expand Down Expand Up @@ -531,7 +531,7 @@ AeBuildLocalTables (
/* Build a FACS */

memset (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS));
ACPI_MOVE_NAME (LocalFACS.Signature, ACPI_SIG_FACS);
ACPI_COPY_NAMESEG (LocalFACS.Signature, ACPI_SIG_FACS);

LocalFACS.Length = sizeof (ACPI_TABLE_FACS);
LocalFACS.GlobalLock = 0x11AA0011;
Expand All @@ -545,7 +545,7 @@ AeBuildLocalTables (
* ACPICA core ignores it
*/
memset (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER));
ACPI_MOVE_NAME (LocalTEST.Signature, "TEST");
ACPI_COPY_NAMESEG (LocalTEST.Signature, "TEST");

LocalTEST.Revision = 1;
LocalTEST.Length = sizeof (ACPI_TABLE_HEADER);
Expand All @@ -559,7 +559,7 @@ AeBuildLocalTables (
* sure that the ACPICA core ignores it
*/
memset (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER));
ACPI_MOVE_NAME (LocalBADTABLE.Signature, "BAD!");
ACPI_COPY_NAMESEG (LocalBADTABLE.Signature, "BAD!");

LocalBADTABLE.Revision = 1;
LocalBADTABLE.Length = sizeof (ACPI_TABLE_HEADER);
Expand Down
6 changes: 3 additions & 3 deletions source/tools/acpinames/antables.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,13 @@ AnInitializeTableHeader (
UINT32 Length)
{

ACPI_MOVE_NAME (Header->Signature, Signature);
ACPI_COPY_NAMESEG (Header->Signature, Signature);
Header->Length = Length;

Header->OemRevision = 0x1001;
memcpy (Header->OemId, "Intel ", ACPI_OEM_ID_SIZE);
memcpy (Header->OemTableId, "AcpiExec", ACPI_OEM_TABLE_ID_SIZE);
ACPI_MOVE_NAME (Header->AslCompilerId, "INTL");
ACPI_COPY_NAMESEG (Header->AslCompilerId, "INTL");
Header->AslCompilerRevision = ACPI_CA_VERSION;

/* Set the checksum, must set to zero first */
Expand Down Expand Up @@ -434,7 +434,7 @@ AnBuildLocalTables (
/* Build a FACS */

memset (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS));
ACPI_MOVE_NAME (LocalFACS.Signature, ACPI_SIG_FACS);
ACPI_COPY_NAMESEG (LocalFACS.Signature, ACPI_SIG_FACS);

LocalFACS.Length = sizeof (ACPI_TABLE_FACS);
LocalFACS.GlobalLock = 0x11AA0011;
Expand Down
4 changes: 2 additions & 2 deletions source/tools/acpixtract/acpixtract.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ AxExtractTables (
continue;
}

ACPI_MOVE_NAME (ThisSignature, Gbl_LineBuffer);
ACPI_COPY_NAMESEG (ThisSignature, Gbl_LineBuffer);
if (Signature)
{
/* Ignore signatures that don't match */
Expand Down Expand Up @@ -466,7 +466,7 @@ AxExtractToMultiAmlFile (
continue;
}

ACPI_MOVE_NAME (ThisSignature, Gbl_LineBuffer);
ACPI_COPY_NAMESEG (ThisSignature, Gbl_LineBuffer);

/* Only want DSDT and SSDTs */

Expand Down

0 comments on commit 19c18d3

Please sign in to comment.