本文整理汇总了C++中ACPI_STRCPY函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_STRCPY函数的具体用法?C++ ACPI_STRCPY怎么用?C++ ACPI_STRCPY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_STRCPY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acpi_ut_install_interface
acpi_status acpi_ut_install_interface(acpi_string interface_name)
{
struct acpi_interface_info *interface_info;
/* Allocate info block and space for the name string */
interface_info =
ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_interface_info));
if (!interface_info) {
return (AE_NO_MEMORY);
}
interface_info->name =
ACPI_ALLOCATE_ZEROED(ACPI_STRLEN(interface_name) + 1);
if (!interface_info->name) {
ACPI_FREE(interface_info);
return (AE_NO_MEMORY);
}
/* Initialize new info and insert at the head of the global list */
ACPI_STRCPY(interface_info->name, interface_name);
interface_info->flags = ACPI_OSI_DYNAMIC;
interface_info->next = acpi_gbl_supported_interfaces;
acpi_gbl_supported_interfaces = interface_info;
return (AE_OK);
}
示例2: acpi_ut_install_interface
acpi_status acpi_ut_install_interface(acpi_string interface_name)
{
struct acpi_interface_info *interface_info;
interface_info =
ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_interface_info));
if (!interface_info) {
return (AE_NO_MEMORY);
}
interface_info->name =
ACPI_ALLOCATE_ZEROED(ACPI_STRLEN(interface_name) + 1);
if (!interface_info->name) {
ACPI_FREE(interface_info);
return (AE_NO_MEMORY);
}
ACPI_STRCPY(interface_info->name, interface_name);
interface_info->flags = ACPI_OSI_DYNAMIC;
interface_info->next = acpi_gbl_supported_interfaces;
acpi_gbl_supported_interfaces = interface_info;
return (AE_OK);
}
示例3: acpi_ut_get_expected_return_types
void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes)
{
u32 this_rtype;
u32 i;
u32 j;
if (!expected_btypes) {
ACPI_STRCPY(buffer, "NONE");
return;
}
j = 1;
buffer[0] = 0;
this_rtype = ACPI_RTYPE_INTEGER;
for (i = 0; i < ACPI_NUM_RTYPES; i++) {
/* If one of the expected types, concatenate the name of this type */
if (expected_btypes & this_rtype) {
ACPI_STRCAT(buffer, &ut_rtype_names[i][j]);
j = 0; /* Use name separator from now on */
}
this_rtype <<= 1; /* Next Rtype */
}
}
示例4: AcpiUtInstallInterface
ACPI_STATUS
AcpiUtInstallInterface (
ACPI_STRING InterfaceName)
{
ACPI_INTERFACE_INFO *InterfaceInfo;
/* Allocate info block and space for the name string */
InterfaceInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_INTERFACE_INFO));
if (!InterfaceInfo)
{
return (AE_NO_MEMORY);
}
InterfaceInfo->Name = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (InterfaceName) + 1);
if (!InterfaceInfo->Name)
{
ACPI_FREE (InterfaceInfo);
return (AE_NO_MEMORY);
}
/* Initialize new info and insert at the head of the global list */
ACPI_STRCPY (InterfaceInfo->Name, InterfaceName);
InterfaceInfo->Flags = ACPI_OSI_DYNAMIC;
InterfaceInfo->Next = AcpiGbl_SupportedInterfaces;
AcpiGbl_SupportedInterfaces = InterfaceInfo;
return (AE_OK);
}
示例5: acpi_ut_execute_HID
/*******************************************************************************
*
* FUNCTION: acpi_ut_execute_HID
*
* PARAMETERS: device_node - Node for the device
* return_id - Where the string HID is returned
*
* RETURN: Status
*
* DESCRIPTION: Executes the _HID control method that returns the hardware
* ID of the device. The HID is either an 32-bit encoded EISAID
* Integer or a String. A string is always returned. An EISAID
* is converted to a string.
*
* NOTE: Internal function, no parameter validation
*
******************************************************************************/
acpi_status
acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
struct acpi_pnp_device_id **return_id)
{
union acpi_operand_object *obj_desc;
struct acpi_pnp_device_id *hid;
u32 length;
acpi_status status;
ACPI_FUNCTION_TRACE(ut_execute_HID);
status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID,
ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
&obj_desc);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Get the size of the String to be returned, includes null terminator */
if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
length = ACPI_EISAID_STRING_SIZE;
} else {
length = obj_desc->string.length + 1;
}
/* Allocate a buffer for the HID */
hid =
ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
(acpi_size) length);
if (!hid) {
status = AE_NO_MEMORY;
goto cleanup;
}
/* Area for the string starts after PNP_DEVICE_ID struct */
hid->string =
ACPI_ADD_PTR(char, hid, sizeof(struct acpi_pnp_device_id));
/* Convert EISAID to a string or simply copy existing string */
if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
acpi_ex_eisa_id_to_string(hid->string, obj_desc->integer.value);
} else {
ACPI_STRCPY(hid->string, obj_desc->string.pointer);
}
hid->length = length;
*return_id = hid;
cleanup:
/* On exit, we must delete the return object */
acpi_ut_remove_reference(obj_desc);
return_ACPI_STATUS(status);
}
示例6: acpi_ut_execute_UID
acpi_status
acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
struct acpica_device_id **return_id)
{
union acpi_operand_object *obj_desc;
struct acpica_device_id *uid;
u32 length;
acpi_status status;
ACPI_FUNCTION_TRACE(ut_execute_UID);
status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID,
ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
&obj_desc);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Get the size of the String to be returned, includes null terminator */
if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
length = ACPI_MAX64_DECIMAL_DIGITS + 1;
} else {
length = obj_desc->string.length + 1;
}
/* Allocate a buffer for the UID */
uid =
ACPI_ALLOCATE_ZEROED(sizeof(struct acpica_device_id) +
(acpi_size) length);
if (!uid) {
status = AE_NO_MEMORY;
goto cleanup;
}
/* Area for the string starts after DEVICE_ID struct */
uid->string = ACPI_ADD_PTR(char, uid, sizeof(struct acpica_device_id));
/* Convert an Integer to string, or just copy an existing string */
if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
acpi_ex_integer_to_string(uid->string, obj_desc->integer.value);
} else {
ACPI_STRCPY(uid->string, obj_desc->string.pointer);
}
uid->length = length;
*return_id = uid;
cleanup:
/* On exit, we must delete the return object */
acpi_ut_remove_reference(obj_desc);
return_ACPI_STATUS(status);
}
示例7: AcpiDbAddToHistory
void
AcpiDbAddToHistory (
char *CommandLine)
{
UINT16 CmdLen;
UINT16 BufferLen;
/* Put command into the next available slot */
CmdLen = (UINT16) ACPI_STRLEN (CommandLine);
if (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command != NULL)
{
BufferLen = (UINT16) ACPI_STRLEN (
AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command);
if (CmdLen > BufferLen)
{
AcpiOsFree (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].
Command);
AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command =
AcpiOsAllocate (CmdLen + 1);
}
}
else
{
AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command =
AcpiOsAllocate (CmdLen + 1);
}
ACPI_STRCPY (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command,
CommandLine);
AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum =
AcpiGbl_NextCmdNum;
/* Adjust indexes */
if ((AcpiGbl_NumHistory == HISTORY_SIZE) &&
(AcpiGbl_NextHistoryIndex == AcpiGbl_LoHistory))
{
AcpiGbl_LoHistory++;
if (AcpiGbl_LoHistory >= HISTORY_SIZE)
{
AcpiGbl_LoHistory = 0;
}
}
AcpiGbl_NextHistoryIndex++;
if (AcpiGbl_NextHistoryIndex >= HISTORY_SIZE)
{
AcpiGbl_NextHistoryIndex = 0;
}
AcpiGbl_NextCmdNum++;
if (AcpiGbl_NumHistory < HISTORY_SIZE)
{
AcpiGbl_NumHistory++;
}
}
示例8: acpi_ut_safe_strcpy
u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source)
{
if (ACPI_STRLEN(source) >= dest_size) {
return (TRUE);
}
ACPI_STRCPY(dest, source);
return (FALSE);
}
示例9: AcpiDbSetScope
void
AcpiDbSetScope (
char *Name)
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
if (!Name || Name[0] == 0)
{
AcpiOsPrintf ("Current scope: %s\n", AcpiGbl_DbScopeBuf);
return;
}
AcpiDbPrepNamestring (Name);
if (Name[0] == '\\')
{
/* Validate new scope from the root */
Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, ACPI_NS_NO_UPSEARCH,
&Node);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name);
ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
}
else
{
/* Validate new scope relative to old scope */
Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, ACPI_NS_NO_UPSEARCH,
&Node);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
ACPI_STRCAT (AcpiGbl_DbScopeBuf, Name);
ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
}
AcpiGbl_DbScopeNode = Node;
AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf);
return;
ErrorExit:
AcpiOsPrintf ("Could not attach scope: %s, %s\n",
Name, AcpiFormatException (Status));
}
示例10: AcpiDbUInt32ToHexString
void
AcpiDbUInt32ToHexString (
UINT32 Value,
char *Buffer)
{
UINT8 i;
if (Value == 0)
{
ACPI_STRCPY (Buffer, "0");
return;
}
ACPI_STRCPY (Buffer, "0x");
Buffer[10] = '\0';
for (i = 9; i > 1; i--)
{
Buffer[i] = Converter [Value & 0x0F];
Value = Value >> 4;
}
}
示例11: acpi_ut_execute_SUB
acpi_status
acpi_ut_execute_SUB(struct acpi_namespace_node *device_node,
struct acpi_pnp_device_id **return_id)
{
union acpi_operand_object *obj_desc;
struct acpi_pnp_device_id *sub;
u32 length;
acpi_status status;
ACPI_FUNCTION_TRACE(ut_execute_SUB);
status = acpi_ut_evaluate_object(device_node, METHOD_NAME__SUB,
ACPI_BTYPE_STRING, &obj_desc);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Get the size of the String to be returned, includes null terminator */
length = obj_desc->string.length + 1;
/* Allocate a buffer for the SUB */
sub =
ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
(acpi_size) length);
if (!sub) {
status = AE_NO_MEMORY;
goto cleanup;
}
/* Area for the string starts after PNP_DEVICE_ID struct */
sub->string =
ACPI_ADD_PTR(char, sub, sizeof(struct acpi_pnp_device_id));
/* Simply copy existing string */
ACPI_STRCPY(sub->string, obj_desc->string.pointer);
sub->length = length;
*return_id = sub;
cleanup:
/* On exit, we must delete the return object */
acpi_ut_remove_reference(obj_desc);
return_ACPI_STATUS(status);
}
示例12: AcpiUtSafeStrcpy
BOOLEAN
AcpiUtSafeStrcpy (
char *Dest,
ACPI_SIZE DestSize,
char *Source)
{
if (ACPI_STRLEN (Source) >= DestSize)
{
return (TRUE);
}
ACPI_STRCPY (Dest, Source);
return (FALSE);
}
示例13: AcpiUtDeleteCaches
ACPI_STATUS
AcpiUtDeleteCaches (
void)
{
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
char Buffer[7];
if (AcpiGbl_DisplayFinalMemStats)
{
ACPI_STRCPY (Buffer, "MEMORY");
(void) AcpiDbDisplayStatistics (Buffer);
}
#endif
(void) AcpiOsDeleteCache (AcpiGbl_NamespaceCache);
AcpiGbl_NamespaceCache = NULL;
(void) AcpiOsDeleteCache (AcpiGbl_StateCache);
AcpiGbl_StateCache = NULL;
(void) AcpiOsDeleteCache (AcpiGbl_OperandCache);
AcpiGbl_OperandCache = NULL;
(void) AcpiOsDeleteCache (AcpiGbl_PsNodeCache);
AcpiGbl_PsNodeCache = NULL;
(void) AcpiOsDeleteCache (AcpiGbl_PsNodeExtCache);
AcpiGbl_PsNodeExtCache = NULL;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
/* Debug only - display leftover memory allocation, if any */
AcpiUtDumpAllocations (ACPI_UINT32_MAX, NULL);
/* Free memory lists */
AcpiOsFree (AcpiGbl_GlobalList);
AcpiGbl_GlobalList = NULL;
AcpiOsFree (AcpiGbl_NsNodeList);
AcpiGbl_NsNodeList = NULL;
#endif
return (AE_OK);
}
示例14: AcpiDmAddToExternalFileList
ACPI_STATUS
AcpiDmAddToExternalFileList (
char *PathList)
{
ACPI_EXTERNAL_FILE *ExternalFile;
char *Path;
char *TmpPath;
if (!PathList)
{
return (AE_OK);
}
Path = strtok (PathList, ",");
while (Path)
{
TmpPath = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (Path) + 1);
if (!TmpPath)
{
return (AE_NO_MEMORY);
}
ACPI_STRCPY (TmpPath, Path);
ExternalFile = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_FILE));
if (!ExternalFile)
{
ACPI_FREE (TmpPath);
return (AE_NO_MEMORY);
}
ExternalFile->Path = TmpPath;
if (AcpiGbl_ExternalFileList)
{
ExternalFile->Next = AcpiGbl_ExternalFileList;
}
AcpiGbl_ExternalFileList = ExternalFile;
Path = strtok (NULL, ",");
}
return (AE_OK);
}
示例15: acpi_ut_copy_id_string
static void acpi_ut_copy_id_string(char *destination, char *source)
{
/*
* 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_STRCPY(destination, source);
}