Check if the mapper node is mounted.
This commit is contained in:
parent
45311941ca
commit
49cde487cc
|
@ -351,14 +351,32 @@ void LibPartedBackend::scanDevicePartitions(PedDevice*, Device& d, PedDisk* pedD
|
||||||
|
|
||||||
// libparted does not handle LUKS partitions
|
// libparted does not handle LUKS partitions
|
||||||
QString mountPoint;
|
QString mountPoint;
|
||||||
bool mounted;
|
bool mounted = false;
|
||||||
if (fs->type() == FileSystem::Luks) {
|
if (fs->type() == FileSystem::Luks) {
|
||||||
mounted = dynamic_cast<FS::luks*>(fs)->isMounted();
|
FS::luks* luksFs = dynamic_cast<FS::luks*>(fs);
|
||||||
mountPoint = mountPoints.findByDevice(FS::luks::mapperName(node)) ?
|
QString mapperNode = FS::luks::mapperName(node);
|
||||||
mountPoints.findByDevice(FS::luks::mapperName(node))->mountPoint() :
|
bool isCryptOpen = !mapperNode.isEmpty();
|
||||||
QString();
|
luksFs->setCryptOpen(isCryptOpen);
|
||||||
|
|
||||||
|
if (isCryptOpen) {
|
||||||
|
mountPoint = mountPoints.findByDevice(mapperNode) ?
|
||||||
|
mountPoints.findByDevice(mapperNode)->mountPoint() :
|
||||||
|
QString();
|
||||||
|
// We cannot use libparted to check the mounted status because
|
||||||
|
// we don't have a PedPartition for the mapper device, so we use
|
||||||
|
// check_mount_point from util-linux instead, defined in the
|
||||||
|
// private header ismounted.h and copied into KPMcore & wrapped
|
||||||
|
// in helpers.h for convenience.
|
||||||
|
mounted = isMounted(mapperNode);
|
||||||
|
} else {
|
||||||
|
mounted = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
luksFs->setMounted(mounted);
|
||||||
} else {
|
} else {
|
||||||
mountPoint = mountPoints.findByDevice(node) ? mountPoints.findByDevice(node)->mountPoint() : QString();
|
mountPoint = mountPoints.findByDevice(node) ?
|
||||||
|
mountPoints.findByDevice(node)->mountPoint() :
|
||||||
|
QString();
|
||||||
mounted = ped_partition_is_busy(pedPartition);
|
mounted = ped_partition_is_busy(pedPartition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue