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