ACPI_STATUS AcpiDbReadTableFromFile ( char *Filename, ACPI_TABLE_HEADER **Table) { FILE *fp; UINT32 TableLength; ACPI_STATUS Status; /* Open the file */ fp = fopen (Filename, "rb"); if (!fp) { AcpiOsPrintf ("Could not open input file %s\n", Filename); return (AE_ERROR); } /* Get the entire file */ fprintf (stderr, "Loading Acpi table from file %s\n", Filename); Status = AcpiDbReadTable (fp, Table, &TableLength); fclose(fp); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not get table from the file\n"); return (Status); } return (AE_OK); }
ACPI_STATUS AcpiDbReadTableFromFile ( char *Filename, ACPI_TABLE_HEADER **Table) { FILE *File; UINT32 FileSize; UINT32 TableLength; ACPI_STATUS Status = AE_ERROR; /* Open the file, get current size */ File = fopen (Filename, "rb"); if (!File) { perror ("Could not open input file"); return (Status); } FileSize = CmGetFileSize (File); if (FileSize == ACPI_UINT32_MAX) { goto Exit; } /* Get the entire file */ fprintf (stderr, "Loading Acpi table from file %10s - Length %.8u (%06X)\n", Filename, FileSize, FileSize); Status = AcpiDbReadTable (File, Table, &TableLength); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not get table from the file\n"); } Exit: fclose(File); return (Status); }