From nobody Tue Apr 23 16:05:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1533793351233742.1690254904069; Wed, 8 Aug 2018 22:42:31 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E59C5210E38C0; Wed, 8 Aug 2018 22:42:29 -0700 (PDT) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EAA08210E2A5C for ; Wed, 8 Aug 2018 22:42:28 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Aug 2018 22:42:28 -0700 Received: from shenglei-dev.ccr.corp.intel.com ([10.239.158.52]) by fmsmga001.fm.intel.com with ESMTP; 08 Aug 2018 22:42:03 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=shenglei.zhang@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,213,1531810800"; d="scan'208";a="79806974" From: shenglei To: edk2-devel@lists.01.org Date: Thu, 9 Aug 2018 13:41:55 +0800 Message-Id: <20180809054155.30244-1-shenglei.zhang@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 Subject: [edk2] [PATCH] ShellPkg Shell: Remove redundant functions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jaben Carsey , Ruiyu Ni MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RDMRC_1 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The redundant functions which are never called have been removed. They are InternalShellProtocolDebugPrintMessage, UpdateFileName,RemoveFileTag and IsValidCommandName. https://bugzilla.tianocore.org/show_bug.cgi?id=3D1066 Cc: Jaben Carsey Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: shenglei Reviewed-by: Jaben Carsey --- ShellPkg/Application/Shell/Shell.c | 29 ------- ShellPkg/Application/Shell/Shell.h | 13 --- .../Shell/ShellParametersProtocol.c | 24 ------ ShellPkg/Application/Shell/ShellProtocol.c | 81 +------------------ 4 files changed, 1 insertion(+), 146 deletions(-) diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shel= l/Shell.c index 47ae3c373c..397cfd1994 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -2752,35 +2752,6 @@ RunCommand( =20 =20 STATIC CONST UINT16 InvalidChars[] =3D {L'*', L'?', L'<', L'>', L'\\', L'/= ', L'\"', 0x0001, 0x0002}; -/** - Function determines if the CommandName COULD be a valid command. It doe= s not determine whether - this is a valid command. It only checks for invalid characters. - - @param[in] CommandName The name to check - - @retval TRUE CommandName could be a command name - @retval FALSE CommandName could not be a valid command name -**/ -BOOLEAN -IsValidCommandName( - IN CONST CHAR16 *CommandName - ) -{ - UINTN Count; - if (CommandName =3D=3D NULL) { - ASSERT(FALSE); - return (FALSE); - } - for ( Count =3D 0 - ; Count < sizeof(InvalidChars) / sizeof(InvalidChars[0]) - ; Count++ - ){ - if (ScanMem16(CommandName, StrSize(CommandName), InvalidChars[Count]) = !=3D NULL) { - return (FALSE); - } - } - return (TRUE); -} =20 /** Function to process a NSH script file via SHELL_FILE_HANDLE. diff --git a/ShellPkg/Application/Shell/Shell.h b/ShellPkg/Application/Shel= l/Shell.h index 69b19c6a2d..bad8f08d47 100644 --- a/ShellPkg/Application/Shell/Shell.h +++ b/ShellPkg/Application/Shell/Shell.h @@ -309,19 +309,6 @@ RunShellCommand( OUT EFI_STATUS *CommandStatus ); =20 -/** - Function determines if the CommandName COULD be a valid command. It doe= s not determine whether - this is a valid command. It only checks for invalid characters. - - @param[in] CommandName The name to check - - @retval TRUE CommandName could be a command name - @retval FALSE CommandName could not be a valid command name -**/ -BOOLEAN -IsValidCommandName( - IN CONST CHAR16 *CommandName - ); =20 /** Function to process a NSH script file via SHELL_FILE_HANDLE. diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c b/ShellPk= g/Application/Shell/ShellParametersProtocol.c index 90889a3725..a21c690518 100644 --- a/ShellPkg/Application/Shell/ShellParametersProtocol.c +++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c @@ -626,30 +626,6 @@ FixVarName ( return (FixFileName(Copy)); } =20 -/** - Remove the unicode file tag from the begining of the file buffer since t= hat will not be - used by StdIn. - - @param[in] Handle Pointer to the handle of the file to be processed. - - @retval EFI_SUCCESS The unicode file tag has been moved successfully. -**/ -EFI_STATUS -RemoveFileTag( - IN SHELL_FILE_HANDLE *Handle - ) -{ - UINTN CharSize; - CHAR16 CharBuffer; - - CharSize =3D sizeof(CHAR16); - CharBuffer =3D 0; - gEfiShellProtocol->ReadFile(*Handle, &CharSize, &CharBuffer); - if (CharBuffer !=3D gUnicodeFileTag) { - gEfiShellProtocol->SetFilePosition(*Handle, 0); - } - return (EFI_SUCCESS); -} =20 /** Write the unicode file tag to the specified file. diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Applicat= ion/Shell/ShellProtocol.c index f2ca2029e3..8cf924b384 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -98,40 +98,6 @@ InternalShellProtocolIsSimpleFileSystemPresent( return (FALSE); } =20 -/** - Internal worker debug helper function to print out maps as they are adde= d. - - @param[in] Mapping string mapping that has been added - @param[in] DevicePath pointer to device path that has been mapped. - - @retval EFI_SUCCESS the operation was successful. - @return other an error ocurred - - @sa LocateHandle - @sa OpenProtocol -**/ -EFI_STATUS -InternalShellProtocolDebugPrintMessage ( - IN CONST CHAR16 *Mapping, - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_STATUS Status; - CHAR16 *Temp; - - Status =3D EFI_SUCCESS; - DEBUG_CODE_BEGIN(); - - if (Mapping !=3D NULL) { - DEBUG((EFI_D_INFO, "Added new map item:\"%S\"\r\n", Mapping)); - } - Temp =3D ConvertDevicePathToText(DevicePath, TRUE, TRUE); - DEBUG((EFI_D_INFO, "DevicePath: %S\r\n", Temp)); - FreePool(Temp); - - DEBUG_CODE_END(); - return (Status); -} =20 /** This function creates a mapping for a device path. @@ -1333,7 +1299,7 @@ EfiShellOpenFileByName( // We are opening a regular file. // DevicePath =3D EfiShellGetDevicePathFromFilePath(FileName); -// DEBUG_CODE(InternalShellProtocolDebugPrintMessage (NULL, DevicePath);); + if (DevicePath =3D=3D NULL) { return (EFI_NOT_FOUND); } @@ -2261,52 +2227,7 @@ EfiShellGetGuidName( return (EFI_SUCCESS); } =20 -/** - Updates a file name to be preceeded by the mapped drive name - - @param[in] BasePath the Mapped drive name to prepend - @param[in, out] Path pointer to pointer to the file name to update. - - @retval EFI_SUCCESS - @retval EFI_OUT_OF_RESOURCES -**/ -EFI_STATUS -UpdateFileName( - IN CONST CHAR16 *BasePath, - IN OUT CHAR16 **Path - ) -{ - CHAR16 *Path2; - UINTN Path2Size; - - Path2Size =3D 0; - Path2 =3D NULL; - - ASSERT(Path !=3D NULL); - ASSERT(*Path !=3D NULL); - ASSERT(BasePath !=3D NULL); - - // - // convert a local path to an absolute path - // - if (StrStr(*Path, L":") =3D=3D NULL) { - ASSERT((Path2 =3D=3D NULL && Path2Size =3D=3D 0) || (Path2 !=3D NULL)); - StrnCatGrow(&Path2, &Path2Size, BasePath, 0); - if (Path2 =3D=3D NULL) { - return (EFI_OUT_OF_RESOURCES); - } - ASSERT((Path2 =3D=3D NULL && Path2Size =3D=3D 0) || (Path2 !=3D NULL)); - StrnCatGrow(&Path2, &Path2Size, (*Path)[0] =3D=3D L'\\'?(*Path) + 1 :*= Path, 0); - if (Path2 =3D=3D NULL) { - return (EFI_OUT_OF_RESOURCES); - } - } - - FreePool(*Path); - (*Path) =3D Path2; =20 - return (EFI_SUCCESS); -} =20 /** If FileHandle is a directory then the function reads from FileHandle and= reads in --=20 2.18.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel