On 2015-07-24 09:37:49, Laszlo Ersek wrote:
> Jordan,
> 
> On 07/24/15 06:37, Dong, Eric wrote:
> > Reviewed-by:  Eric Dong <eric.d...@intel.com>
> > 
> > -----Original Message-----
> > From: Ni, Ruiyu 
> > Sent: Thursday, July 23, 2015 5:15 PM
> > To: edk2-devel@lists.01.org
> > Cc: Ni, Ruiyu; Dong, Eric
> > Subject: [Patch] MdeModulePkg: Make boot option description unique
> > 
> > When there are multiple network boot options, user will see multiple "UEFI 
> > Network" boot options. It's hard to distinguish them using the description.
> > The patch enhances the boot option generation logic to append " 2"
> > /" 3"/" 4"/... number suffix to the non-first network boot options.
> > So the 2nd one becomes "UEFI Network 2".
> > 
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Ruiyu Ni <ruiyu...@intel.com>
> > Cc: Eric Dong <eric.d...@intel.com>
> > ---
> >  MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 61 
> > ++++++++++++++++++++++++
> >  1 file changed, 61 insertions(+)
> 
> can you please queue this patch?

Merged onto:

https://github.com/tianocore/edk2-svn-offline master

> > 
> > diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
> > b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> > index 2c38aa8..f68c25e 100644
> > --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> > +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> > @@ -1869,6 +1869,66 @@ BmMatchPartitionDevicePathNode (  }
> >  
> >  /**
> > +  Enumerate all boot option descriptions and append " 2"/" 3"/... to 
> > + make  unique description.
> > +
> > +  @param BootOptions            Array of boot options.
> > +  @param BootOptionCount        Count of boot options.
> > +**/
> > +VOID
> > +BmMakeBootOptionDescriptionUnique (
> > +  EFI_BOOT_MANAGER_LOAD_OPTION         *BootOptions,
> > +  UINTN                                BootOptionCount
> > +  )
> > +{
> > +  UINTN                                Base;
> > +  UINTN                                Index;
> > +  UINTN                                DescriptionSize;
> > +  UINTN                                MaxSuffixSize;
> > +  BOOLEAN                              *Visited;
> > +  UINTN                                MatchCount;
> > +
> > +  if (BootOptionCount == 0) {
> > +    return;
> > +  }
> > +
> > +  //
> > +  // Calculate the maximum buffer size for the number suffix.
> > +  // The initial sizeof (CHAR16) is for the blank space before the number.
> > +  //
> > +  MaxSuffixSize = sizeof (CHAR16);
> > +  for (Index = BootOptionCount; Index != 0; Index = Index / 10) {
> > +    MaxSuffixSize += sizeof (CHAR16);
> > +  }
> > +
> > +  Visited = AllocateZeroPool (sizeof (BOOLEAN) * BootOptionCount);  
> > + ASSERT (Visited != NULL);
> > +
> > +  for (Base = 0; Base < BootOptionCount; Base++) {
> > +    if (!Visited[Base]) {
> > +      MatchCount      = 1;
> > +      Visited[Base]   = TRUE;
> > +      DescriptionSize = StrSize (BootOptions[Base].Description);
> > +      for (Index = Base + 1; Index < BootOptionCount; Index++) {
> > +        if (!Visited[Index] && StrCmp (BootOptions[Base].Description, 
> > BootOptions[Index].Description) == 0) {
> > +          Visited[Index] = TRUE;
> > +          MatchCount++;
> > +          FreePool (BootOptions[Index].Description);
> > +          BootOptions[Index].Description = AllocatePool (DescriptionSize + 
> > MaxSuffixSize);
> > +          UnicodeSPrint (
> > +            BootOptions[Index].Description, DescriptionSize + 
> > MaxSuffixSize,
> > +            L"%s %d",
> > +            BootOptions[Base].Description, MatchCount
> > +            );
> > +        }
> > +      }
> > +    }
> > +  }
> > +
> > +  FreePool (Visited);
> > +}
> > +
> > +/**
> >    Emuerate all possible bootable medias in the following order:
> >    1. Removable BlockIo            - The boot option only points to the 
> > removable media
> >                                      device, like USB key, DVD, Floppy etc.
> > @@ -2054,6 +2114,7 @@ BmEnumerateBootOptions (
> >      FreePool (Handles);
> >    }
> >  
> > +  BmMakeBootOptionDescriptionUnique (BootOptions, *BootOptionCount);
> >    return BootOptions;
> >  }
> >  
> > --
> > 1.9.5.msysgit.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
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to