ShellPkg/dmpstore: Support "-sfo"

The patch adds the "-sfo" support to "dmpstore" command.

When -l or -d is specified, -sfo is not supported.

When the variable specified by name and GUID cannot be found,
an error message is displayed; Otherwise, the SFO is displayed.
E.g.: "dmpstore -guid GuidThatDoesntExist -sfo" produces output
as:
ShellCommand,"dmpstore"
VariableInfo,"","GuidThatDoesntExist","","",""

"dmpstore NameThatDoesntExist -guid GuidThatDoesntExist -sfo"
produces output as:
ShellCommand,"dmpstore"
dmpstore: No matching variables found. Guid GuidThatDoesntExist, Name
NameThatDoesntExist

The difference between the above 2 cases is that former one only
specifies the GUID, but the latter one specifies both name and GUID.
Since not specifying GUID means to use GlobalVariableGuid,
"dmpstore NameThatDoesntExist -sfo" produces the similar output as
latter one.
I personally prefer to always produce SFO output for both cases.
But the above behavior is the discussion result between HPE engineers.

Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
This commit is contained in:
Ruiyu Ni
2016-11-11 12:12:51 +08:00
parent 86a1eca210
commit e9597b4519
2 changed files with 154 additions and 61 deletions

View File

@ -407,9 +407,14 @@
#string STR_DMPSTORE_HEADER_LINE #language en-US "Variable %H%s%N '%H%g%N:%H%s%N' DataSize = 0x%02x\r\n"
#string STR_DMPSTORE_DELETE_LINE #language en-US "Delete variable '%H%g%N:%H%s%N': %r\r\n"
#string STR_DMPSTORE_NO_VAR_FOUND #language en-US "%H%s%N: No matching variables found.\r\n"
#string STR_DMPSTORE_NO_VAR_FOUND_SFO #language en-US "VariableInfo,\"\",\"\",\"\",\"\",\"\"\r\n"
#string STR_DMPSTORE_NO_VAR_FOUND_GN #language en-US "%H%s%N: No matching variables found. Guid %g, Name %s\r\n"
#string STR_DMPSTORE_NO_VAR_FOUND_NG_SFO #language en-US "VariableInfo,\"%s\",\"%g\",\"\",\"\",\"\"\r\n"
#string STR_DMPSTORE_NO_VAR_FOUND_N #language en-US "%H%s%N: No matching variables found. Name %s\r\n"
#string STR_DMPSTORE_NO_VAR_FOUND_N_SFO #language en-US #language en-US "VariableInfo,\"%s\",\"\",\"\",\"\",\"\"\r\n"
#string STR_DMPSTORE_NO_VAR_FOUND_G #language en-US "%H%s%N: No matching variables found. Guid %g\r\n"
#string STR_DMPSTORE_NO_VAR_FOUND_G_SFO #language en-US "VariableInfo,\"\",\"%g\",\"\",\"\",\"\"\r\n"
#string STR_DMPSTORE_VAR_SFO #language en-US "VariableInfo,\"%s\",\"%g\",\"0x%x\",\"0x%x\",\"%s\"\r\n"
#string STR_GET_HELP_COMP #language en-US ""
".TH comp 0 "Compare 2 files"\r\n"
@ -1015,7 +1020,7 @@
"Manages all UEFI variables.\r\n"
".SH SYNOPSIS\r\n"
" \r\n"
"DMPSTORE [-b] [-d] [-all | ([variable] [-guid guid])]\r\n"
"DMPSTORE [-b] [-d] [-all | ([variable] [-guid guid])] [-sfo]\r\n"
"DMPSTORE [-all | ([variable] [-guid guid])] [-s file]\r\n"
"DMPSTORE [-all | ([variable] [-guid guid])] [-l file]\r\n"
".SH OPTIONS\r\n"
@ -1024,6 +1029,7 @@
" -guid - Specifies the GUID of the variables to be displayed in\r\n"
" standard text format. If not specified and -all is not\r\n"
" specified, the EFI_GLOBAL_VARIABLE GUID is assumed.\r\n"
" -sfo - Displays information as described in Standard-Format Output.\r\n"
" -all - Dumps all variables, including those\r\n"
" with a different GUID than EFI_GLOBAL_VARIABLE.\r\n"
" -d - Delete variables.\r\n"