From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 37977210E3DE5 for ; Thu, 9 Aug 2018 08:34:39 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2018 08:34:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,215,1531810800"; d="scan'208";a="61171208" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga007.fm.intel.com with ESMTP; 09 Aug 2018 08:34:17 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 9 Aug 2018 08:34:17 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.126]) by FMSMSX114.amr.corp.intel.com ([10.18.116.8]) with mapi id 14.03.0319.002; Thu, 9 Aug 2018 08:34:17 -0700 From: "Carsey, Jaben" To: "Zhang, Shenglei" , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" Thread-Topic: [PATCH] ShellPkg Shell: Remove redundant functions Thread-Index: AQHUL6PDHSuLH0hLIUSblZ2NKHJxiKS3jY8Q Date: Thu, 9 Aug 2018 15:34:17 +0000 Message-ID: References: <20180809054155.30244-1-shenglei.zhang@intel.com> In-Reply-To: <20180809054155.30244-1-shenglei.zhang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzk4YjFjMmItNDI3Zi00N2RiLThlMjUtNDFlYTI3YzlhMGUwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoidnI4OUxTYmo5Q1g3K0tndXgrUlpsNk1kTU4yaGlTNVBjZ3A3czFuaVIxTERpeXdGQ3l4MXMwbWlkTFZSdE1sRiJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Thu, 09 Aug 2018 15:34:40 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey > -----Original Message----- > From: Zhang, Shenglei > Sent: Wednesday, August 08, 2018 10:42 PM > To: edk2-devel@lists.01.org > Cc: Carsey, Jaben ; Ni, Ruiyu > Subject: [PATCH] ShellPkg Shell: Remove redundant functions > Importance: High >=20 > 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 >=20 > Cc: Jaben Carsey > Cc: Ruiyu Ni > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: shenglei > --- > 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(-) >=20 > diff --git a/ShellPkg/Application/Shell/Shell.c > b/ShellPkg/Application/Shell/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 > does 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 nam= e > -**/ > -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/Shell/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 > does 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 nam= e > -**/ > -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/ShellPkg/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= that > will not be > - used by StdIn. > - > - @param[in] Handle Pointer to the handle of the file to be processe= d. > - > - @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/Application/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 ad= ded. > - > - @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 a= nd > reads in > -- > 2.18.0.windows.1