diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2020-08-05 02:05:18 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2020-08-05 02:08:12 +0200 |
commit | 388e44c8095c04eac53ca6500363ebfb0d8f14bb (patch) | |
tree | 4d0439848321a308f63d51edcc559695b10fb9db /src/Main/Forms | |
parent | c8b501062d31afb37168f676fa3168ad8b1e9007 (diff) | |
download | VeraCrypt-388e44c8095c04eac53ca6500363ebfb0d8f14bb.tar.gz VeraCrypt-388e44c8095c04eac53ca6500363ebfb0d8f14bb.zip |
Linux: Add support for Btrfs filesystem when creating volumes
Diffstat (limited to 'src/Main/Forms')
-rw-r--r-- | src/Main/Forms/VolumeCreationWizard.cpp | 23 | ||||
-rw-r--r-- | src/Main/Forms/VolumeFormatOptionsWizardPage.cpp | 17 |
2 files changed, 18 insertions, 22 deletions
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp index 37af6361..4df20301 100644 --- a/src/Main/Forms/VolumeCreationWizard.cpp +++ b/src/Main/Forms/VolumeCreationWizard.cpp @@ -466,25 +466,7 @@ namespace VeraCrypt #ifdef TC_UNIX // Format non-FAT filesystem - const char *fsFormatter = nullptr; - - switch (SelectedFilesystemType) - { -#if defined (TC_LINUX) - case VolumeCreationOptions::FilesystemType::Ext2: fsFormatter = "mkfs.ext2"; break; - case VolumeCreationOptions::FilesystemType::Ext3: fsFormatter = "mkfs.ext3"; break; - case VolumeCreationOptions::FilesystemType::Ext4: fsFormatter = "mkfs.ext4"; break; - case VolumeCreationOptions::FilesystemType::NTFS: fsFormatter = "mkfs.ntfs"; break; - case VolumeCreationOptions::FilesystemType::exFAT: fsFormatter = "mkfs.exfat"; break; -#elif defined (TC_MACOSX) - case VolumeCreationOptions::FilesystemType::MacOsExt: fsFormatter = "newfs_hfs"; break; - case VolumeCreationOptions::FilesystemType::exFAT: fsFormatter = "newfs_exfat"; break; - case VolumeCreationOptions::FilesystemType::APFS: fsFormatter = "newfs_apfs"; break; -#elif defined (TC_FREEBSD) || defined (TC_SOLARIS) - case VolumeCreationOptions::FilesystemType::UFS: fsFormatter = "newfs" ; break; -#endif - default: break; - } + const char *fsFormatter = VolumeCreationOptions::FilesystemType::GetFsFormatter (SelectedFilesystemType); if (fsFormatter) { @@ -544,6 +526,9 @@ namespace VeraCrypt if (SelectedFilesystemType == VolumeCreationOptions::FilesystemType::NTFS) args.push_back ("-f"); + if (SelectedFilesystemType == VolumeCreationOptions::FilesystemType::Btrfs) + args.push_back ("-f"); + args.push_back (string (virtualDevice)); Process::Execute (fsFormatter, args); diff --git a/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp b/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp index 38657059..30f8c6ba 100644 --- a/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp +++ b/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp @@ -35,9 +35,19 @@ namespace VeraCrypt #elif defined (TC_LINUX) FilesystemTypeChoice->Append (L"Linux Ext2", (void *) VolumeCreationOptions::FilesystemType::Ext2); FilesystemTypeChoice->Append (L"Linux Ext3", (void *) VolumeCreationOptions::FilesystemType::Ext3); - FilesystemTypeChoice->Append (L"Linux Ext4", (void *) VolumeCreationOptions::FilesystemType::Ext4); - FilesystemTypeChoice->Append (L"NTFS", (void *) VolumeCreationOptions::FilesystemType::NTFS); - FilesystemTypeChoice->Append (L"exFAT", (void *) VolumeCreationOptions::FilesystemType::exFAT); + if (VolumeCreationOptions::FilesystemType::IsFsFormatterPresent (VolumeCreationOptions::FilesystemType::Ext4)) + FilesystemTypeChoice->Append (L"Linux Ext4", (void *) VolumeCreationOptions::FilesystemType::Ext4); + if (VolumeCreationOptions::FilesystemType::IsFsFormatterPresent (VolumeCreationOptions::FilesystemType::NTFS)) + FilesystemTypeChoice->Append (L"NTFS", (void *) VolumeCreationOptions::FilesystemType::NTFS); + if (VolumeCreationOptions::FilesystemType::IsFsFormatterPresent (VolumeCreationOptions::FilesystemType::exFAT)) + FilesystemTypeChoice->Append (L"exFAT", (void *) VolumeCreationOptions::FilesystemType::exFAT); + if (VolumeCreationOptions::FilesystemType::IsFsFormatterPresent (VolumeCreationOptions::FilesystemType::Btrfs)) + { + uint64 minVolumeSizeForBtrfs = VC_MIN_BTRFS_VOLUME_SIZE + (uint64) (VC_MAX (TC_TOTAL_VOLUME_HEADERS_SIZE, TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE_HIGH)); + // minimum size to be able to format as Btrfs is 114294784 bytes + if (volumeSize >= minVolumeSizeForBtrfs) + FilesystemTypeChoice->Append (L"Btrfs", (void *) VolumeCreationOptions::FilesystemType::Btrfs); + } #elif defined (TC_MACOSX) FilesystemTypeChoice->Append (L"Mac OS Extended", (void *) VolumeCreationOptions::FilesystemType::MacOsExt); FilesystemTypeChoice->Append (L"exFAT", (void *) VolumeCreationOptions::FilesystemType::exFAT); @@ -83,6 +93,7 @@ namespace VeraCrypt case VolumeCreationOptions::FilesystemType::Ext2: FilesystemTypeChoice->SetStringSelection (L"Linux Ext2"); break; case VolumeCreationOptions::FilesystemType::Ext3: FilesystemTypeChoice->SetStringSelection (L"Linux Ext3"); break; case VolumeCreationOptions::FilesystemType::Ext4: FilesystemTypeChoice->SetStringSelection (L"Linux Ext4"); break; + case VolumeCreationOptions::FilesystemType::Btrfs: FilesystemTypeChoice->SetStringSelection (L"Btrfs"); break; case VolumeCreationOptions::FilesystemType::MacOsExt: FilesystemTypeChoice->SetStringSelection (L"Mac OS Extended"); break; case VolumeCreationOptions::FilesystemType::APFS: FilesystemTypeChoice->SetStringSelection (L"APFS"); break; case VolumeCreationOptions::FilesystemType::UFS: FilesystemTypeChoice->SetStringSelection (L"UFS"); break; |