mirror of
https://github.com/ukui/kernel.git
synced 2026-03-09 10:07:04 -07:00
ACPICA: acpidump: Reduce freopen() invocations to improve portability
This patch reduces the requirement of invoking freopen() in acpidump in order to reduce the porting effort of acpidump. This patch achieves this by turning all acpi_os_printf(stdout) into acpi_ut_file_printf(gbl_output_file). 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:
committed by
Rafael J. Wysocki
parent
dcaff16df2
commit
846d6ef4d7
@@ -195,12 +195,13 @@ ap_dump_table_buffer(struct acpi_table_header *table,
|
||||
* Note: simplest to just always emit a 64-bit address. acpi_xtract
|
||||
* utility can handle this.
|
||||
*/
|
||||
acpi_os_printf("%4.4s @ 0x%8.8X%8.8X\n", table->signature,
|
||||
ACPI_FORMAT_UINT64(address));
|
||||
acpi_ut_file_printf(gbl_output_file, "%4.4s @ 0x%8.8X%8.8X\n",
|
||||
table->signature, ACPI_FORMAT_UINT64(address));
|
||||
|
||||
acpi_ut_dump_buffer(ACPI_CAST_PTR(u8, table), table_length,
|
||||
DB_BYTE_DISPLAY, 0);
|
||||
acpi_os_printf("\n");
|
||||
acpi_ut_dump_buffer_to_file(gbl_output_file,
|
||||
ACPI_CAST_PTR(u8, table), table_length,
|
||||
DB_BYTE_DISPLAY, 0);
|
||||
acpi_ut_file_printf(gbl_output_file, "\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
int ap_open_output_file(char *pathname)
|
||||
{
|
||||
struct stat stat_info;
|
||||
FILE *file;
|
||||
ACPI_FILE file;
|
||||
|
||||
/* If file exists, prompt for overwrite */
|
||||
|
||||
@@ -74,9 +74,9 @@ int ap_open_output_file(char *pathname)
|
||||
|
||||
/* Point stdout to the file */
|
||||
|
||||
file = freopen(pathname, "w", stdout);
|
||||
file = acpi_os_open_file(pathname, ACPI_FILE_WRITING);
|
||||
if (!file) {
|
||||
perror("Could not open output file");
|
||||
acpi_log_error("Could not open output file: %s\n", pathname);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
@@ -300,6 +300,7 @@ int ACPI_SYSTEM_XFACE main(int argc, char *argv[])
|
||||
|
||||
ACPI_DEBUG_INITIALIZE(); /* For debug version only */
|
||||
acpi_os_initialize();
|
||||
gbl_output_file = ACPI_FILE_OUT;
|
||||
|
||||
/* Process command line options */
|
||||
|
||||
@@ -348,7 +349,7 @@ int ACPI_SYSTEM_XFACE main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (gbl_output_file) {
|
||||
if (gbl_output_filename) {
|
||||
if (gbl_verbose_mode) {
|
||||
|
||||
/* Summary for the output file */
|
||||
|
||||
Reference in New Issue
Block a user