]> code.delx.au - refind/commitdiff
Display partition label, if available, for BIOS-mode boot from
authorsrs5694 <srs5694@users.sourceforge.net>
Sun, 6 Jul 2014 15:00:01 +0000 (11:00 -0400)
committersrs5694 <srs5694@users.sourceforge.net>
Sun, 6 Jul 2014 15:00:01 +0000 (11:00 -0400)
partition on Macs, when the filesystem is unreadable.

NEWS.txt
refind/lib.c
refind/main.c

index 87b248caafbd30527aca76c770ab56f06ab67c78..e90ecd5bd099cc75ad2399fa409591af1f50d7e5 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,6 +1,13 @@
 0.8.3 (?/??/2014):
 ------------------
 
+- Added new icons for Clover boot loader and for Mythbuntu Linux
+  distribution.
+
+- rEFInd now displays the partition's label, when one is available, when
+  offering a BIOS-mode boot option for a partition with no filesystem
+  driver. This works only on Macs doing BIOS-mode booting.
+
 - Removed GPLv2 code from the FSW core files. This was done because the
   Btrfs driver is derived from the GRUB Btrfs driver, which is licensed
   under the GPLv3. Ironically, the GPLv2 and GPLv3 are incompatible
index 057026589c502b104180d336c3a8cb2771b85b81..893f62c35b53a93919436175cb5f0eab22a4acf6 100644 (file)
@@ -751,42 +751,45 @@ static CHAR16 *SizeInIEEEUnits(UINT64 SizeInBytes) {
 // The calling function is responsible for freeing the memory allocated
 // for the name string.
 static CHAR16 *GetVolumeName(REFIT_VOLUME *Volume) {
-   EFI_FILE_SYSTEM_INFO    *FileSystemInfoPtr;
+   EFI_FILE_SYSTEM_INFO    *FileSystemInfoPtr = NULL;
    CHAR16                  *FoundName = NULL;
    CHAR16                  *SISize, *TypeName;
 
-   FileSystemInfoPtr = LibFileSystemInfo(Volume->RootDir);
-   if (FileSystemInfoPtr != NULL) { // we have filesystem information (size, label)....
-       if ((FileSystemInfoPtr->VolumeLabel != NULL) && (StrLen(FileSystemInfoPtr->VolumeLabel) > 0)) {
-          FoundName = StrDuplicate(FileSystemInfoPtr->VolumeLabel);
-       }
-
-       // Special case: Old versions of the rEFInd HFS+ driver always returns label of "HFS+ volume", so wipe
-       // this so that we can build a new name that includes the size....
-       if ((FoundName != NULL) && (StrCmp(FoundName, L"HFS+ volume") == 0) && (Volume->FSType == FS_TYPE_HFSPLUS)) {
-          MyFreePool(FoundName);
-          FoundName = NULL;
-       } // if rEFInd HFS+ driver suspected
-
-       // If no filesystem name, try to use the partition name....
-       if ((FoundName == NULL) && (Volume->PartName != NULL) && (StrLen(Volume->PartName) > 0) &&
-           !IsIn(Volume->PartName, IGNORE_PARTITION_NAMES)) {
-          FoundName = StrDuplicate(Volume->PartName);
-       } // if use partition name
-
-       // No filesystem or acceptable partition name, so use fs type and size
-       if (FoundName == NULL) {
-          FoundName = AllocateZeroPool(sizeof(CHAR16) * 256);
-          if (FoundName != NULL) {
-             SISize = SizeInIEEEUnits(FileSystemInfoPtr->VolumeSize);
-             SPrint(FoundName, 255, L"%s%s volume", SISize, FSTypeName(Volume->FSType));
-             MyFreePool(SISize);
-          } // if allocated memory OK
-       } // if (FoundName == NULL)
-
-       FreePool(FileSystemInfoPtr);
-
-   } else { // fs driver not returning info; fall back on our own information....
+   if (Volume->RootDir != NULL) {
+      FileSystemInfoPtr = LibFileSystemInfo(Volume->RootDir);
+   }
+
+   if ((FileSystemInfoPtr != NULL) && (FileSystemInfoPtr->VolumeLabel != NULL) &&
+       (StrLen(FileSystemInfoPtr->VolumeLabel) > 0)) {
+      FoundName = StrDuplicate(FileSystemInfoPtr->VolumeLabel);
+   }
+
+   // Special case: Old versions of the rEFInd HFS+ driver always returns label of "HFS+ volume", so wipe
+   // this so that we can build a new name that includes the size....
+   if ((FoundName != NULL) && (StrCmp(FoundName, L"HFS+ volume") == 0) && (Volume->FSType == FS_TYPE_HFSPLUS)) {
+      MyFreePool(FoundName);
+      FoundName = NULL;
+   } // if rEFInd HFS+ driver suspected
+
+   // If no filesystem name, try to use the partition name....
+   if ((FoundName == NULL) && (Volume->PartName != NULL) && (StrLen(Volume->PartName) > 0) &&
+       !IsIn(Volume->PartName, IGNORE_PARTITION_NAMES)) {
+      FoundName = StrDuplicate(Volume->PartName);
+   } // if use partition name
+
+   // No filesystem or acceptable partition name, so use fs type and size
+   if ((FoundName == NULL) && (FileSystemInfoPtr != NULL)) {
+      FoundName = AllocateZeroPool(sizeof(CHAR16) * 256);
+      if (FoundName != NULL) {
+         SISize = SizeInIEEEUnits(FileSystemInfoPtr->VolumeSize);
+         SPrint(FoundName, 255, L"%s%s volume", SISize, FSTypeName(Volume->FSType));
+         MyFreePool(SISize);
+      } // if allocated memory OK
+   } // if (FoundName == NULL)
+
+   MyFreePool(FileSystemInfoPtr);
+
+   if (FoundName == NULL) {
       FoundName = AllocateZeroPool(sizeof(CHAR16) * 256);
       if (FoundName != NULL) {
          TypeName = FSTypeName(Volume->FSType); // NOTE: Don't free TypeName; function returns constant
@@ -799,7 +802,6 @@ static CHAR16 *GetVolumeName(REFIT_VOLUME *Volume) {
 
    // TODO: Above could be improved/extended, in case filesystem name is not found,
    // such as:
-   //  - use partition label
    //  - use or add disk/partition number (e.g., "(hd0,2)")
 
    // Desperate fallback name....
@@ -942,6 +944,8 @@ VOID ScanVolume(REFIT_VOLUME *Volume)
     // Set volume icon based on .VolumeBadge icon or disk kind
     SetVolumeBadgeIcon(Volume);
 
+    Volume->VolName = GetVolumeName(Volume);
+
     if (Volume->RootDir == NULL) {
         Volume->IsReadable = FALSE;
         return;
@@ -949,8 +953,6 @@ VOID ScanVolume(REFIT_VOLUME *Volume)
         Volume->IsReadable = TRUE;
     }
 
-    Volume->VolName = GetVolumeName(Volume);
-
     // get custom volume icons if present
     if (!Volume->VolIconImage)
        Volume->VolIconImage = egLoadIconAnyType(Volume->RootDir, L"", L".VolumeIcon", GlobalConfig.IconSizes[ICON_SIZE_BIG]);
index 0032e16287dc612dc04fbc00dcf5c61c756e89c5..dfe419d0fe88e5324eefff90fb692de1eeef5fbf 100644 (file)
@@ -169,7 +169,7 @@ static VOID AboutrEFInd(VOID)
 
     if (AboutMenu.EntryCount == 0) {
         AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
-        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.2.3");
+        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.2.4");
         AddMenuInfoLine(&AboutMenu, L"");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2014 Roderick W. Smith");