VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms/VolumeCreationWizard.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2020-08-26 06:28:37 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2020-08-26 06:31:10 (GMT)
commit1fb59b58ee9ec9215880dfa218d709fae02f6a53 (patch)
tree4c36c513909f7e1d306fd28a21f7e8cadd47b065 /src/Main/Forms/VolumeCreationWizard.cpp
parent0ab412a8de6a1557bd0f22d91a638e30b4f20ba8 (diff)
downloadVeraCrypt-1fb59b58ee9ec9215880dfa218d709fae02f6a53.zip
VeraCrypt-1fb59b58ee9ec9215880dfa218d709fae02f6a53.tar.gz
Linux: Reduce minimal size requirement for BTRFS support to 16 MiB by using mixed mode for volumes whose size is less than 109 MiB
Diffstat (limited to 'src/Main/Forms/VolumeCreationWizard.cpp')
-rw-r--r--src/Main/Forms/VolumeCreationWizard.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp
index 4df2030..5d814e8 100644
--- a/src/Main/Forms/VolumeCreationWizard.cpp
+++ b/src/Main/Forms/VolumeCreationWizard.cpp
@@ -258,7 +258,10 @@ namespace VeraCrypt
case Step::FormatOptions:
{
- VolumeFormatOptionsWizardPage *page = new VolumeFormatOptionsWizardPage (GetPageParent(), VolumeSize, SectorSize,
+ shared_ptr <VolumeLayout> layout ((OuterVolume || SelectedVolumeType != VolumeType::Hidden)? (VolumeLayout*) new VolumeLayoutV2Normal() : (VolumeLayout*) new VolumeLayoutV2Hidden());
+ uint64 filesystemSize = layout->GetMaxDataSize (VolumeSize);
+
+ VolumeFormatOptionsWizardPage *page = new VolumeFormatOptionsWizardPage (GetPageParent(), filesystemSize, SectorSize,
SelectedVolumePath.IsDevice() && (OuterVolume || SelectedVolumeType != VolumeType::Hidden), OuterVolume, LargeFilesSupport);
page->SetPageTitle (_("Format Options"));
@@ -484,6 +487,9 @@ namespace VeraCrypt
shared_ptr <VolumeInfo> volume = Core->MountVolume (mountOptions);
finally_do_arg (shared_ptr <VolumeInfo>, volume, { Core->DismountVolume (finally_arg, true); });
+
+ shared_ptr <VolumeLayout> layout((volume->Type == VolumeType::Normal)? (VolumeLayout*) new VolumeLayoutV2Normal() : (VolumeLayout*) new VolumeLayoutV2Hidden());
+ uint64 filesystemSize = layout->GetMaxDataSize (VolumeSize);
Thread::Sleep (2000); // Try to prevent race conditions caused by OS
@@ -527,7 +533,14 @@ namespace VeraCrypt
args.push_back ("-f");
if (SelectedFilesystemType == VolumeCreationOptions::FilesystemType::Btrfs)
+ {
args.push_back ("-f");
+ if (filesystemSize < VC_MIN_LARGE_BTRFS_VOLUME_SIZE)
+ {
+ // use mixed mode for small BTRFS volumes
+ args.push_back ("-M");
+ }
+ }
args.push_back (string (virtualDevice));