summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
diff options
context:
space:
mode:
authorTomas Pilar <Tomas.Pilar@arm.com>2020-06-19 12:59:54 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-06-30 01:39:50 +0000
commitd45cf5ffdf65f6bfdde64886746d81a69ae31bf4 (patch)
tree56d925178f574d07d7d22c2da924ebae22198e6f /ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
parent422fe85cc3109684c81990911c79dc18d1828d96 (diff)
downloadedk2-d45cf5ffdf65f6bfdde64886746d81a69ae31bf4.zip
edk2-d45cf5ffdf65f6bfdde64886746d81a69ae31bf4.tar.gz
edk2-d45cf5ffdf65f6bfdde64886746d81a69ae31bf4.tar.bz2
ShellPkg/AcpiView: Refactor DumpAcpiTableToFile
Method is refactored into two parts. A new method is created that dumps arbitrary buffers into a newly created file. This method is called from core code after the core code determined the appropriate filename to be used. This improves the modular design. Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Tomas Pilar <tomas.pilar@arm.com>
Diffstat (limited to 'ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c')
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
index e524fcb..d2240b2 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
@@ -27,8 +27,6 @@
#include "Arm/SbbrValidator.h"
#endif
-EFI_HII_HANDLE gShellAcpiViewHiiHandle = NULL;
-
STATIC UINT32 mTableCount;
STATIC UINT32 mBinTableCount;
@@ -48,14 +46,10 @@ DumpAcpiTableToFile (
IN CONST UINTN Length
)
{
- EFI_STATUS Status;
CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
- SHELL_FILE_HANDLE DumpFileHandle;
UINTN TransferBytes;
SELECTED_ACPI_TABLE *SelectedTable;
- DumpFileHandle = NULL;
- TransferBytes = Length;
GetSelectedAcpiTable (&SelectedTable);
UnicodeSPrint (
@@ -66,39 +60,9 @@ DumpAcpiTableToFile (
mBinTableCount++
);
- Status = ShellOpenFileByName (
- FileNameBuffer,
- &DumpFileHandle,
- EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE,
- 0
- );
- if (EFI_ERROR (Status)) {
- ShellPrintHiiEx (
- -1,
- -1,
- NULL,
- STRING_TOKEN (STR_GEN_READONLY_MEDIA),
- gShellAcpiViewHiiHandle,
- L"acpiview"
- );
- return FALSE;
- }
-
Print (L"Dumping ACPI table to : %s ... ", FileNameBuffer);
- Status = ShellWriteFile (
- DumpFileHandle,
- &TransferBytes,
- (VOID*)Ptr
- );
- if (EFI_ERROR (Status)) {
- Print (L"ERROR: Failed to dump table to binary file.\n");
- TransferBytes = 0;
- } else {
- Print (L"DONE.\n");
- }
-
- ShellCloseFile (&DumpFileHandle);
+ TransferBytes = ShellDumpBufferToFile (FileNameBuffer, Ptr, Length);
return (Length == TransferBytes);
}