From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c0b::235; helo=mail-it0-x235.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it0-x235.google.com (mail-it0-x235.google.com [IPv6:2607:f8b0:4001:c0b::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D2A0721122924 for ; Thu, 6 Sep 2018 03:28:28 -0700 (PDT) Received: by mail-it0-x235.google.com with SMTP id j198-v6so19381148ita.0 for ; Thu, 06 Sep 2018 03:28:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=lezo30jWCEh48XRouhjdN8CT+tCyBss0CikbETBZVLI=; b=R8lX8M5V/l0rwgWFE3oY8oB4XpMAwyRqEcUDqJKDcHMt9YCD+wsCQ0jRyJj9g6JQmL xLMBSjKd2ySGcVFzRJma8i5GViKPDj7obVYUZ9872NEgxGfnQUQeWMNX2X9WLBlHQ2KF lPby1AR11bIQAQMIbbUiW05sPNd/0fh4YVSlg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=lezo30jWCEh48XRouhjdN8CT+tCyBss0CikbETBZVLI=; b=WAaD4B6URbzW/Q+yL/n3/FsSiTXKOuwjZt6t1qu42spOUxD8rGeZuhqR85ggRC9KGn acNMQXVb9CFa5SUDFGBQWdd3RS02+Dwsq9usQBUmln8z/qPOlHB84SKtSNbwyztxLym0 j8vSuqDqaAqALOCli3Fl9i2uLa6YeVAHiaLq7ApcTDhantQQcui+EwAfogIlfPh7lYoL 93DRw62BB1Yb90aA8CTgrNzRX3XPzpvVAf8lLBgMlRpbDkrvdkJNwBuXVaKXEd4LNaVy 8e8sHnlO0mvFTTytx6gxBiK5nBV/s27GfuIWpGqK0xGBC6rmOu+GjjG/kZmDQ83tMiMT YL4A== X-Gm-Message-State: APzg51DjGdLbBgzWmckYB0EPUBdZInL8vcMY7yBoqM0VynnMoohcESBS 3udh0quv9sE5CzMf1Z1HPZtJh3QZD49k39v4cV2xCg== X-Google-Smtp-Source: ANB0VdanmpRzKPTXRKWgGnueEreDsP4gIHrGsUpOce29XlfWYPTqmbzehsuFfricJrPrbgqI/v/Dwra4Bbtpw4UylRM= X-Received: by 2002:a24:8309:: with SMTP id d9-v6mr1918362ite.123.1536229707443; Thu, 06 Sep 2018 03:28:27 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:1c06:0:0:0:0:0 with HTTP; Thu, 6 Sep 2018 03:28:27 -0700 (PDT) In-Reply-To: <809ce67145704edeb41da02b7e5bdce5@ausx13mps335.AMER.DELL.COM> References: <20180809054155.30244-1-shenglei.zhang@intel.com> <809ce67145704edeb41da02b7e5bdce5@ausx13mps335.AMER.DELL.COM> From: Ard Biesheuvel Date: Thu, 6 Sep 2018 12:28:27 +0200 Message-ID: To: Jim.Dailey@dell.com Cc: "Zhang, Shenglei" , "Carsey, Jaben" , Ruiyu Ni , "edk2-devel@lists.01.org" Subject: Re: [PATCH] ShellPkg Shell: Remove redundant functions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 10:28:29 -0000 Content-Type: text/plain; charset="UTF-8" On 9 August 2018 at 17:41, wrote: > The InvalidChars[] array is only used in function IsValidCommandName(). > The array should be deleted also, I think. > Indeed, and for this reason this patch has now broken the build for clang. Please fix. > > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of shenglei > Sent: Thursday, August 9, 2018 12:42 AM > To: edk2-devel@lists.01.org > Cc: Jaben Carsey; Ruiyu Ni > Subject: [edk2] [PATCH] ShellPkg Shell: Remove redundant functions > > 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=1066 > > 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(-) > > 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( > > > STATIC CONST UINT16 InvalidChars[] = {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 name > -**/ > -BOOLEAN > -IsValidCommandName( > - IN CONST CHAR16 *CommandName > - ) > -{ > - UINTN Count; > - if (CommandName == NULL) { > - ASSERT(FALSE); > - return (FALSE); > - } > - for ( Count = 0 > - ; Count < sizeof(InvalidChars) / sizeof(InvalidChars[0]) > - ; Count++ > - ){ > - if (ScanMem16(CommandName, StrSize(CommandName), InvalidChars[Count]) != NULL) { > - return (FALSE); > - } > - } > - return (TRUE); > -} > > /** > 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 > ); > > -/** > - 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 name > -**/ > -BOOLEAN > -IsValidCommandName( > - IN CONST CHAR16 *CommandName > - ); > > /** > 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)); > } > > -/** > - 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 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 = sizeof(CHAR16); > - CharBuffer = 0; > - gEfiShellProtocol->ReadFile(*Handle, &CharSize, &CharBuffer); > - if (CharBuffer != gUnicodeFileTag) { > - gEfiShellProtocol->SetFilePosition(*Handle, 0); > - } > - return (EFI_SUCCESS); > -} > > /** > 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); > } > > -/** > - Internal worker debug helper function to print out maps as they are added. > - > - @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 = EFI_SUCCESS; > - DEBUG_CODE_BEGIN(); > - > - if (Mapping != NULL) { > - DEBUG((EFI_D_INFO, "Added new map item:\"%S\"\r\n", Mapping)); > - } > - Temp = ConvertDevicePathToText(DevicePath, TRUE, TRUE); > - DEBUG((EFI_D_INFO, "DevicePath: %S\r\n", Temp)); > - FreePool(Temp); > - > - DEBUG_CODE_END(); > - return (Status); > -} > > /** > This function creates a mapping for a device path. > @@ -1333,7 +1299,7 @@ EfiShellOpenFileByName( > // We are opening a regular file. > // > DevicePath = EfiShellGetDevicePathFromFilePath(FileName); > -// DEBUG_CODE(InternalShellProtocolDebugPrintMessage (NULL, DevicePath);); > + > if (DevicePath == NULL) { > return (EFI_NOT_FOUND); > } > @@ -2261,52 +2227,7 @@ EfiShellGetGuidName( > return (EFI_SUCCESS); > } > > -/** > - 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 = 0; > - Path2 = NULL; > - > - ASSERT(Path != NULL); > - ASSERT(*Path != NULL); > - ASSERT(BasePath != NULL); > - > - // > - // convert a local path to an absolute path > - // > - if (StrStr(*Path, L":") == NULL) { > - ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL)); > - StrnCatGrow(&Path2, &Path2Size, BasePath, 0); > - if (Path2 == NULL) { > - return (EFI_OUT_OF_RESOURCES); > - } > - ASSERT((Path2 == NULL && Path2Size == 0) || (Path2 != NULL)); > - StrnCatGrow(&Path2, &Path2Size, (*Path)[0] == L'\\'?(*Path) + 1 :*Path, 0); > - if (Path2 == NULL) { > - return (EFI_OUT_OF_RESOURCES); > - } > - } > - > - FreePool(*Path); > - (*Path) = Path2; > > - return (EFI_SUCCESS); > -} > > /** > If FileHandle is a directory then the function reads from FileHandle and reads in > -- > 2.18.0.windows.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel