本网站可以出售:只需60000元直接拥有。QQ:939804642
您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ACPI_STRNCPY函数代码示例

51自学网 2021-06-01 19:32:59
  C++
这篇教程C++ ACPI_STRNCPY函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中ACPI_STRNCPY函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_STRNCPY函数的具体用法?C++ ACPI_STRNCPY怎么用?C++ ACPI_STRNCPY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了ACPI_STRNCPY函数的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: AeInitializeTableHeader

static voidAeInitializeTableHeader (    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;}
开发者ID:macmade,项目名称:acpica,代码行数:16,


示例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_statusacpi_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);}
开发者ID:E-LLP,项目名称:n900,代码行数:74,


示例3: AcpiOsActualTableOverride

ACPI_STATUSAcpiOsActualTableOverride (    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);}
开发者ID:minggr,项目名称:acpica,代码行数:53,


示例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)));}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:12,


示例5: AcpiPsInitOp

voidAcpiPsInitOp (    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)));}
开发者ID:hoangduit,项目名称:reactos,代码行数:15,


示例6: AcpiOsTableOverride

ACPI_STATUSAcpiOsTableOverride (    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);}
开发者ID:Aresthu,项目名称:ucore_plus,代码行数:45,


示例7: acpi_ut_copy_id_string

static voidacpi_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);}
开发者ID:274914765,项目名称:C,代码行数:18,


示例8: AcpiUtCopyIdString

static voidAcpiUtCopyIdString (    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);}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:22,


示例9: AcpiDbOpenDebugFile

voidAcpiDbOpenDebugFile (    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}
开发者ID:queer1,项目名称:acpica,代码行数:22,


示例10: AeBuildLocalTables

ACPI_STATUSAeBuildLocalTables (    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);//.........这里部分代码省略.........
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:101,


示例11: acpi_ex_convert_to_buffer

acpi_statusacpi_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);}
开发者ID:laitianli,项目名称:kernel-analyze_linux-2.6.18,代码行数:72,


示例12: DtParseLine

static ACPI_STATUSDtParseLine (    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 != '"'))//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:libuinet,代码行数:101,


示例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);}
开发者ID:BillTheBest,项目名称:libuinet,代码行数:71,


示例14: AcpiTbFindTable

ACPI_STATUSAcpiTbFindTable (    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);}
开发者ID:queer1,项目名称:acpica,代码行数:73,


示例15: acpi_tb_find_table

acpi_statusacpi_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);}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:74,


示例16: AcpiExConvertToBuffer

ACPI_STATUSAcpiExConvertToBuffer (    ACPI_OPERAND_OBJECT     *ObjDesc,    ACPI_OPERAND_OBJECT     **ResultDesc){    ACPI_OPERAND_OBJECT     *ReturnDesc;    UINT8                   *NewBuf;    ACPI_FUNCTION_TRACE_PTR (ExConvertToBuffer, ObjDesc);    switch (ObjDesc->Common.Type)    {    case ACPI_TYPE_BUFFER:        /* No conversion necessary */        *ResultDesc = ObjDesc;        return_ACPI_STATUS (AE_OK);    case ACPI_TYPE_INTEGER:        /*         * Create a new Buffer object.         * Need enough space for one integer         */        ReturnDesc = AcpiUtCreateBufferObject (AcpiGbl_IntegerByteWidth);        if (!ReturnDesc)        {            return_ACPI_STATUS (AE_NO_MEMORY);        }        /* Copy the integer to the buffer, LSB first */        NewBuf = ReturnDesc->Buffer.Pointer;        ACPI_MEMCPY (NewBuf,                        &ObjDesc->Integer.Value,                        AcpiGbl_IntegerByteWidth);        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.         */        ReturnDesc = AcpiUtCreateBufferObject (                        (ACPI_SIZE) ObjDesc->String.Length + 1);        if (!ReturnDesc)        {            return_ACPI_STATUS (AE_NO_MEMORY);        }        /* Copy the string to the buffer */        NewBuf = ReturnDesc->Buffer.Pointer;        ACPI_STRNCPY ((char *) NewBuf, (char *) ObjDesc->String.Pointer,            ObjDesc->String.Length);        break;    default:        return_ACPI_STATUS (AE_TYPE);    }    /* Mark buffer initialized */    ReturnDesc->Common.Flags |= AOPOBJ_DATA_VALID;    *ResultDesc = ReturnDesc;    return_ACPI_STATUS (AE_OK);}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:76,


示例17: AcpiDsCreateOperand

//.........这里部分代码省略.........                InterpreterMode = ACPI_IMODE_EXECUTE;            }            Status = AcpiNsLookup (WalkState->ScopeInfo, NameString,                        ACPI_TYPE_ANY, InterpreterMode,                        ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,                        WalkState,                        ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc));            /*             * The only case where we pass through (ignore) a NOT_FOUND             * error is for the CondRefOf opcode.             */            if (Status == AE_NOT_FOUND)            {                if (ParentOp->Common.AmlOpcode == AML_COND_REF_OF_OP)                {                    /*                     * For the Conditional Reference op, it's OK if                     * the name is not found;  We just need a way to                     * indicate this to the interpreter, set the                     * object to the root                     */                    ObjDesc = ACPI_CAST_PTR (                                ACPI_OPERAND_OBJECT, AcpiGbl_RootNode);                    Status = AE_OK;                }                else if (ParentOp->Common.AmlOpcode == AML_EXTERNAL_OP)                {                    /* TBD: May only be temporary */                    ObjDesc = AcpiUtCreateStringObject ((ACPI_SIZE) NameLength);                    ACPI_STRNCPY (ObjDesc->String.Pointer, NameString, NameLength);                    Status = AE_OK;                }                else                {                    /*                     * We just plain didn't find it -- which is a                     * very serious error at this point                     */                    Status = AE_AML_NAME_NOT_FOUND;                }            }            if (ACPI_FAILURE (Status))            {                ACPI_ERROR_NAMESPACE (NameString, Status);            }        }        /* Free the namestring created above */        ACPI_FREE (NameString);        /* Check status from the lookup */        if (ACPI_FAILURE (Status))        {            return_ACPI_STATUS (Status);        }        /* Put the resulting object onto the current object stack */        Status = AcpiDsObjStackPush (ObjDesc, WalkState);
开发者ID:LauraBerry,项目名称:A2cpsc457,代码行数:67,


示例18: OpcParsePrintf

static voidOpcParsePrintf (    ACPI_PARSE_OBJECT       *Op,    ACPI_PARSE_OBJECT       *DestOp){    char                    *Format;    char                    *StartPosition = NULL;    ACPI_PARSE_OBJECT       *ArgNode;    ACPI_PARSE_OBJECT       *NextNode;    UINT32                  StringLength = 0;    char                    *NewString;    BOOLEAN                 StringToProcess = FALSE;    ACPI_PARSE_OBJECT       *NewOp;    /* Get format string */    Format = ACPI_CAST_PTR (char, Op->Asl.Child->Asl.Value.String);    ArgNode = Op->Asl.Child->Asl.Next;    /*     * Detach argument list so that we can use a NULL check to distinguish     * the first concatenation operation we need to make     */    Op->Asl.Child = NULL;    for (; *Format; ++Format)    {        if (*Format != '%')        {            if (!StringToProcess)            {                /* Mark the beginning of a string */                StartPosition = Format;                StringToProcess = TRUE;            }            ++StringLength;            continue;        }        /* Save string, if any, to new string object and concat it */        if (StringToProcess)        {            NewString = UtStringCacheCalloc (StringLength + 1);            ACPI_STRNCPY (NewString, StartPosition, StringLength);            NewOp = TrAllocateNode (PARSEOP_STRING_LITERAL);            NewOp->Asl.Value.String = NewString;            NewOp->Asl.AmlOpcode = AML_STRING_OP;            NewOp->Asl.AcpiBtype = ACPI_BTYPE_STRING;            OpcCreateConcatenateNode(Op, NewOp);            StringLength = 0;            StringToProcess = FALSE;        }        ++Format;        /*         * We have a format parameter and will need an argument to go         * with it         */        if (!ArgNode ||            ArgNode->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)        {            AslError(ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, NULL);            return;        }        /*         * We do not support sub-specifiers of printf (flags, width,         * precision, length). For specifiers we only support %x/%X for         * hex or %s for strings. Also, %o for generic "acpi object".         */        switch (*Format)        {        case 's':            if (ArgNode->Asl.ParseOpcode != PARSEOP_STRING_LITERAL)            {                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgNode,                    "String required");                return;            }            NextNode = ArgNode->Asl.Next;            ArgNode->Asl.Next = NULL;            OpcCreateConcatenateNode(Op, ArgNode);            ArgNode = NextNode;            continue;        case 'X':        case 'x':        case 'o':            NextNode = ArgNode->Asl.Next;            ArgNode->Asl.Next = NULL;//.........这里部分代码省略.........
开发者ID:lynxis,项目名称:acpica,代码行数:101,


示例19: acpi_tb_find_table

acpi_statusacpi_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);	/* Normalize the input strings */	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);	/* Search for the table */	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)) {			/* Not the requested table */			continue;		}		/* Table with matching signature has been found */		if (!acpi_gbl_root_table_list.tables[i].pointer) {			/* Table is not currently mapped, map it */			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;			}		}		/* Check for table match on all IDs */		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);}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:74,


示例20: AcpiUtTrackAllocation

static ACPI_STATUSAcpiUtTrackAllocation (    ACPI_DEBUG_MEM_BLOCK    *Allocation,    ACPI_SIZE               Size,    UINT8                   AllocType,    UINT32                  Component,    const char              *Module,    UINT32                  Line){    ACPI_MEMORY_LIST        *MemList;    ACPI_DEBUG_MEM_BLOCK    *Element;    ACPI_STATUS             Status = AE_OK;    ACPI_FUNCTION_TRACE_PTR (UtTrackAllocation, Allocation);    MemList = AcpiGbl_GlobalList;    Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);    if (ACPI_FAILURE (Status))    {        return_ACPI_STATUS (Status);    }    /*     * Search list for this address to make sure it is not already on the list.     * This will catch several kinds of problems.     */    Element = AcpiUtFindAllocation (Allocation);    if (Element)    {        ACPI_ERROR ((AE_INFO,            "UtTrackAllocation: Allocation already present in list! (%p)",            Allocation));        ACPI_ERROR ((AE_INFO, "Element %p Address %p",            Element, Allocation));        goto UnlockAndExit;    }    /* Fill in the instance data. */    Allocation->Size      = (UINT32) Size;    Allocation->AllocType = AllocType;    Allocation->Component = Component;    Allocation->Line      = Line;    ACPI_STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME);    Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0;    /* Insert at list head */    if (MemList->ListHead)    {        ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = Allocation;    }    Allocation->Next = MemList->ListHead;    Allocation->Previous = NULL;    MemList->ListHead = Allocation;UnlockAndExit:    Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);    return_ACPI_STATUS (Status);}
开发者ID:luciang,项目名称:haiku,代码行数:68,


示例21: AcpiGetName

ACPI_STATUSAcpiGetName (    ACPI_HANDLE             Handle,    UINT32                  NameType,    ACPI_BUFFER             *Buffer){    ACPI_STATUS             Status;    ACPI_NAMESPACE_NODE     *Node;    /* Parameter validation */    if (NameType > ACPI_NAME_TYPE_MAX)    {        return (AE_BAD_PARAMETER);    }    Status = AcpiUtValidateBuffer (Buffer);    if (ACPI_FAILURE (Status))    {        return (Status);    }    if (NameType == ACPI_FULL_PATHNAME)    {        /* Get the full pathname (From the namespace root) */        Status = AcpiNsHandleToPathname (Handle, Buffer);        return (Status);    }    /*     * Wants the single segment ACPI name.     * Validate handle and convert to a namespace Node     */    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);    if (ACPI_FAILURE (Status))    {        return (Status);    }    Node = AcpiNsMapHandleToNode (Handle);    if (!Node)    {        Status = AE_BAD_PARAMETER;        goto UnlockAndExit;    }    /* Validate/Allocate/Clear caller buffer */    Status = AcpiUtInitializeBuffer (Buffer, ACPI_PATH_SEGMENT_LENGTH);    if (ACPI_FAILURE (Status))    {        goto UnlockAndExit;    }    /* Just copy the ACPI name from the Node and zero terminate it */    ACPI_STRNCPY (Buffer->Pointer, AcpiUtGetNodeName (Node),                ACPI_NAME_SIZE);    ((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0;    Status = AE_OK;UnlockAndExit:    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);    return (Status);}
开发者ID:samueldotj,项目名称:AceOS,代码行数:69,



注:本文中的ACPI_STRNCPY函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ ACPI_STRTOUL函数代码示例
C++ ACPI_STRLEN函数代码示例
51自学网自学EXCEL、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。
京ICP备13026421号-1