aboutsummaryrefslogtreecommitdiffstats
path: root/tools/power/acpi
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2014-07-07 22:07:52 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-08 08:22:27 -0400
commit846d6ef4d7f0fed114aa1284a245bb1aa96417df (patch)
tree887b128a2d222846a20416c0f94d7bc136536f02 /tools/power/acpi
parentdcaff16df2750a400db1983754542f2cc6bf4e93 (diff)
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>
Diffstat (limited to 'tools/power/acpi')
-rw-r--r--tools/power/acpi/tools/acpidump/apdump.c11
-rw-r--r--tools/power/acpi/tools/acpidump/apfiles.c6
-rw-r--r--tools/power/acpi/tools/acpidump/apmain.c3
3 files changed, 11 insertions, 9 deletions
diff --git a/tools/power/acpi/tools/acpidump/apdump.c b/tools/power/acpi/tools/acpidump/apdump.c
index 34fa5f25be39..53cee781e24e 100644
--- a/tools/power/acpi/tools/acpidump/apdump.c
+++ b/tools/power/acpi/tools/acpidump/apdump.c
@@ -195,12 +195,13 @@ ap_dump_table_buffer(struct acpi_table_header *table,
195 * Note: simplest to just always emit a 64-bit address. acpi_xtract 195 * Note: simplest to just always emit a 64-bit address. acpi_xtract
196 * utility can handle this. 196 * utility can handle this.
197 */ 197 */
198 acpi_os_printf("%4.4s @ 0x%8.8X%8.8X\n", table->signature, 198 acpi_ut_file_printf(gbl_output_file, "%4.4s @ 0x%8.8X%8.8X\n",
199 ACPI_FORMAT_UINT64(address)); 199 table->signature, ACPI_FORMAT_UINT64(address));
200 200
201 acpi_ut_dump_buffer(ACPI_CAST_PTR(u8, table), table_length, 201 acpi_ut_dump_buffer_to_file(gbl_output_file,
202 DB_BYTE_DISPLAY, 0); 202 ACPI_CAST_PTR(u8, table), table_length,
203 acpi_os_printf("\n"); 203 DB_BYTE_DISPLAY, 0);
204 acpi_ut_file_printf(gbl_output_file, "\n");
204 return (0); 205 return (0);
205} 206}
206 207
diff --git a/tools/power/acpi/tools/acpidump/apfiles.c b/tools/power/acpi/tools/acpidump/apfiles.c
index 5699ca1d0922..5781c13ae333 100644
--- a/tools/power/acpi/tools/acpidump/apfiles.c
+++ b/tools/power/acpi/tools/acpidump/apfiles.c
@@ -60,7 +60,7 @@
60int ap_open_output_file(char *pathname) 60int ap_open_output_file(char *pathname)
61{ 61{
62 struct stat stat_info; 62 struct stat stat_info;
63 FILE *file; 63 ACPI_FILE file;
64 64
65 /* If file exists, prompt for overwrite */ 65 /* If file exists, prompt for overwrite */
66 66
@@ -74,9 +74,9 @@ int ap_open_output_file(char *pathname)
74 74
75 /* Point stdout to the file */ 75 /* Point stdout to the file */
76 76
77 file = freopen(pathname, "w", stdout); 77 file = acpi_os_open_file(pathname, ACPI_FILE_WRITING);
78 if (!file) { 78 if (!file) {
79 perror("Could not open output file"); 79 acpi_log_error("Could not open output file: %s\n", pathname);
80 return (-1); 80 return (-1);
81 } 81 }
82 82
diff --git a/tools/power/acpi/tools/acpidump/apmain.c b/tools/power/acpi/tools/acpidump/apmain.c
index 63f7bc9fdf29..35bd6740306e 100644
--- a/tools/power/acpi/tools/acpidump/apmain.c
+++ b/tools/power/acpi/tools/acpidump/apmain.c
@@ -300,6 +300,7 @@ int ACPI_SYSTEM_XFACE main(int argc, char *argv[])
300 300
301 ACPI_DEBUG_INITIALIZE(); /* For debug version only */ 301 ACPI_DEBUG_INITIALIZE(); /* For debug version only */
302 acpi_os_initialize(); 302 acpi_os_initialize();
303 gbl_output_file = ACPI_FILE_OUT;
303 304
304 /* Process command line options */ 305 /* Process command line options */
305 306
@@ -348,7 +349,7 @@ int ACPI_SYSTEM_XFACE main(int argc, char *argv[])
348 } 349 }
349 } 350 }
350 351
351 if (gbl_output_file) { 352 if (gbl_output_filename) {
352 if (gbl_verbose_mode) { 353 if (gbl_verbose_mode) {
353 354
354 /* Summary for the output file */ 355 /* Summary for the output file */