mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-06-15 09:06:08 -05:00
Linux: allow mounting NTFS volumes with ntfs3 (#1695)
* Linux: allow mounting volumes with ntfs3 * Linux: add ntfs3 preference for NTFS mounts * Linux: wrap ntfs3 preference help text * Add Linux ntfs3 mount preference * Remove Russian translation changes from ntfs3 PR * XML Translations: Add English fallback entries for ntfs3 preference --------- Co-authored-by: Mounir IDRASSI <mounir.idrassi@amcrypto.jp>
This commit is contained in:
@@ -566,6 +566,29 @@ namespace VeraCrypt
|
||||
return GetMountedFilesystems (DevicePath(), mountPoint).size() == 0;
|
||||
}
|
||||
|
||||
#ifdef TC_LINUX
|
||||
string CoreUnix::DetectFilesystemType (const DevicePath &devicePath) const
|
||||
{
|
||||
list <string> args;
|
||||
args.push_back ("-p");
|
||||
args.push_back ("-o");
|
||||
args.push_back ("value");
|
||||
args.push_back ("-s");
|
||||
args.push_back ("TYPE");
|
||||
args.push_back ("--");
|
||||
args.push_back (devicePath);
|
||||
|
||||
try
|
||||
{
|
||||
return StringConverter::ToLower (StringConverter::Trim (Process::Execute ("blkid", args, 2000)));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return string();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void CoreUnix::MountFilesystem (const DevicePath &devicePath, const DirectoryPath &mountPoint, const string &filesystemType, bool readOnly, const string &systemMountOptions) const
|
||||
{
|
||||
if (GetMountedFilesystems (DevicePath(), mountPoint).size() > 0)
|
||||
@@ -914,8 +937,18 @@ namespace VeraCrypt
|
||||
|
||||
if (!options.NoFilesystem && options.MountPoint && !options.MountPoint->IsEmpty())
|
||||
{
|
||||
wstring filesystemType = options.FilesystemType;
|
||||
|
||||
#ifdef TC_LINUX
|
||||
if (options.MountNtfsWithNtfs3 && filesystemType.empty()
|
||||
&& DetectFilesystemType (loopDev) == "ntfs")
|
||||
{
|
||||
filesystemType = L"ntfs3";
|
||||
}
|
||||
#endif
|
||||
|
||||
MountFilesystem (loopDev, *options.MountPoint,
|
||||
StringConverter::ToSingle (options.FilesystemType),
|
||||
StringConverter::ToSingle (filesystemType),
|
||||
options.Protection == VolumeProtection::ReadOnly,
|
||||
StringConverter::ToSingle (options.FilesystemOptions));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user