本文整理汇总了C++中ACPI_STRNCPY函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_STRNCPY函数的具体用法?C++ ACPI_STRNCPY怎么用?C++ ACPI_STRNCPY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_STRNCPY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AeInitializeTableHeader
static void
AeInitializeTableHeader (
ACPI_TABLE_HEADER *Header,
char *Signature,
UINT32 Length)
{
ACPI_MOVE_NAME (Header->Signature, Signature);
Header->Length = Length;
Header->OemRevision = 0x1001;
ACPI_STRNCPY (Header->OemId, "Intel", ACPI_OEM_ID_SIZE);
ACPI_STRNCPY (Header->OemTableId, "AcpiExec", ACPI_OEM_TABLE_ID_SIZE);
ACPI_STRNCPY (Header->AslCompilerId, "INTL", ACPI_NAME_SIZE);
Header->AslCompilerRevision = 0x20131218;
}
示例2: acpi_get_name
/******************************************************************************
*
* FUNCTION: acpi_get_name
*
* PARAMETERS: Handle - Handle to be converted to a pathname
* name_type - Full pathname or single segment
* Buffer - Buffer for returned path
*
* RETURN: Pointer to a string containing the fully qualified Name.
*
* DESCRIPTION: This routine returns the fully qualified name associated with
* the Handle parameter. This and the acpi_pathname_to_handle are
* complementary functions.
*
******************************************************************************/
acpi_status
acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
{
acpi_status status;
struct acpi_namespace_node *node;
/* Parameter validation */
if (name_type > ACPI_NAME_TYPE_MAX) {
return (AE_BAD_PARAMETER);
}
status = acpi_ut_validate_buffer(buffer);
if (ACPI_FAILURE(status)) {
return (status);
}
if (name_type == ACPI_FULL_PATHNAME) {
/* Get the full pathname (From the namespace root) */
status = acpi_ns_handle_to_pathname(handle, buffer);
return (status);
}
/*
* Wants the single segment ACPI name.
* Validate handle and convert to a namespace Node
*/
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return (status);
}
node = acpi_ns_map_handle_to_node(handle);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
/* Validate/Allocate/Clear caller buffer */
status = acpi_ut_initialize_buffer(buffer, ACPI_PATH_SEGMENT_LENGTH);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
/* Just copy the ACPI name from the Node and zero terminate it */
ACPI_STRNCPY(buffer->pointer, acpi_ut_get_node_name(node),
ACPI_NAME_SIZE);
((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0;
status = AE_OK;
unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (status);
}
示例3: AcpiOsActualTableOverride
ACPI_STATUS
AcpiOsActualTableOverride (
ACPI_TABLE_HEADER *ExistingTable,
ACPI_TABLE_HEADER **NewTable)
{
#ifndef ACPI_EXEC_APP
char TableName[ACPI_NAME_SIZE + 1];
#endif
if (!ExistingTable || !NewTable)
{
return (AE_BAD_PARAMETER);
}
*NewTable = NULL;
#ifdef ACPI_EXEC_APP
/* This code exercises the table override mechanism in the core */
#ifdef OBSOLETE_CODE
if (ACPI_COMPARE_NAME (ExistingTable->Signature, ACPI_SIG_DSDT))
{
/* override DSDT with itself */
*NewTable = AcpiGbl_DbTablePtr;
}
#endif
#else
/* Construct a null-terminated string from table signature */
TableName[ACPI_NAME_SIZE] = 0;
ACPI_STRNCPY (TableName, ExistingTable->Signature, ACPI_NAME_SIZE);
*NewTable = OsGetTable (TableName);
if (*NewTable)
{
AcpiOsPrintf ("%s obtained from registry, %d bytes\n",
TableName, (*NewTable)->Length);
}
else
{
AcpiOsPrintf ("Could not read %s from registry\n", TableName);
}
#endif
return (AE_OK);
}
示例4: acpi_ps_init_op
void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
{
ACPI_FUNCTION_ENTRY();
op->common.descriptor_type = ACPI_DESC_TYPE_PARSER;
op->common.aml_opcode = opcode;
ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name,
(acpi_ps_get_opcode_info
(opcode))->name,
sizeof(op->common.aml_op_name)));
}
示例5: AcpiPsInitOp
void
AcpiPsInitOp (
ACPI_PARSE_OBJECT *Op,
UINT16 Opcode)
{
ACPI_FUNCTION_ENTRY ();
Op->Common.DescriptorType = ACPI_DESC_TYPE_PARSER;
Op->Common.AmlOpcode = Opcode;
ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (Op->Common.AmlOpName,
(AcpiPsGetOpcodeInfo (Opcode))->Name,
sizeof (Op->Common.AmlOpName)));
}
示例6: AcpiOsTableOverride
ACPI_STATUS
AcpiOsTableOverride (
ACPI_TABLE_HEADER *ExistingTable,
ACPI_TABLE_HEADER **NewTable)
{
if (!ExistingTable || !NewTable)
{
return (AE_BAD_PARAMETER);
}
*NewTable = NULL;
#ifdef ACPI_EXEC_APP
/* Call back up to AcpiExec */
AeTableOverride (ExistingTable, NewTable);
#endif
#ifdef ACPI_ASL_COMPILER
/* Attempt to get the table from the registry */
/* Construct a null-terminated string from table signature */
TableName[ACPI_NAME_SIZE] = 0;
ACPI_STRNCPY (TableName, ExistingTable->Signature, ACPI_NAME_SIZE);
*NewTable = OsGetTable (TableName);
if (*NewTable)
{
AcpiOsPrintf ("Table [%s] obtained from registry, %u bytes\n",
TableName, (*NewTable)->Length);
}
else
{
AcpiOsPrintf ("Could not read table %s from registry\n", TableName);
}
#endif
return (AE_OK);
}
示例7: acpi_ut_copy_id_string
static void
acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length)
{
/*
* Workaround for ID strings that have a leading asterisk. This construct
* is not allowed by the ACPI specification (ID strings must be
* alphanumeric), but enough existing machines have this embedded in their
* ID strings that the following code is useful.
*/
if (*source == '*') {
source++;
}
/* Do the actual copy */
ACPI_STRNCPY(destination, source, max_length);
}
示例8: AcpiUtCopyIdString
static void
AcpiUtCopyIdString (
char *Destination,
char *Source,
ACPI_SIZE MaxLength)
{
/*
* Workaround for ID strings that have a leading asterisk. This construct
* is not allowed by the ACPI specification (ID strings must be
* alphanumeric), but enough existing machines have this embedded in their
* ID strings that the following code is useful.
*/
if (*Source == '*')
{
Source++;
}
/* Do the actual copy */
ACPI_STRNCPY (Destination, Source, MaxLength);
}
示例9: AcpiDbOpenDebugFile
void
AcpiDbOpenDebugFile (
char *Name)
{
#ifdef ACPI_APPLICATION
AcpiDbCloseDebugFile ();
AcpiGbl_DebugFile = fopen (Name, "w+");
if (!AcpiGbl_DebugFile)
{
AcpiOsPrintf ("Could not open debug file %s\n", Name);
return;
}
AcpiOsPrintf ("Debug output file %s opened\n", Name);
ACPI_STRNCPY (AcpiGbl_DbDebugFilename, Name,
sizeof (AcpiGbl_DbDebugFilename));
AcpiGbl_DbOutputToFile = TRUE;
#endif
}
示例10: AeBuildLocalTables
ACPI_STATUS
AeBuildLocalTables (
UINT32 TableCount,
AE_TABLE_DESC *TableList)
{
ACPI_PHYSICAL_ADDRESS DsdtAddress = 0;
UINT32 XsdtSize;
AE_TABLE_DESC *NextTable;
UINT32 NextIndex;
ACPI_TABLE_FADT *ExternalFadt = NULL;
/*
* Update the table count. For DSDT, it is not put into the XSDT. For
* FADT, this is already accounted for since we usually install a
* local FADT.
*/
NextTable = TableList;
while (NextTable)
{
if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT) ||
ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT))
{
TableCount--;
}
NextTable = NextTable->Next;
}
XsdtSize = BASE_XSDT_SIZE + (TableCount * sizeof (UINT64));
/* Build an XSDT */
LocalXSDT = AcpiOsAllocate (XsdtSize);
if (!LocalXSDT)
{
return (AE_NO_MEMORY);
}
ACPI_MEMSET (LocalXSDT, 0, XsdtSize);
ACPI_STRNCPY (LocalXSDT->Header.Signature, ACPI_SIG_XSDT, 4);
LocalXSDT->Header.Length = XsdtSize;
LocalXSDT->Header.Revision = 1;
LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalFADT);
/*
* Install the user tables. The DSDT must be installed in the FADT.
* All other tables are installed directly into the XSDT.
*/
NextIndex = BASE_XSDT_TABLES;
NextTable = TableList;
while (NextTable)
{
/*
* Incoming DSDT or FADT are special cases. All other tables are
* just immediately installed into the XSDT.
*/
if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT))
{
if (DsdtAddress)
{
printf ("Already found a DSDT, only one allowed\n");
return (AE_ALREADY_EXISTS);
}
/* The incoming user table is a DSDT */
DsdtAddress = ACPI_PTR_TO_PHYSADDR (NextTable->Table);
}
else if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT))
{
ExternalFadt = ACPI_CAST_PTR (ACPI_TABLE_FADT, NextTable->Table);
LocalXSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (NextTable->Table);
}
else
{
/* Install the table in the XSDT */
LocalXSDT->TableOffsetEntry[NextIndex] = ACPI_PTR_TO_PHYSADDR (NextTable->Table);
NextIndex++;
}
NextTable = NextTable->Next;
}
/* Build an RSDP */
ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP));
ACPI_MEMCPY (LocalRSDP.Signature, ACPI_SIG_RSDP, 8);
ACPI_MEMCPY (LocalRSDP.OemId, "I_TEST", 6);
LocalRSDP.Revision = 2;
LocalRSDP.XsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalXSDT);
LocalRSDP.Length = sizeof (ACPI_TABLE_XSDT);
/* Set checksums for both XSDT and RSDP */
LocalXSDT->Header.Checksum = (UINT8) -AcpiTbChecksum (
(void *) LocalXSDT, LocalXSDT->Header.Length);
LocalRSDP.Checksum = (UINT8) -AcpiTbChecksum (
(void *) &LocalRSDP, ACPI_RSDP_CHECKSUM_LENGTH);
//.........这里部分代码省略.........
示例11: acpi_ex_convert_to_buffer
acpi_status
acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc)
{
union acpi_operand_object *return_desc;
u8 *new_buf;
ACPI_FUNCTION_TRACE_PTR(ex_convert_to_buffer, obj_desc);
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
case ACPI_TYPE_BUFFER:
/* No conversion necessary */
*result_desc = obj_desc;
return_ACPI_STATUS(AE_OK);
case ACPI_TYPE_INTEGER:
/*
* Create a new Buffer object.
* Need enough space for one integer
*/
return_desc =
acpi_ut_create_buffer_object(acpi_gbl_integer_byte_width);
if (!return_desc) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
/* Copy the integer to the buffer, LSB first */
new_buf = return_desc->buffer.pointer;
ACPI_MEMCPY(new_buf,
&obj_desc->integer.value,
acpi_gbl_integer_byte_width);
break;
case ACPI_TYPE_STRING:
/*
* Create a new Buffer object
* Size will be the string length
*
* NOTE: Add one to the string length to include the null terminator.
* The ACPI spec is unclear on this subject, but there is existing
* ASL/AML code that depends on the null being transferred to the new
* buffer.
*/
return_desc = acpi_ut_create_buffer_object((acpi_size)
obj_desc->string.
length + 1);
if (!return_desc) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
/* Copy the string to the buffer */
new_buf = return_desc->buffer.pointer;
ACPI_STRNCPY((char *)new_buf, (char *)obj_desc->string.pointer,
obj_desc->string.length);
break;
default:
return_ACPI_STATUS(AE_TYPE);
}
/* Mark buffer initialized */
return_desc->common.flags |= AOPOBJ_DATA_VALID;
*result_desc = return_desc;
return_ACPI_STATUS(AE_OK);
}
示例12: DtParseLine
static ACPI_STATUS
DtParseLine (
char *LineBuffer,
UINT32 Line,
UINT32 Offset)
{
char *Start;
char *End;
char *TmpName;
char *TmpValue;
char *Name;
char *Value;
char *Colon;
UINT32 Length;
DT_FIELD *Field;
UINT32 Column;
UINT32 NameColumn;
BOOLEAN IsNullString = FALSE;
if (!LineBuffer)
{
return (AE_OK);
}
/* All lines after "Raw Table Data" are ingored */
if (strstr (LineBuffer, ACPI_RAW_TABLE_DATA_HEADER))
{
return (AE_NOT_FOUND);
}
Colon = strchr (LineBuffer, ':');
if (!Colon)
{
return (AE_OK);
}
Start = LineBuffer;
End = Colon;
while (Start < Colon)
{
if (*Start == ' ')
{
Start++;
continue;
}
/* Found left bracket, go to the right bracket */
if (*Start == '[')
{
while (Start < Colon && *Start != ']')
{
Start++;
}
if (Start == Colon)
{
break;
}
Start++;
continue;
}
break;
}
/*
* There are two column values. One for the field name,
* and one for the field value.
*/
Column = ACPI_PTR_DIFF (Colon, LineBuffer) + 3;
NameColumn = ACPI_PTR_DIFF (Start, LineBuffer) + 1;
Length = ACPI_PTR_DIFF (End, Start);
TmpName = UtLocalCalloc (Length + 1);
ACPI_STRNCPY (TmpName, Start, Length);
Name = DtTrim (TmpName);
ACPI_FREE (TmpName);
Start = End = (Colon + 1);
while (*End)
{
/* Found left quotation, go to the right quotation and break */
if (*End == '"')
{
End++;
/* Check for an explicit null string */
if (*End == '"')
{
IsNullString = TRUE;
}
while (*End && (*End != '"'))
//.........这里部分代码省略.........
示例13: DtTrim
static char *
DtTrim (
char *String)
{
char *Start;
char *End;
char *ReturnString;
ACPI_SIZE Length;
/* Skip lines that start with a space */
if (!ACPI_STRCMP (String, " "))
{
ReturnString = UtLocalCalloc (1);
return (ReturnString);
}
/* Setup pointers to start and end of input string */
Start = String;
End = String + ACPI_STRLEN (String) - 1;
/* Find first non-whitespace character */
while ((Start <= End) && ((*Start == ' ') || (*Start == '\t')))
{
Start++;
}
/* Find last non-space character */
while (End >= Start)
{
if (*End == '\r' || *End == '\n')
{
End--;
continue;
}
if (*End != ' ')
{
break;
}
End--;
}
/* Remove any quotes around the string */
if (*Start == '\"')
{
Start++;
}
if (*End == '\"')
{
End--;
}
/* Create the trimmed return string */
Length = ACPI_PTR_DIFF (End, Start) + 1;
ReturnString = UtLocalCalloc (Length + 1);
if (ACPI_STRLEN (Start))
{
ACPI_STRNCPY (ReturnString, Start, Length);
}
ReturnString[Length] = 0;
return (ReturnString);
}
示例14: AcpiTbFindTable
ACPI_STATUS
AcpiTbFindTable (
char *Signature,
char *OemId,
char *OemTableId,
UINT32 *TableIndex)
{
UINT32 i;
ACPI_STATUS Status;
ACPI_TABLE_HEADER Header;
ACPI_FUNCTION_TRACE (TbFindTable);
/* Normalize the input strings */
ACPI_MEMSET (&Header, 0, sizeof (ACPI_TABLE_HEADER));
ACPI_MOVE_NAME (Header.Signature, Signature);
ACPI_STRNCPY (Header.OemId, OemId, ACPI_OEM_ID_SIZE);
ACPI_STRNCPY (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE);
/* Search for the table */
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
{
if (ACPI_MEMCMP (&(AcpiGbl_RootTableList.Tables[i].Signature),
Header.Signature, ACPI_NAME_SIZE))
{
/* Not the requested table */
continue;
}
/* Table with matching signature has been found */
if (!AcpiGbl_RootTableList.Tables[i].Pointer)
{
/* Table is not currently mapped, map it */
Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
if (!AcpiGbl_RootTableList.Tables[i].Pointer)
{
continue;
}
}
/* Check for table match on all IDs */
if (!ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->Signature,
Header.Signature, ACPI_NAME_SIZE) &&
(!OemId[0] ||
!ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemId,
Header.OemId, ACPI_OEM_ID_SIZE)) &&
(!OemTableId[0] ||
!ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemTableId,
Header.OemTableId, ACPI_OEM_TABLE_ID_SIZE)))
{
*TableIndex = i;
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n",
Header.Signature));
return_ACPI_STATUS (AE_OK);
}
}
return_ACPI_STATUS (AE_NOT_FOUND);
}
示例15: acpi_tb_find_table
acpi_status
acpi_tb_find_table(char *signature,
char *oem_id, char *oem_table_id, u32 *table_index)
{
u32 i;
acpi_status status;
struct acpi_table_header header;
ACPI_FUNCTION_TRACE(tb_find_table);
/* */
ACPI_MEMSET(&header, 0, sizeof(struct acpi_table_header));
ACPI_STRNCPY(header.signature, signature, ACPI_NAME_SIZE);
ACPI_STRNCPY(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
ACPI_STRNCPY(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
/* */
for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
if (ACPI_MEMCMP(&(acpi_gbl_root_table_list.tables[i].signature),
header.signature, ACPI_NAME_SIZE)) {
/* */
continue;
}
/* */
if (!acpi_gbl_root_table_list.tables[i].pointer) {
/* */
status =
acpi_tb_verify_table(&acpi_gbl_root_table_list.
tables[i]);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
if (!acpi_gbl_root_table_list.tables[i].pointer) {
continue;
}
}
/* */
if (!ACPI_MEMCMP
(acpi_gbl_root_table_list.tables[i].pointer->signature,
header.signature, ACPI_NAME_SIZE) && (!oem_id[0]
||
!ACPI_MEMCMP
(acpi_gbl_root_table_list.
tables[i].pointer->
oem_id,
header.oem_id,
ACPI_OEM_ID_SIZE))
&& (!oem_table_id[0]
|| !ACPI_MEMCMP(acpi_gbl_root_table_list.tables[i].
pointer->oem_table_id,
header.oem_table_id,
ACPI_OEM_TABLE_ID_SIZE))) {
*table_index = i;
ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
"Found table [%4.4s]\n",
header.signature));
return_ACPI_STATUS(AE_OK);
}
}
return_ACPI_STATUS(AE_NOT_FOUND);
}