Extract some code into detect_filesystem_in_encryption_mapping() (#148)
To avoid making set_luks_partition() more complicated extract the file system detection portion into a new function. Closes 148 - Encrypted file systems are no longer recognised
This commit is contained in:
parent
1e813d83a5
commit
1e91cb831b
|
@ -90,6 +90,8 @@ private:
|
|||
std::vector<Glib::ustring> & messages );
|
||||
void set_luks_partition( PartitionLUKS & partition );
|
||||
void set_partition_label_and_uuid( Partition & partition );
|
||||
static FSType detect_filesystem_in_encryption_mapping(const Glib::ustring& path,
|
||||
std::vector<Glib::ustring>& messages);
|
||||
static FSType detect_filesystem_internal(const Glib::ustring& path, Byte_Value sector_size);
|
||||
static FSType detect_filesystem( PedDevice * lp_device, PedPartition * lp_partition,
|
||||
std::vector<Glib::ustring> & messages );
|
||||
|
|
|
@ -1007,15 +1007,8 @@ void GParted_Core::set_luks_partition( PartitionLUKS & partition )
|
|||
return;
|
||||
|
||||
Glib::ustring mapping_path = DEV_MAPPER_PATH + mapping.name;
|
||||
PedDevice* lp_device = NULL;
|
||||
std::vector<Glib::ustring> detect_messages;
|
||||
FSType fstype = FS_UNKNOWN;
|
||||
if ( get_device( mapping_path, lp_device ) )
|
||||
{
|
||||
fstype = detect_filesystem( lp_device, NULL, detect_messages );
|
||||
PedDisk* lp_disk = NULL;
|
||||
destroy_device_and_disk( lp_device, lp_disk );
|
||||
}
|
||||
FSType fstype = detect_filesystem_in_encryption_mapping(mapping_path, detect_messages);
|
||||
bool fs_busy = is_busy( fstype, mapping_path );
|
||||
|
||||
partition.set_luks( mapping_path,
|
||||
|
@ -1076,6 +1069,23 @@ void GParted_Core::set_partition_label_and_uuid( Partition & partition )
|
|||
}
|
||||
|
||||
|
||||
FSType GParted_Core::detect_filesystem_in_encryption_mapping(const Glib::ustring& path,
|
||||
std::vector<Glib::ustring>& messages)
|
||||
{
|
||||
FSType fstype = FS_UNKNOWN;
|
||||
|
||||
PedDevice *lp_device = NULL;
|
||||
if (get_device(path, lp_device))
|
||||
{
|
||||
fstype = detect_filesystem(lp_device, NULL, messages);
|
||||
PedDisk *lp_disk = NULL;
|
||||
destroy_device_and_disk(lp_device, lp_disk);
|
||||
}
|
||||
|
||||
return fstype;
|
||||
}
|
||||
|
||||
|
||||
// GParted simple internal file system signature detection. Use sparingly. Only when
|
||||
// (old versions of) blkid and libparted don't recognise a signature.
|
||||
FSType GParted_Core::detect_filesystem_internal(const Glib::ustring& path, Byte_Value sector_size)
|
||||
|
|
Loading…
Reference in New Issue