summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-27 21:04:22 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-27 21:04:22 +0000
commit366f81a016c11a59669cdfb5adb714e6f036f65f (patch)
tree56cbfcdc181ac2114da4cbbb5ce43f6b42b34e47 /ShellPkg
parent92a5447eda1eea062a7ae6ffac1f8b7d8c9d9fc0 (diff)
Clarify that the shared variables of the shell protocols are properly named.
This removes the non-shared gEfiShellProtocol and gEfiShellParametersProtocol and renames the shared version to those names. This removes the m-versions of those protocol pointers. signed-off-by: jcarsey reviewed-by: darylm503 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11900 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Include/Library/ShellCommandLib.h2
-rw-r--r--ShellPkg/Include/Library/ShellLib.h4
-rw-r--r--ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c22
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/Bcfg.c2
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c6
-rw-r--r--ShellPkg/Library/UefiShellInstall1CommandsLib/Bcfg.c2
-rw-r--r--ShellPkg/Library/UefiShellLib/UefiShellLib.c118
7 files changed, 66 insertions, 90 deletions
diff --git a/ShellPkg/Include/Library/ShellCommandLib.h b/ShellPkg/Include/Library/ShellCommandLib.h
index 6edd36676..027c0caad 100644
--- a/ShellPkg/Include/Library/ShellCommandLib.h
+++ b/ShellPkg/Include/Library/ShellCommandLib.h
@@ -32,8 +32,6 @@
//
// The extern global protocol poionters.
//
-extern EFI_SHELL_PROTOCOL *gEfiShellProtocol;
-extern EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;
extern EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollation;
extern EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *gDevPathToText;
extern CONST CHAR16* SupportLevel[];
diff --git a/ShellPkg/Include/Library/ShellLib.h b/ShellPkg/Include/Library/ShellLib.h
index 12cae5afe..905a9d39e 100644
--- a/ShellPkg/Include/Library/ShellLib.h
+++ b/ShellPkg/Include/Library/ShellLib.h
@@ -27,8 +27,8 @@
// (20 * (6+5+2))+1) unicode characters from EFI FAT spec (doubled for bytes)
#define MAX_FILE_NAME_LEN 512
-extern EFI_SHELL_PARAMETERS_PROTOCOL *mEfiShellParametersProtocol;
-extern EFI_SHELL_PROTOCOL *mEfiShellProtocol;
+extern EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;
+extern EFI_SHELL_PROTOCOL *gEfiShellProtocol;
/**
This function will retrieve the information about the file for the handle
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
index b91ba27af..82a9e78ed 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
@@ -34,8 +34,6 @@ STATIC UINTN mBlkMaxCount = 0;
STATIC BUFFER_LIST mFileHandleList;
// global variables required by library class.
-EFI_SHELL_PROTOCOL *gEfiShellProtocol = NULL;
-EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol = NULL;
EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollation = NULL;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *gDevPathToText = NULL;
SHELL_MAP_LIST gShellMapList;
@@ -59,24 +57,6 @@ CommandInit(
)
{
EFI_STATUS Status;
- if (gEfiShellParametersProtocol == NULL) {
- Status = gBS->OpenProtocol(gImageHandle,
- &gEfiShellParametersProtocolGuid,
- (VOID **)&gEfiShellParametersProtocol,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR(Status)) {
- return (EFI_DEVICE_ERROR);
- }
- }
- if (gEfiShellProtocol == NULL) {
- Status = gBS->LocateProtocol(&gEfiShellProtocolGuid, NULL, (VOID**)&gEfiShellProtocol);
- if (EFI_ERROR(Status)) {
- return (EFI_DEVICE_ERROR);
- }
- }
if (gUnicodeCollation == NULL) {
Status = gBS->LocateProtocol(&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID**)&gUnicodeCollation);
if (EFI_ERROR(Status)) {
@@ -207,8 +187,6 @@ ShellCommandLibDestructor (
FreePool(mProfileList);
}
- gEfiShellProtocol = NULL;
- gEfiShellParametersProtocol = NULL;
gUnicodeCollation = NULL;
gDevPathToText = NULL;
gShellCurDir = NULL;
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Bcfg.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Bcfg.c
index c2b14d7ee..24926a8e9 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Bcfg.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Bcfg.c
@@ -287,7 +287,7 @@ BcfgAddDebug1(
//
// get the device path
//
- DevicePath = mEfiShellProtocol->GetDevicePathFromFilePath(Arg->FullName);
+ DevicePath = gEfiShellProtocol->GetDevicePathFromFilePath(Arg->FullName);
if (DevicePath == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE_DP), gShellDebug1HiiHandle, Arg->FullName);
ShellStatus = SHELL_UNSUPPORTED;
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c
index 580f4adc2..1c86f1df2 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dblk.c
@@ -179,16 +179,16 @@ ShellCommandRunDblk (
//
// do the work if we have a valid block identifier
//
- if (mEfiShellProtocol->GetDevicePathFromMap(BlockName) == NULL) {
+ if (gEfiShellProtocol->GetDevicePathFromMap(BlockName) == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, BlockName);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- DevPath = (EFI_DEVICE_PATH_PROTOCOL*)mEfiShellProtocol->GetDevicePathFromMap(BlockName);
+ DevPath = (EFI_DEVICE_PATH_PROTOCOL*)gEfiShellProtocol->GetDevicePathFromMap(BlockName);
if (gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, &DevPath, NULL) == EFI_NOT_FOUND) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_MAP_PROTOCOL), gShellDebug1HiiHandle, BlockName, L"BlockIo");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ShellStatus = DisplayTheBlocks(mEfiShellProtocol->GetDevicePathFromMap(BlockName), Lba, (UINT8)BlockCount);
+ ShellStatus = DisplayTheBlocks(gEfiShellProtocol->GetDevicePathFromMap(BlockName), Lba, (UINT8)BlockCount);
}
}
}
diff --git a/ShellPkg/Library/UefiShellInstall1CommandsLib/Bcfg.c b/ShellPkg/Library/UefiShellInstall1CommandsLib/Bcfg.c
index f7126e32b..78a4bd23d 100644
--- a/ShellPkg/Library/UefiShellInstall1CommandsLib/Bcfg.c
+++ b/ShellPkg/Library/UefiShellInstall1CommandsLib/Bcfg.c
@@ -287,7 +287,7 @@ BcfgAddInstall1(
//
// get the device path
//
- DevicePath = mEfiShellProtocol->GetDevicePathFromFilePath(Arg->FullName);
+ DevicePath = gEfiShellProtocol->GetDevicePathFromFilePath(Arg->FullName);
if (DevicePath == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE_DP), gShellInstall1HiiHandle, Arg->FullName);
ShellStatus = SHELL_UNSUPPORTED;
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index ecc3f83c6..fa86d72ce 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -30,8 +30,8 @@ SHELL_PARAM_ITEM SfoParamList[] = {
};
EFI_SHELL_ENVIRONMENT2 *mEfiShellEnvironment2;
EFI_SHELL_INTERFACE *mEfiShellInterface;
-EFI_SHELL_PROTOCOL *mEfiShellProtocol;
-EFI_SHELL_PARAMETERS_PROTOCOL *mEfiShellParametersProtocol;
+EFI_SHELL_PROTOCOL *gEfiShellProtocol;
+EFI_SHELL_PARAMETERS_PROTOCOL *gEfiShellParametersProtocol;
EFI_HANDLE mEfiShellEnvironment2Handle;
FILE_HANDLE_FUNCTION_MAP FileFunctionMap;
@@ -182,7 +182,7 @@ ShellLibConstructorWorker (
Status = gBS->OpenProtocol(
ImageHandle,
&gEfiShellProtocolGuid,
- (VOID **)&mEfiShellProtocol,
+ (VOID **)&gEfiShellProtocol,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -194,25 +194,25 @@ ShellLibConstructorWorker (
Status = gBS->LocateProtocol(
&gEfiShellProtocolGuid,
NULL,
- (VOID **)&mEfiShellProtocol
+ (VOID **)&gEfiShellProtocol
);
if (EFI_ERROR(Status)) {
- mEfiShellProtocol = NULL;
+ gEfiShellProtocol = NULL;
}
}
Status = gBS->OpenProtocol(
ImageHandle,
&gEfiShellParametersProtocolGuid,
- (VOID **)&mEfiShellParametersProtocol,
+ (VOID **)&gEfiShellParametersProtocol,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR(Status)) {
- mEfiShellParametersProtocol = NULL;
+ gEfiShellParametersProtocol = NULL;
}
- if (mEfiShellParametersProtocol == NULL || mEfiShellProtocol == NULL) {
+ if (gEfiShellParametersProtocol == NULL || gEfiShellProtocol == NULL) {
//
// Moved to seperate function due to complexity
//
@@ -238,18 +238,18 @@ ShellLibConstructorWorker (
// only success getting 2 of either the old or new, but no 1/2 and 1/2
//
if ((mEfiShellEnvironment2 != NULL && mEfiShellInterface != NULL) ||
- (mEfiShellProtocol != NULL && mEfiShellParametersProtocol != NULL) ) {
- if (mEfiShellProtocol != NULL) {
- FileFunctionMap.GetFileInfo = mEfiShellProtocol->GetFileInfo;
- FileFunctionMap.SetFileInfo = mEfiShellProtocol->SetFileInfo;
- FileFunctionMap.ReadFile = mEfiShellProtocol->ReadFile;
- FileFunctionMap.WriteFile = mEfiShellProtocol->WriteFile;
- FileFunctionMap.CloseFile = mEfiShellProtocol->CloseFile;
- FileFunctionMap.DeleteFile = mEfiShellProtocol->DeleteFile;
- FileFunctionMap.GetFilePosition = mEfiShellProtocol->GetFilePosition;
- FileFunctionMap.SetFilePosition = mEfiShellProtocol->SetFilePosition;
- FileFunctionMap.FlushFile = mEfiShellProtocol->FlushFile;
- FileFunctionMap.GetFileSize = mEfiShellProtocol->GetFileSize;
+ (gEfiShellProtocol != NULL && gEfiShellParametersProtocol != NULL) ) {
+ if (gEfiShellProtocol != NULL) {
+ FileFunctionMap.GetFileInfo = gEfiShellProtocol->GetFileInfo;
+ FileFunctionMap.SetFileInfo = gEfiShellProtocol->SetFileInfo;
+ FileFunctionMap.ReadFile = gEfiShellProtocol->ReadFile;
+ FileFunctionMap.WriteFile = gEfiShellProtocol->WriteFile;
+ FileFunctionMap.CloseFile = gEfiShellProtocol->CloseFile;
+ FileFunctionMap.DeleteFile = gEfiShellProtocol->DeleteFile;
+ FileFunctionMap.GetFilePosition = gEfiShellProtocol->GetFilePosition;
+ FileFunctionMap.SetFilePosition = gEfiShellProtocol->SetFilePosition;
+ FileFunctionMap.FlushFile = gEfiShellProtocol->FlushFile;
+ FileFunctionMap.GetFileSize = gEfiShellProtocol->GetFileSize;
} else {
FileFunctionMap.GetFileInfo = (EFI_SHELL_GET_FILE_INFO)FileHandleGetInfo;
FileFunctionMap.SetFileInfo = (EFI_SHELL_SET_FILE_INFO)FileHandleSetInfo;
@@ -285,8 +285,8 @@ ShellLibConstructor (
)
{
mEfiShellEnvironment2 = NULL;
- mEfiShellProtocol = NULL;
- mEfiShellParametersProtocol = NULL;
+ gEfiShellProtocol = NULL;
+ gEfiShellParametersProtocol = NULL;
mEfiShellInterface = NULL;
mEfiShellEnvironment2Handle = NULL;
@@ -330,19 +330,19 @@ ShellLibDestructor (
NULL);
mEfiShellInterface = NULL;
}
- if (mEfiShellProtocol != NULL) {
+ if (gEfiShellProtocol != NULL) {
gBS->CloseProtocol(ImageHandle,
&gEfiShellProtocolGuid,
ImageHandle,
NULL);
- mEfiShellProtocol = NULL;
+ gEfiShellProtocol = NULL;
}
- if (mEfiShellParametersProtocol != NULL) {
+ if (gEfiShellParametersProtocol != NULL) {
gBS->CloseProtocol(ImageHandle,
&gEfiShellParametersProtocolGuid,
ImageHandle,
NULL);
- mEfiShellParametersProtocol = NULL;
+ gEfiShellParametersProtocol = NULL;
}
mEfiShellEnvironment2Handle = NULL;
@@ -490,11 +490,11 @@ ShellOpenFileByDevicePath(
//
// which shell interface should we use
//
- if (mEfiShellProtocol != NULL) {
+ if (gEfiShellProtocol != NULL) {
//
// use UEFI Shell 2.0 method.
//
- FileName = mEfiShellProtocol->GetFilePathFromDevicePath(*FilePath);
+ FileName = gEfiShellProtocol->GetFilePathFromDevicePath(*FilePath);
if (FileName == NULL) {
return (EFI_INVALID_PARAMETER);
}
@@ -646,14 +646,14 @@ ShellOpenFileByName(
return (EFI_INVALID_PARAMETER);
}
- if (mEfiShellProtocol != NULL) {
+ if (gEfiShellProtocol != NULL) {
if ((OpenMode & EFI_FILE_MODE_CREATE) == EFI_FILE_MODE_CREATE && (Attributes & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY) {
return ShellCreateDirectory(FileName, FileHandle);
}
//
// Use UEFI Shell 2.0 method
//
- Status = mEfiShellProtocol->OpenFileByName(FileName,
+ Status = gEfiShellProtocol->OpenFileByName(FileName,
FileHandle,
OpenMode);
if (StrCmp(FileName, L"NUL") != 0 && !EFI_ERROR(Status) && ((OpenMode & EFI_FILE_MODE_CREATE) != 0)){
@@ -716,11 +716,11 @@ ShellCreateDirectory(
OUT SHELL_FILE_HANDLE *FileHandle
)
{
- if (mEfiShellProtocol != NULL) {
+ if (gEfiShellProtocol != NULL) {
//
// Use UEFI Shell 2.0 method
//
- return (mEfiShellProtocol->CreateFile(DirectoryName,
+ return (gEfiShellProtocol->CreateFile(DirectoryName,
EFI_FILE_DIRECTORY,
FileHandle
));
@@ -1031,12 +1031,12 @@ ShellGetExecutionBreakFlag(
//
// Check for UEFI Shell 2.0 protocols
//
- if (mEfiShellProtocol != NULL) {
+ if (gEfiShellProtocol != NULL) {
//
// We are using UEFI Shell 2.0; see if the event has been triggered
//
- if (gBS->CheckEvent(mEfiShellProtocol->ExecutionBreak) != EFI_SUCCESS) {
+ if (gBS->CheckEvent(gEfiShellProtocol->ExecutionBreak) != EFI_SUCCESS) {
return (FALSE);
}
return (TRUE);
@@ -1071,8 +1071,8 @@ ShellGetEnvironmentVariable (
//
// Check for UEFI Shell 2.0 protocols
//
- if (mEfiShellProtocol != NULL) {
- return (mEfiShellProtocol->GetEnv(EnvKey));
+ if (gEfiShellProtocol != NULL) {
+ return (gEfiShellProtocol->GetEnv(EnvKey));
}
//
@@ -1115,8 +1115,8 @@ ShellSetEnvironmentVariable (
//
// Check for UEFI Shell 2.0 protocols
//
- if (mEfiShellProtocol != NULL) {
- return (mEfiShellProtocol->SetEnv(EnvKey, EnvVal, Volatile));
+ if (gEfiShellProtocol != NULL) {
+ return (gEfiShellProtocol->SetEnv(EnvKey, EnvVal, Volatile));
}
//
@@ -1168,11 +1168,11 @@ ShellExecute (
//
// Check for UEFI Shell 2.0 protocols
//
- if (mEfiShellProtocol != NULL) {
+ if (gEfiShellProtocol != NULL) {
//
// Call UEFI Shell 2.0 version (not using Output parameter)
//
- return (mEfiShellProtocol->Execute(ParentHandle,
+ return (gEfiShellProtocol->Execute(ParentHandle,
CommandLine,
EnvironmentVariables,
Status));
@@ -1214,8 +1214,8 @@ ShellGetCurrentDir (
//
// Check for UEFI Shell 2.0 protocols
//
- if (mEfiShellProtocol != NULL) {
- return (mEfiShellProtocol->GetCurDir(DeviceName));
+ if (gEfiShellProtocol != NULL) {
+ return (gEfiShellProtocol->GetCurDir(DeviceName));
}
//
@@ -1248,11 +1248,11 @@ ShellSetPageBreakMode (
//
// check for UEFI Shell 2.0
//
- if (mEfiShellProtocol != NULL) {
+ if (gEfiShellProtocol != NULL) {
//
// Enable with UEFI 2.0 Shell
//
- mEfiShellProtocol->EnablePageBreak();
+ gEfiShellProtocol->EnablePageBreak();
return;
} else {
//
@@ -1270,11 +1270,11 @@ ShellSetPageBreakMode (
//
// check for UEFI Shell 2.0
//
- if (mEfiShellProtocol != NULL) {
+ if (gEfiShellProtocol != NULL) {
//
// Disable with UEFI 2.0 Shell
//
- mEfiShellProtocol->DisablePageBreak();
+ gEfiShellProtocol->DisablePageBreak();
return;
} else {
//
@@ -1445,7 +1445,7 @@ ShellOpenFileMetaArg (
//
// Check for UEFI Shell 2.0 protocols
//
- if (mEfiShellProtocol != NULL) {
+ if (gEfiShellProtocol != NULL) {
if (*ListHead == NULL) {
*ListHead = (EFI_SHELL_FILE_INFO*)AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO));
if (*ListHead == NULL) {
@@ -1453,13 +1453,13 @@ ShellOpenFileMetaArg (
}
InitializeListHead(&((*ListHead)->Link));
}
- Status = mEfiShellProtocol->OpenFileList(Arg,
+ Status = gEfiShellProtocol->OpenFileList(Arg,
OpenMode,
ListHead);
if (EFI_ERROR(Status)) {
- mEfiShellProtocol->RemoveDupInFileList(ListHead);
+ gEfiShellProtocol->RemoveDupInFileList(ListHead);
} else {
- Status = mEfiShellProtocol->RemoveDupInFileList(ListHead);
+ Status = gEfiShellProtocol->RemoveDupInFileList(ListHead);
}
if (*ListHead != NULL && IsListEmpty(&(*ListHead)->Link)) {
FreePool(*ListHead);
@@ -1540,8 +1540,8 @@ ShellCloseFileMetaArg (
//
// Check for UEFI Shell 2.0 protocols
//
- if (mEfiShellProtocol != NULL) {
- return (mEfiShellProtocol->FreeFileList(ListHead));
+ if (gEfiShellProtocol != NULL) {
+ return (gEfiShellProtocol->FreeFileList(ListHead));
} else if (mEfiShellEnvironment2 != NULL) {
//
// Since this is EFI Shell version we need to free our internally made copy
@@ -2099,13 +2099,13 @@ ShellCommandLineParseEx (
//
// Check for UEFI Shell 2.0 protocols
//
- if (mEfiShellParametersProtocol != NULL) {
+ if (gEfiShellParametersProtocol != NULL) {
return (InternalCommandLineParse(CheckList,
CheckPackage,
ProblemParam,
AutoPageBreak,
- (CONST CHAR16**) mEfiShellParametersProtocol->Argv,
- mEfiShellParametersProtocol->Argc,
+ (CONST CHAR16**) gEfiShellParametersProtocol->Argv,
+ gEfiShellParametersProtocol->Argc,
AlwaysAllowNumbers));
}
@@ -2557,8 +2557,8 @@ InternalPrintTo (
if (Size == 0) {
return (EFI_SUCCESS);
}
- if (mEfiShellParametersProtocol != NULL) {
- return (mEfiShellProtocol->WriteFile(mEfiShellParametersProtocol->StdOut, &Size, (VOID*)String));
+ if (gEfiShellParametersProtocol != NULL) {
+ return (gEfiShellProtocol->WriteFile(gEfiShellParametersProtocol->StdOut, &Size, (VOID*)String));
}
if (mEfiShellInterface != NULL) {
//
@@ -2859,13 +2859,13 @@ ShellIsDirectory(
//
// try good logic first.
//
- if (mEfiShellProtocol != NULL) {
+ if (gEfiShellProtocol != NULL) {
TempLocation = StrnCatGrow(&TempLocation, NULL, DirName, 0);
TempLocation2 = StrStr(TempLocation, L":");
if (TempLocation2 != NULL && StrLen(StrStr(TempLocation, L":")) == 2) {
*(TempLocation2+1) = CHAR_NULL;
}
- if (mEfiShellProtocol->GetDevicePathFromMap(TempLocation) != NULL) {
+ if (gEfiShellProtocol->GetDevicePathFromMap(TempLocation) != NULL) {
FreePool(TempLocation);
return (EFI_SUCCESS);
}