* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
- * Modifications copyright (c) 2012 Roderick W. Smith
+ * Modifications copyright (c) 2012-2013 Roderick W. Smith
*
* Modifications distributed under the terms of the GNU General Public
* License (GPL) version 3 (GPLv3), a copy of which must be distributed
* with this source code or binaries made from it.
- *
+ *
*/
#include "global.h"
#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
+#define BTRFS_SIGNATURE "_BHRfS_M"
// variables
// isn't present.
VOID CleanUpPathNameSlashes(IN OUT CHAR16 *PathName) {
CHAR16 *NewName;
- UINTN i, FinalChar = 0;
+ UINTN i, Length, FinalChar = 0;
BOOLEAN LastWasSlash = FALSE;
- NewName = AllocateZeroPool(sizeof(CHAR16) * (StrLen(PathName) + 2));
+ Length = StrLen(PathName);
+ NewName = AllocateZeroPool(sizeof(CHAR16) * (Length + 2));
if (NewName != NULL) {
for (i = 0; i < StrLen(PathName); i++) {
if ((PathName[i] == L'/') || (PathName[i] == L'\\')) {
case FS_TYPE_REISERFS:
retval = L" ReiserFS";
break;
+ case FS_TYPE_BTRFS:
+ retval = L" Btrfs";
+ break;
case FS_TYPE_ISO9660:
retval = L" ISO-9660";
break;
} // if
} // search for ReiserFS magic
+ if (BufferSize >= (65536 + 64 + 8)) {
+ MagicString = (char*) (Buffer + 65536 + 64);
+ if (CompareMem(MagicString, BTRFS_SIGNATURE, 8) == 0)
+ return FS_TYPE_BTRFS;
+ } // search for Btrfs magic
+
if (BufferSize >= (1024 + 2)) {
Magic16 = (UINT16*) (Buffer + 1024);
if ((*Magic16 == HFSPLUS_MAGIC1) || (*Magic16 == HFSPLUS_MAGIC2)) {
} // if (Buffer != NULL)
return FoundType;
-}
+} // UINT32 IdentifyFilesystemType()
static VOID ScanVolumeBootcode(REFIT_VOLUME *Volume, BOOLEAN *Bootable)
{
}
} /* VOID ScanVolumeBootcode() */
-// default volume badge icon based on disk kind
-static VOID ScanVolumeDefaultIcon(IN OUT REFIT_VOLUME *Volume)
+// Set default volume badge icon based on /.VolumeBadge.{icns|png} file or disk kind
+VOID SetVolumeBadgeIcon(REFIT_VOLUME *Volume)
{
- switch (Volume->DiskKind) {
- case DISK_KIND_INTERNAL:
- Volume->VolBadgeImage = BuiltinIcon(BUILTIN_ICON_VOL_INTERNAL);
- break;
- case DISK_KIND_EXTERNAL:
- Volume->VolBadgeImage = BuiltinIcon(BUILTIN_ICON_VOL_EXTERNAL);
- break;
- case DISK_KIND_OPTICAL:
- Volume->VolBadgeImage = BuiltinIcon(BUILTIN_ICON_VOL_OPTICAL);
- break;
- } // switch()
-}
+ if (Volume->VolBadgeImage == NULL) {
+ Volume->VolBadgeImage = egLoadIconAnyType(Volume->RootDir, L"", L".VolumeBadge", 128);
+ }
+
+ if (Volume->VolBadgeImage == NULL) {
+ switch (Volume->DiskKind) {
+ case DISK_KIND_INTERNAL:
+ Volume->VolBadgeImage = BuiltinIcon(BUILTIN_ICON_VOL_INTERNAL);
+ break;
+ case DISK_KIND_EXTERNAL:
+ Volume->VolBadgeImage = BuiltinIcon(BUILTIN_ICON_VOL_EXTERNAL);
+ break;
+ case DISK_KIND_OPTICAL:
+ Volume->VolBadgeImage = BuiltinIcon(BUILTIN_ICON_VOL_OPTICAL);
+ break;
+ } // switch()
+ }
+} // VOID SetVolumeBadgeIcon()
// Return a string representing the input size in IEEE-1541 units.
// The calling function is responsible for freeing the allocated memory.
Volume->HasBootCode = FALSE;
}
- // default volume icon based on disk kind
- ScanVolumeDefaultIcon(Volume);
-
// open the root directory of the volume
Volume->RootDir = LibOpenRoot(Volume->DeviceHandle);
+
+ // Set volume icon based on .VolumeBadge icon or disk kind
+ SetVolumeBadgeIcon(Volume);
+
if (Volume->RootDir == NULL) {
Volume->IsReadable = FALSE;
return;
Volume->VolName = GetVolumeName(Volume);
- // get custom volume icon if present
- if (!Volume->VolBadgeImage)
- Volume->VolBadgeImage = egLoadIconAnyType(Volume->RootDir, L"", L".VolumeBadge", 32);
+ // get custom volume icons if present
if (!Volume->VolIconImage)
Volume->VolIconImage = egLoadIconAnyType(Volume->RootDir, L"", L".VolumeIcon", 128);
} // ScanVolume()
if (!Bootable)
Volume->HasBootCode = FALSE;
- ScanVolumeDefaultIcon(Volume);
+ SetVolumeBadgeIcon(Volume);
AddListElement((VOID ***) &Volumes, &VolumesCount, Volume);
CHAR16 *FindExtension(IN CHAR16 *Path) {
CHAR16 *Extension;
BOOLEAN Found = FALSE, FoundSlash = FALSE;
- UINTN i;
+ INTN i;
Extension = AllocateZeroPool(sizeof(CHAR16));
if (Path) {