X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FModules%2FStorage%2FLVM%2Fmbr.c;h=9de8fcd9d4cc322f4eb8e733235402b09e7bd6ac;hb=6aeca47f9311da25dfd9308c99cba9950b178d55;hp=169f6f369053ea38e708eb3f5a17308ff0dc349c;hpb=1d65dd9606edfcaeef8dfff3724ef6c49180b131;p=tpg%2Facess2.git diff --git a/KernelLand/Modules/Storage/LVM/mbr.c b/KernelLand/Modules/Storage/LVM/mbr.c index 169f6f36..9de8fcd9 100644 --- a/KernelLand/Modules/Storage/LVM/mbr.c +++ b/KernelLand/Modules/Storage/LVM/mbr.c @@ -16,6 +16,11 @@ void LVM_MBR_PopulateSubvolumes(tLVM_Vol *Volume, void *FirstSector); Uint64 LVM_MBR_int_ReadExt(tLVM_Vol *Volume, Uint64 Addr, Uint64 *Base, Uint64 *Length); // === GLOBALS === +tLVM_Format gLVM_MBRType = { + .Name = "MBR", + .CountSubvolumes = LVM_MBR_CountSubvolumes, + .PopulateSubvolumes = LVM_MBR_PopulateSubvolumes +}; // === CODE === /** @@ -68,10 +73,19 @@ int LVM_MBR_CountSubvolumes(tLVM_Vol *Volume, void *FirstSector) numPartitions ++; } } + // Detect the GPT protector + if( extendedLBA == 0 && numPartitions == 1 && MBR->Parts[0].SystemID == 0xEE ) + { + // TODO: Hand off to GPT parsing code + Log_Warning("LBA MBR", "TODO: Hand off to GPT"); + } + + // Handle extended partions while(extendedLBA != 0) { extendedLBA = LVM_MBR_int_ReadExt(Volume, extendedLBA, &base, &len); - if( extendedLBA == -1 ) break; + if( extendedLBA == (Uint64)-1 ) + break; numPartitions ++; } LOG("numPartitions = %i", numPartitions); @@ -122,7 +136,8 @@ void LVM_MBR_PopulateSubvolumes(tLVM_Vol *Volume, void *FirstSector) while(extendedLBA != 0) { extendedLBA = LVM_MBR_int_ReadExt(Volume, extendedLBA, &base, &len); - if(extendedLBA == -1) break; + if(extendedLBA == (Uint64)-1) + break; LVM_int_SetSubvolume_Anon( Volume, j, base, len ); j ++ ; }