mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 10:22:52 +00:00
partitionmanager: implement used capacity for ZFS
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
057106bf68
commit
978fa4d01f
2 changed files with 26 additions and 1 deletions
|
@ -49,6 +49,7 @@ namespace FS
|
|||
{
|
||||
m_SetLabel = findExternal("zpool", QStringList(), 2) ? cmdSupportFileSystem : cmdSupportNone;
|
||||
|
||||
m_GetUsed = findExternal("zfs", QStringList(), 2) ? cmdSupportFileSystem : cmdSupportNone;
|
||||
m_GetLabel = cmdSupportCore;
|
||||
m_Backup = cmdSupportCore;
|
||||
m_GetUUID = cmdSupportCore;
|
||||
|
@ -57,7 +58,7 @@ namespace FS
|
|||
bool zfs::supportToolFound() const
|
||||
{
|
||||
return
|
||||
// m_GetUsed != cmdSupportNone &&
|
||||
m_GetUsed != cmdSupportNone &&
|
||||
m_GetLabel != cmdSupportNone &&
|
||||
m_SetLabel != cmdSupportNone &&
|
||||
// m_Create != cmdSupportNone &&
|
||||
|
@ -86,6 +87,28 @@ namespace FS
|
|||
return Capacity::unitFactor(Capacity::Byte, Capacity::EiB);
|
||||
}
|
||||
|
||||
qint64 zfs::maxLabelLength() const
|
||||
{
|
||||
// for reference:
|
||||
// https://www.freebsd.org/cgi/man.cgi?query=zfs
|
||||
return (256 * 50);
|
||||
}
|
||||
|
||||
qint64 zfs::readUsedCapacity(const QString& deviceNode) const
|
||||
{
|
||||
Q_UNUSED(deviceNode)
|
||||
qint64 result = -1;
|
||||
ExternalCommand cmd("zfs", QStringList() << "list" << "-H" << "-p" << "-o" << "used" << this->label());
|
||||
if (cmd.start() && cmd.waitFor()) {
|
||||
bool ok = false;
|
||||
result = cmd.output().toLongLong(&ok);
|
||||
if (!ok) {
|
||||
result = -1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool zfs::remove(Report& report, const QString& deviceNode) const
|
||||
{
|
||||
Q_UNUSED(deviceNode)
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace FS
|
|||
public:
|
||||
static void init();
|
||||
|
||||
virtual qint64 readUsedCapacity(const QString& deviceNode) const;
|
||||
virtual bool remove(Report& report, const QString& deviceNode) const;
|
||||
virtual bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel);
|
||||
|
||||
|
@ -62,6 +63,7 @@ namespace FS
|
|||
|
||||
virtual qint64 minCapacity() const;
|
||||
virtual qint64 maxCapacity() const;
|
||||
virtual qint64 maxLabelLength() const;
|
||||
virtual SupportTool supportToolName() const;
|
||||
virtual bool supportToolFound() const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue