ACPICA: Utilities: Introduce acpi_log_error() to improve portability
Invocations like fprintf(stderr) and perror() are not portable, this patch introduces acpi_log_error() as a replacement, it is implemented using new portable API - acpi_ut_file_vprintf(). Note that though acpi_os_initialize() need to be invoked prior than using this new API, since no users are introduced in this patch, such invocations are not added for applications that link utprint.c in this patch. Futher patches that introduce users of acpi_log_error() should take care of this. This patch is only useful for ACPICA applications, most of which are not shipped in the Linux kernel. Note that follow-up commits will update acpidump to use this new API to improve portability. Lv Zheng. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
80a648c12e
commit
2e70da4c51
|
@ -561,3 +561,29 @@ acpi_ut_ptr_exit(u32 line_number,
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ACPI_APPLICATION
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_log_error
|
||||||
|
*
|
||||||
|
* PARAMETERS: format - Printf format field
|
||||||
|
* ... - Optional printf arguments
|
||||||
|
*
|
||||||
|
* RETURN: None
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Print error message to the console, used by applications.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
void ACPI_INTERNAL_VAR_XFACE acpi_log_error(const char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start(args, format);
|
||||||
|
(void)acpi_ut_file_vprintf(ACPI_FILE_ERR, format, args);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
ACPI_EXPORT_SYMBOL(acpi_log_error)
|
||||||
|
#endif
|
||||||
|
|
|
@ -335,6 +335,23 @@ ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running);
|
||||||
|
|
||||||
#endif /* ACPI_DEBUG_OUTPUT */
|
#endif /* ACPI_DEBUG_OUTPUT */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Application prototypes
|
||||||
|
*
|
||||||
|
* All interfaces used by application will be configured
|
||||||
|
* out of the ACPICA build unless the ACPI_APPLICATION
|
||||||
|
* flag is defined.
|
||||||
|
*/
|
||||||
|
#ifdef ACPI_APPLICATION
|
||||||
|
#define ACPI_APP_DEPENDENT_RETURN_VOID(prototype) \
|
||||||
|
prototype;
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define ACPI_APP_DEPENDENT_RETURN_VOID(prototype) \
|
||||||
|
static ACPI_INLINE prototype {return;}
|
||||||
|
|
||||||
|
#endif /* ACPI_APPLICATION */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* ACPICA public interface prototypes
|
* ACPICA public interface prototypes
|
||||||
|
@ -861,6 +878,9 @@ ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6)
|
||||||
const char *module_name,
|
const char *module_name,
|
||||||
u32 component_id,
|
u32 component_id,
|
||||||
const char *format, ...))
|
const char *format, ...))
|
||||||
|
ACPI_APP_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(1)
|
||||||
|
void ACPI_INTERNAL_VAR_XFACE
|
||||||
|
acpi_log_error(const char *format, ...))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Divergences
|
* Divergences
|
||||||
|
|
|
@ -423,8 +423,12 @@ typedef char *va_list;
|
||||||
#ifdef ACPI_APPLICATION
|
#ifdef ACPI_APPLICATION
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define ACPI_FILE FILE *
|
#define ACPI_FILE FILE *
|
||||||
|
#define ACPI_FILE_OUT stdout
|
||||||
|
#define ACPI_FILE_ERR stderr
|
||||||
#else
|
#else
|
||||||
#define ACPI_FILE void *
|
#define ACPI_FILE void *
|
||||||
|
#define ACPI_FILE_OUT NULL
|
||||||
|
#define ACPI_FILE_ERR NULL
|
||||||
#endif /* ACPI_APPLICATION */
|
#endif /* ACPI_APPLICATION */
|
||||||
#endif /* ACPI_FILE */
|
#endif /* ACPI_FILE */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue