Add some support to get used space info for mounted LUKS partitions using KDiskFreeSpaceInfo.
This commit is contained in:
parent
f820c8d764
commit
35a4798672
|
@ -32,6 +32,7 @@
|
|||
#include <QString>
|
||||
#include <QUuid>
|
||||
|
||||
#include <KDiskFreeSpaceInfo>
|
||||
#include <KLocalizedString>
|
||||
#include <KPasswordDialog>
|
||||
|
||||
|
@ -374,6 +375,11 @@ bool luks::mount(Report& report, const QString& deviceNode, const QString& mount
|
|||
if (m_innerFs->mount(report, mapperNode, mountPoint))
|
||||
{
|
||||
m_isMounted = true;
|
||||
|
||||
const KDiskFreeSpaceInfo freeSpaceInfo = KDiskFreeSpaceInfo::freeSpaceInfo(mountPoint);
|
||||
if (freeSpaceInfo.isValid() && mountPoint != QString())
|
||||
setSectorsUsed(freeSpaceInfo.used() / m_logicalSectorSize + getPayloadOffset(deviceNode));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@
|
|||
#include <QStringList>
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <KIOCore/KMountPoint>
|
||||
#include <KIOCore/KDiskFreeSpaceInfo>
|
||||
#include <KMountPoint>
|
||||
#include <KDiskFreeSpaceInfo>
|
||||
#include <KPluginFactory>
|
||||
|
||||
#include <parted/parted.h>
|
||||
|
@ -373,10 +373,7 @@ void LibPartedBackend::scanDevicePartitions(Device& d, PedDisk* pedDisk)
|
|||
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.
|
||||
// we don't have a PedPartition for the mapper device, so we use lsblk
|
||||
mounted = isMounted(mapperNode);
|
||||
} else {
|
||||
mounted = false;
|
||||
|
@ -392,7 +389,8 @@ void LibPartedBackend::scanDevicePartitions(Device& d, PedDisk* pedDisk)
|
|||
|
||||
Partition* part = new Partition(parent, d, PartitionRole(r), fs, pedPartition->geom.start, pedPartition->geom.end, node, availableFlags(pedPartition), mountPoint, mounted, activeFlags(pedPartition));
|
||||
|
||||
readSectorsUsed(pedDisk, d, *part, mountPoint);
|
||||
if (!part->roles().has(PartitionRole::Luks))
|
||||
readSectorsUsed(pedDisk, d, *part, mountPoint);
|
||||
|
||||
if (fs->supportGetLabel() != FileSystem::cmdSupportNone)
|
||||
fs->setLabel(fs->readLabel(part->deviceNode()));
|
||||
|
|
Loading…
Reference in New Issue