summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2014-02-20 09:08:36 -0800
committerRobert Moore <Robert.Moore@intel.com>2014-02-20 09:08:36 -0800
commit70d2a6659594984dbc357c8ce15c48411fd25de8 (patch)
tree7ec58e7e77909bb2559020f9b59f44cfef54d169
parent8cd261550dad1951057ebf338ebcfde1d9d58612 (diff)
AcpiExec/Debugger: Deploy new get_file_size interface.
Add the new interface, cleanup error exit path. Also add call to "print table header" for debugger load command.
-rw-r--r--source/components/debugger/dbfileio.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c
index a0214523d..8b84f41f5 100644
--- a/source/components/debugger/dbfileio.c
+++ b/source/components/debugger/dbfileio.c
@@ -551,23 +551,23 @@ AcpiDbReadTableFromFile (
FILE *File;
UINT32 FileSize;
UINT32 TableLength;
- ACPI_STATUS Status;
+ ACPI_STATUS Status = AE_ERROR;
- /* Open the file */
+ /* Open the file, get current size */
File = fopen (Filename, "rb");
if (!File)
{
perror ("Could not open input file");
- return (AE_ERROR);
+ return (Status);
}
- /* Get the file size */
-
- fseek (File, 0, SEEK_END);
- FileSize = (UINT32) ftell (File);
- fseek (File, 0, SEEK_SET);
+ FileSize = CmGetFileSize (File);
+ if (FileSize == ACPI_UINT32_MAX)
+ {
+ goto Exit;
+ }
/* Get the entire file */
@@ -575,15 +575,14 @@ AcpiDbReadTableFromFile (
Filename, FileSize, FileSize);
Status = AcpiDbReadTable (File, Table, &TableLength);
- fclose(File);
-
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not get table from the file\n");
- return (Status);
}
- return (AE_OK);
+Exit:
+ fclose(File);
+ return (Status);
}
#endif
@@ -643,6 +642,8 @@ AcpiDbGetTableFromFile (
return (Status);
}
+ AcpiTbPrintTableHeader (0, Table);
+
fprintf (stderr,
"Acpi table [%4.4s] successfully installed and loaded\n",
Table->Signature);