summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot/BootKit/BootKit.hxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-04 13:38:10 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-04 13:38:10 +0200
commitfd7b08906adf40b81f3ac758ca55da501cb2283d (patch)
treeb8e663df7ec15620b12687481f28174139cede30 /Private/NewBoot/BootKit/BootKit.hxx
parentae3555797c741edc7bac5d464e8f48774663043b (diff)
MHR-23: patches and fixes, also restricted disks to at least have 10G of
free space. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/NewBoot/BootKit/BootKit.hxx')
-rw-r--r--Private/NewBoot/BootKit/BootKit.hxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx
index c8333b86..faba02fb 100644
--- a/Private/NewBoot/BootKit/BootKit.hxx
+++ b/Private/NewBoot/BootKit/BootKit.hxx
@@ -313,6 +313,15 @@ inline Boolean BDiskFormatFactory<BootDev>::Format(const char* partName,
/// @note A catalog roughly equal to a sector.
+ constexpr auto cMinimumDiskSize = 10; // at minimum.
+
+ /// @note also look at EPM headers, for free part blocks.
+
+ if (GIB(fDiskDev.GetDiskSize()) < cMinimumDiskSize) {
+ EFI::ThrowError(L"Disk-Too-Tiny", L"Disk can't contain a New Filesystem partition.");
+ return false;
+ }
+
partBlock->Version = kNewFSVersionInteger;
partBlock->CatalogCount = blobCount;
partBlock->Kind = kNewFSHardDrive;