UEFI Shell spec defines Shell Dynamic Command protocol which is just
for the purpose to extend internal command.
So tftp command is changed from NULL class library to be a driver
producing DynamicCommand protocol.
The guideline is:
1. Only use NULL class library for Shell spec defined commands.
2. New commands can be provided as not only a standalone application
but also a dynamic command. So it can be used either as an
internal command, but also as a standalone application.
TftpApp.inf is to provide a standalone application.
TftpDynamicCommand.inf is to provide a standalone driver producing
Dynamic Command protocol.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni
Cc: Jaben Carsey
Cc: Michael D Kinney
---
.../TftpDynamicCommand}/Tftp.c | 92 +++
.../TftpDynamicCommand/Tftp.h} | 40 +--
.../TftpDynamicCommand/Tftp.uni} | 0
.../DynamicCommand/TftpDynamicCommand/TftpApp.c| 54 +
.../TftpDynamicCommand/TftpApp.inf}| 34 +++---
.../TftpDynamicCommand/TftpDynamicCommand.c| 131 +
.../TftpDynamicCommand/TftpDynamicCommand.inf} | 39 +++---
.../UefiShellTftpCommandLib.c | 97 ---
ShellPkg/ShellPkg.dsc | 11 +-
9 files changed, 325 insertions(+), 173 deletions(-)
rename ShellPkg/{Library/UefiShellTftpCommandLib =>
DynamicCommand/TftpDynamicCommand}/Tftp.c (91%)
mode change 100755 => 100644
rename ShellPkg/{Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.h =>
DynamicCommand/TftpDynamicCommand/Tftp.h} (56%)
rename ShellPkg/{Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.uni
=> DynamicCommand/TftpDynamicCommand/Tftp.uni} (100%)
create mode 100644 ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c
copy ShellPkg/{Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf =>
DynamicCommand/TftpDynamicCommand/TftpApp.inf} (59%)
create mode 100644
ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c
rename ShellPkg/{Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
=> DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf} (55%)
delete mode 100644
ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.c
diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
old mode 100755
new mode 100644
similarity index 91%
rename from ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
rename to ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
index fbde3bfe60..8569c966dd
--- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
+++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c
@@ -2,7 +2,7 @@
The implementation for the 'tftp' Shell command.
Copyright (c) 2015, ARM Ltd. All rights reserved.
- Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
This program and the accompanying materials
@@ -14,9 +14,10 @@
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
-#include "UefiShellTftpCommandLib.h"
+#include "Tftp.h"
#define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH 32
+EFI_HANDLE mTftpHiiHandle;
/*
Constant strings and definitions related to the message indicating the
amount of
@@ -256,8 +257,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
**/
SHELL_STATUS
-EFIAPI
-ShellCommandRunTftp (
+RunTftp (
IN EFI_HANDLEImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
@@ -315,7 +315,7 @@ ShellCommandRunTftp (
if ((Status == EFI_VOLUME_CORRUPTED) &&
(ProblemParam != NULL) ) {
ShellPrintHiiEx (
--1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellTftpHiiHandle,
+-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), mTftpHiiHandle,
L"tftp", ProblemParam
);
FreePool (ProblemParam);
@@ -332,14 +332,14 @@ ShellCommandRunTftp (
if (ParamCount > 4) {
ShellPrintHiiEx (
-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY),
- gShellTftpHiiHandle, L"tftp"
+ mTftpHiiHandle, L"tftp"
);
goto Error;
}
if (ParamCount < 3) {
ShellPrintHiiEx (
-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW),
- gShellTftpHiiHandle, L"tftp"
+ mTftpHiiHandle, L"tftp"
);
goto Error;
}
@@ -354,7 +354,7 @@ ShellCommandRunTftp (
if (EFI_ERROR (Status)) {
ShellPrintHiiEx (
-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV),
- gShellTftpHiiHandle, L"tftp", ValueStr
+ mTftpHiiHandle, L"tftp", ValueStr
);
goto Error;
}
@@ -416,7 +416,7 @@ ShellCommandRunTftp (
if (Mtftp4ConfigData.TimeoutValue == 0) {
ShellPrintHiiEx (
-1, -1, NULL, STRING_TOKEN