From 319a44ae64d108f11c7622f036cef032cd9bb613 Mon Sep 17 00:00:00 2001 From: Volker Lanz Date: Mon, 17 May 2010 14:36:18 +0000 Subject: [PATCH] add filesystem support for zfs, hpfs, ocfs2, luks and btrfs svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1127754 --- src/config.kcfg | 42 +-- src/config/configurepagefilesystemcolors.ui | 314 ++++++++++++++------ src/fs/btrfs.cpp | 122 ++++++++ src/fs/btrfs.h | 85 ++++++ src/fs/filesystem.cpp | 10 +- src/fs/filesystem.h | 7 +- src/fs/filesystemfactory.cpp | 20 ++ src/fs/hpfs.cpp | 54 ++++ src/fs/hpfs.h | 78 +++++ src/fs/luks.cpp | 54 ++++ src/fs/luks.h | 78 +++++ src/fs/ocfs2.cpp | 130 ++++++++ src/fs/ocfs2.h | 85 ++++++ src/fs/zfs.cpp | 54 ++++ src/fs/zfs.h | 78 +++++ src/plugins/libparted/libpartedbackend.cpp | 5 + 16 files changed, 1099 insertions(+), 117 deletions(-) create mode 100644 src/fs/btrfs.cpp create mode 100644 src/fs/btrfs.h create mode 100644 src/fs/hpfs.cpp create mode 100644 src/fs/hpfs.h create mode 100644 src/fs/luks.cpp create mode 100644 src/fs/luks.h create mode 100644 src/fs/ocfs2.cpp create mode 100644 src/fs/ocfs2.h create mode 100644 src/fs/zfs.cpp create mode 100644 src/fs/zfs.h diff --git a/src/config.kcfg b/src/config.kcfg index d8b9468..00c3462 100644 --- a/src/config.kcfg +++ b/src/config.kcfg @@ -60,24 +60,30 @@ - - 252,242,220 - 187,249,207 - 122,145,180 - 143,169,210 - 173,205,255 - 155,155,130 - 204,179,215 - 229,201,240 - 244,214,255 - 216,220,135 - 251,255,157 - 200,255,254 - 137,200,198 - 210,136,142 - 240,165,171 - 151,220,134 - 252,242,222 + + + 252,242,220 + 187,249,207 + 102,121,150 + 122,145,180 + 143,170,210 + 155,155,130 + 204,179,215 + 229,201,240 + 244,214,255 + 216,220,135 + 251,255,157 + 200,255,254 + 137,200,198 + 210,136,142 + 240,165,171 + 151,220,134 + 252,242,222 + 173,205,255 + 176,155,185 + 170,30,77 + 96,140,85 + 33,137,108 diff --git a/src/config/configurepagefilesystemcolors.ui b/src/config/configurepagefilesystemcolors.ui index 76b96da..646b945 100644 --- a/src/config/configurepagefilesystemcolors.ui +++ b/src/config/configurepagefilesystemcolors.ui @@ -6,8 +6,8 @@ 0 0 - 509 - 504 + 449 + 457 @@ -98,9 +98,9 @@ - + - linuxswap: + btrfs: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -111,9 +111,38 @@ - + + + + Qt::Horizontal + + + + 37 + 18 + + + + + + + + luks: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + + Qt::Horizontal @@ -126,7 +155,23 @@ - + + + + linuxswap: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + + fat16: @@ -139,10 +184,10 @@ - + - + Qt::Horizontal @@ -155,7 +200,7 @@ - + fat32: @@ -168,10 +213,23 @@ - + - + + + + Qt::Horizontal + + + + 28 + 17 + + + + + ntfs: @@ -184,23 +242,10 @@ - + - - - - Qt::Horizontal - - - - 28 - 17 - - - - - + reiserfs: @@ -213,10 +258,10 @@ - + - + Qt::Horizontal @@ -229,7 +274,7 @@ - + reiser4: @@ -242,27 +287,11 @@ - + - - - - xfs: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - false - - - - - - - + Qt::Horizontal @@ -274,7 +303,23 @@ - + + + + hpfs: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + + jfs @@ -287,10 +332,10 @@ - + - + Qt::Horizontal @@ -303,7 +348,7 @@ - + hfs: @@ -316,10 +361,23 @@ - + - + + + + Qt::Horizontal + + + + 28 + 17 + + + + + hfsplus: @@ -332,23 +390,10 @@ - + - - - - Qt::Horizontal - - - - 28 - 17 - - - - - + ufs: @@ -361,10 +406,10 @@ - + - + Qt::Horizontal @@ -377,7 +422,81 @@ - + + + + xfs: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + + + + + Qt::Horizontal + + + + 28 + 17 + + + + + + + + ocfs2: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + + + + + zfs: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + + + + + Qt::Horizontal + + + + 173 + 18 + + + + + extended: @@ -390,26 +509,10 @@ - + - - - - unknown: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - false - - - - - - - + Qt::Horizontal @@ -422,7 +525,7 @@ - + unformatted: @@ -435,22 +538,45 @@ - + - + Qt::Horizontal - 176 + 21 21 + + + + unknown: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + + + + + Qt::Horizontal + + + @@ -518,7 +644,7 @@ - 167 + 23 21 diff --git a/src/fs/btrfs.cpp b/src/fs/btrfs.cpp new file mode 100644 index 0000000..67c2d5e --- /dev/null +++ b/src/fs/btrfs.cpp @@ -0,0 +1,122 @@ +/*************************************************************************** + * Copyright (C) 2010 by Volker Lanz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "fs/btrfs.h" + +#include "util/externalcommand.h" +#include "util/capacity.h" + +#include +#include + +namespace FS +{ + FileSystem::CommandSupportType btrfs::m_GetUsed = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType btrfs::m_GetLabel = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType btrfs::m_Create = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType btrfs::m_Grow = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType btrfs::m_Shrink = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType btrfs::m_Move = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType btrfs::m_Check = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType btrfs::m_Copy = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType btrfs::m_Backup = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType btrfs::m_SetLabel = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType btrfs::m_UpdateUUID = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType btrfs::m_GetUUID = FileSystem::cmdSupportNone; + + btrfs::btrfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) : + FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Btrfs) + { + } + + void btrfs::init() + { + m_Create = findExternal("mkfs.btrfs") ? cmdSupportFileSystem : cmdSupportNone; + m_Check = findExternal("fsck.btrfs", QStringList(), 1) ? cmdSupportFileSystem : cmdSupportNone; + m_Grow = (m_Check != cmdSupportNone && findExternal("btrfsctl")) ? cmdSupportFileSystem : cmdSupportNone; + m_Shrink = (m_Grow != cmdSupportNone && m_GetUsed != cmdSupportNone) ? cmdSupportFileSystem : cmdSupportNone; + m_GetUsed = findExternal("btrfs-debug-tree") ? cmdSupportFileSystem : cmdSupportNone; + + // TODO: are those not possible with btrfs (yet)? + m_SetLabel = cmdSupportNone; + m_UpdateUUID = cmdSupportNone; + + m_Copy = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone; + m_Move = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone; + + m_GetLabel = cmdSupportCore; + m_Backup = cmdSupportCore; + m_GetUUID = cmdSupportCore; + } + + qint64 btrfs::maxCapacity() const + { + return Capacity::unitFactor(Capacity::Byte, Capacity::EiB); + } + + qint64 btrfs::readUsedCapacity(const QString& deviceNode) const + { + ExternalCommand cmd("btrfs-debug-tree", QStringList() << deviceNode); + + if (cmd.run()) + { + QRegExp rxBytesUsed("\nbytes used (\\d+)"); + + if (rxBytesUsed.indexIn(cmd.output()) != -1) + return rxBytesUsed.cap(1).toLongLong(); + } + + return -1; + } + + bool btrfs::check(Report& report, const QString& deviceNode) const + { + ExternalCommand cmd(report, "btrfsck", QStringList() << deviceNode); + return cmd.run(-1) && cmd.exitCode() == 0; + } + + bool btrfs::create(Report& report, const QString& deviceNode) const + { + ExternalCommand cmd(report, "mkfs.btrfs", QStringList() << deviceNode); + return cmd.run(-1) && cmd.exitCode() == 0; + } + + bool btrfs::resize(Report& report, const QString& deviceNode, qint64 length) const + { + ExternalCommand cmd(report, "btrfsctl", QStringList() << deviceNode << "-r" << QString::number(length)); + return cmd.run(-1) && cmd.exitCode() == 0; + } + + bool btrfs::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel) + { + Q_UNUSED(report); + Q_UNUSED(deviceNode); + Q_UNUSED(newLabel); + + return false; + } + + bool btrfs::updateUUID(Report& report, const QString& deviceNode) const + { + Q_UNUSED(report); + Q_UNUSED(deviceNode); + + return false; + } +} diff --git a/src/fs/btrfs.h b/src/fs/btrfs.h new file mode 100644 index 0000000..cd7b079 --- /dev/null +++ b/src/fs/btrfs.h @@ -0,0 +1,85 @@ +/*************************************************************************** + * Copyright (C) 2010 by Volker Lanz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#if !defined(BTRFS__H) + +#define BTRFS__H + +#include "util/libpartitionmanagerexport.h" + +#include "fs/filesystem.h" + +#include + +class Report; + +class QString; + +namespace FS +{ + /** @brief A btrfs file system. + @author vl@fidra.de + */ + class LIBPARTITIONMANAGERPRIVATE_EXPORT btrfs : public FileSystem + { + public: + btrfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); + + public: + static void init(); + + virtual qint64 readUsedCapacity(const QString& deviceNode) const; + virtual bool check(Report& report, const QString& deviceNode) const; + virtual bool create(Report& report, const QString& deviceNode) const; + virtual bool resize(Report& report, const QString& deviceNode, qint64 length) const; + virtual bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel); + virtual bool updateUUID(Report& report, const QString& deviceNode) const; + + virtual CommandSupportType supportGetUsed() const { return m_GetUsed; } + virtual CommandSupportType supportGetLabel() const { return m_GetLabel; } + virtual CommandSupportType supportCreate() const { return m_Create; } + virtual CommandSupportType supportGrow() const { return m_Grow; } + virtual CommandSupportType supportShrink() const { return m_Shrink; } + virtual CommandSupportType supportMove() const { return m_Move; } + virtual CommandSupportType supportCheck() const { return m_Check; } + virtual CommandSupportType supportCopy() const { return m_Copy; } + virtual CommandSupportType supportBackup() const { return m_Backup; } + virtual CommandSupportType supportSetLabel() const { return m_SetLabel; } + virtual CommandSupportType supportUpdateUUID() const { return m_UpdateUUID; } + virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } + + virtual qint64 maxCapacity() const; + + public: + static CommandSupportType m_GetUsed; + static CommandSupportType m_GetLabel; + static CommandSupportType m_Create; + static CommandSupportType m_Grow; + static CommandSupportType m_Shrink; + static CommandSupportType m_Move; + static CommandSupportType m_Check; + static CommandSupportType m_Copy; + static CommandSupportType m_Backup; + static CommandSupportType m_SetLabel; + static CommandSupportType m_UpdateUUID; + static CommandSupportType m_GetUUID; + }; +} + +#endif diff --git a/src/fs/filesystem.cpp b/src/fs/filesystem.cpp index c1a9c05..0fe5e44 100644 --- a/src/fs/filesystem.cpp +++ b/src/fs/filesystem.cpp @@ -233,9 +233,6 @@ QString FileSystem::name() const /** @return a pointer to a QString C array with all FileSystem names */ static const QString* typeNames() { - // The KDE localization framework doesn't like this array if it's - // just declared static outside any function. If we do it here, - // it seems to work fine. That's why this is done so strangely here. static const QString s[] = { i18nc("@item/plain filesystem name", "unknown"), @@ -255,7 +252,12 @@ static const QString* typeNames() i18nc("@item/plain filesystem name", "hfs"), i18nc("@item/plain filesystem name", "hfsplus"), i18nc("@item/plain filesystem name", "ufs"), - i18nc("@item/plain filesystem name", "unformatted") + i18nc("@item/plain filesystem name", "unformatted"), + i18nc("@item/plain filesystem name", "btrfs"), + i18nc("@item/plain filesystem name", "hpfs"), + i18nc("@item/plain filesystem name", "luks"), + i18nc("@item/plain filesystem name", "ocfs2"), + i18nc("@item/plain filesystem name", "zfs"), }; return s; diff --git a/src/fs/filesystem.h b/src/fs/filesystem.h index 3669886..98c7a7c 100644 --- a/src/fs/filesystem.h +++ b/src/fs/filesystem.h @@ -62,8 +62,13 @@ class FileSystem HfsPlus = 14, Ufs = 15, Unformatted = 16, + Btrfs = 17, + Hpfs = 18, + Luks = 19, + Ocfs2 = 20, + Zfs = 21, - __lastType = 17 + __lastType = 22 }; /** The type of support for a given FileSystem action */ diff --git a/src/fs/filesystemfactory.cpp b/src/fs/filesystemfactory.cpp index 6d0f304..d4434b5 100644 --- a/src/fs/filesystemfactory.cpp +++ b/src/fs/filesystemfactory.cpp @@ -20,6 +20,7 @@ #include "fs/filesystemfactory.h" #include "fs/filesystem.h" +#include "fs/btrfs.h" #include "fs/ext2.h" #include "fs/ext3.h" #include "fs/ext4.h" @@ -28,15 +29,19 @@ #include "fs/fat32.h" #include "fs/hfs.h" #include "fs/hfsplus.h" +#include "fs/hpfs.h" #include "fs/jfs.h" #include "fs/linuxswap.h" +#include "fs/luks.h" #include "fs/ntfs.h" +#include "fs/ocfs2.h" #include "fs/reiser4.h" #include "fs/reiserfs.h" #include "fs/ufs.h" #include "fs/unformatted.h" #include "fs/unknown.h" #include "fs/xfs.h" +#include "fs/zfs.h" #include "backend/corebackendmanager.h" #include "backend/corebackend.h" @@ -49,6 +54,7 @@ void FileSystemFactory::init() qDeleteAll(m_FileSystems); m_FileSystems.clear(); + m_FileSystems.insert(FileSystem::Btrfs, new FS::btrfs(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Ext2, new FS::ext2(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Ext3, new FS::ext3(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Ext4, new FS::ext4(-1, -1, -1, QString())); @@ -57,16 +63,21 @@ void FileSystemFactory::init() m_FileSystems.insert(FileSystem::Fat32, new FS::fat32(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Hfs, new FS::hfs(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::HfsPlus, new FS::hfsplus(-1, -1, -1, QString())); + m_FileSystems.insert(FileSystem::Hpfs, new FS::hpfs(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Jfs, new FS::jfs(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::LinuxSwap, new FS::linuxswap(-1, -1, -1, QString())); + m_FileSystems.insert(FileSystem::Luks, new FS::luks(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Ntfs, new FS::ntfs(-1, -1, -1, QString())); + m_FileSystems.insert(FileSystem::Ocfs2, new FS::ocfs2(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::ReiserFS, new FS::reiserfs(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Reiser4, new FS::reiser4(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Ufs, new FS::ufs(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Unformatted, new FS::unformatted(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Unknown, new FS::unknown(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Xfs, new FS::xfs(-1, -1, -1, QString())); + m_FileSystems.insert(FileSystem::Zfs, new FS::zfs(-1, -1, -1, QString())); + FS::btrfs::init(); FS::ext2::init(); FS::ext3::init(); FS::ext4::init(); @@ -75,15 +86,19 @@ void FileSystemFactory::init() FS::fat32::init(); FS::hfs::init(); FS::hfsplus::init(); + FS::hpfs::init(); FS::jfs::init(); FS::linuxswap::init(); + FS::luks::init(); FS::ntfs::init(); + FS::ocfs2::init(); FS::reiserfs::init(); FS::reiser4::init(); FS::ufs::init(); FS::unformatted::init(); FS::unknown::init(); FS::xfs::init(); + FS::zfs::init(); CoreBackendManager::self()->backend()->initFSSupport(); } @@ -102,6 +117,7 @@ FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qi switch(t) { + case FileSystem::Btrfs: fs = new FS::btrfs(firstsector, lastsector, sectorsused, label); break; case FileSystem::Ext2: fs = new FS::ext2(firstsector, lastsector, sectorsused, label); break; case FileSystem::Ext3: fs = new FS::ext3(firstsector, lastsector, sectorsused, label); break; case FileSystem::Ext4: fs = new FS::ext4(firstsector, lastsector, sectorsused, label); break; @@ -110,15 +126,19 @@ FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qi case FileSystem::Fat32: fs = new FS::fat32(firstsector, lastsector, sectorsused, label); break; case FileSystem::Hfs: fs = new FS::hfs(firstsector, lastsector, sectorsused, label); break; case FileSystem::HfsPlus: fs = new FS::hfsplus(firstsector, lastsector, sectorsused, label); break; + case FileSystem::Hpfs: fs = new FS::hpfs(firstsector, lastsector, sectorsused, label); break; case FileSystem::Jfs: fs = new FS::jfs(firstsector, lastsector, sectorsused, label); break; case FileSystem::LinuxSwap: fs = new FS::linuxswap(firstsector, lastsector, sectorsused, label); break; + case FileSystem::Luks: fs = new FS::luks(firstsector, lastsector, sectorsused, label); break; case FileSystem::Ntfs: fs = new FS::ntfs(firstsector, lastsector, sectorsused, label); break; + case FileSystem::Ocfs2: fs = new FS::ocfs2(firstsector, lastsector, sectorsused, label); break; case FileSystem::ReiserFS: fs = new FS::reiserfs(firstsector, lastsector, sectorsused, label); break; case FileSystem::Reiser4: fs = new FS::reiser4(firstsector, lastsector, sectorsused, label); break; case FileSystem::Ufs: fs = new FS::ufs(firstsector, lastsector, sectorsused, label); break; case FileSystem::Unformatted: fs = new FS::unformatted(firstsector, lastsector, sectorsused, label); break; case FileSystem::Unknown: fs = new FS::unknown(firstsector, lastsector, sectorsused, label); break; case FileSystem::Xfs: fs = new FS::xfs(firstsector, lastsector, sectorsused, label); break; + case FileSystem::Zfs: fs = new FS::zfs(firstsector, lastsector, sectorsused, label); break; default: break; } diff --git a/src/fs/hpfs.cpp b/src/fs/hpfs.cpp new file mode 100644 index 0000000..0562228 --- /dev/null +++ b/src/fs/hpfs.cpp @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2010 by Volker Lanz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "fs/hpfs.h" + +#include "util/capacity.h" + +#include + +namespace FS +{ + FileSystem::CommandSupportType hpfs::m_GetUsed = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType hpfs::m_GetLabel = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType hpfs::m_Create = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType hpfs::m_Grow = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType hpfs::m_Shrink = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType hpfs::m_Move = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType hpfs::m_Check = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType hpfs::m_Copy = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType hpfs::m_Backup = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType hpfs::m_SetLabel = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType hpfs::m_UpdateUUID = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType hpfs::m_GetUUID = FileSystem::cmdSupportNone; + + hpfs::hpfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) : + FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Hpfs) + { + } + + void hpfs::init() + { + } + + qint64 hpfs::maxCapacity() const + { + return 2 * Capacity::unitFactor(Capacity::Byte, Capacity::TiB); + } +} diff --git a/src/fs/hpfs.h b/src/fs/hpfs.h new file mode 100644 index 0000000..135879c --- /dev/null +++ b/src/fs/hpfs.h @@ -0,0 +1,78 @@ +/*************************************************************************** + * Copyright (C) 2010 by Volker Lanz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#if !defined(HPFS__H) + +#define HPFS__H + +#include "util/libpartitionmanagerexport.h" + +#include "fs/filesystem.h" + +#include + +class Report; + +class QString; + +namespace FS +{ + /** @brief A hpfs file system. + @author vl@fidra.de + */ + class LIBPARTITIONMANAGERPRIVATE_EXPORT hpfs : public FileSystem + { + public: + hpfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); + + public: + static void init(); + + virtual CommandSupportType supportGetUsed() const { return m_GetUsed; } + virtual CommandSupportType supportGetLabel() const { return m_GetLabel; } + virtual CommandSupportType supportCreate() const { return m_Create; } + virtual CommandSupportType supportGrow() const { return m_Grow; } + virtual CommandSupportType supportShrink() const { return m_Shrink; } + virtual CommandSupportType supportMove() const { return m_Move; } + virtual CommandSupportType supportCheck() const { return m_Check; } + virtual CommandSupportType supportCopy() const { return m_Copy; } + virtual CommandSupportType supportBackup() const { return m_Backup; } + virtual CommandSupportType supportSetLabel() const { return m_SetLabel; } + virtual CommandSupportType supportUpdateUUID() const { return m_UpdateUUID; } + virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } + + virtual qint64 maxCapacity() const; + + public: + static CommandSupportType m_GetUsed; + static CommandSupportType m_GetLabel; + static CommandSupportType m_Create; + static CommandSupportType m_Grow; + static CommandSupportType m_Shrink; + static CommandSupportType m_Move; + static CommandSupportType m_Check; + static CommandSupportType m_Copy; + static CommandSupportType m_Backup; + static CommandSupportType m_SetLabel; + static CommandSupportType m_UpdateUUID; + static CommandSupportType m_GetUUID; + }; +} + +#endif diff --git a/src/fs/luks.cpp b/src/fs/luks.cpp new file mode 100644 index 0000000..c53d26e --- /dev/null +++ b/src/fs/luks.cpp @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2010 by Volker Lanz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "fs/luks.h" + +#include "util/capacity.h" + +#include + +namespace FS +{ + FileSystem::CommandSupportType luks::m_GetUsed = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType luks::m_GetLabel = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType luks::m_Create = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType luks::m_Grow = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType luks::m_Shrink = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType luks::m_Move = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType luks::m_Check = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType luks::m_Copy = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType luks::m_Backup = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType luks::m_SetLabel = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType luks::m_UpdateUUID = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType luks::m_GetUUID = FileSystem::cmdSupportNone; + + luks::luks(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) : + FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Luks) + { + } + + void luks::init() + { + } + + qint64 luks::maxCapacity() const + { + return Capacity::unitFactor(Capacity::Byte, Capacity::EiB); + } +} diff --git a/src/fs/luks.h b/src/fs/luks.h new file mode 100644 index 0000000..c93e6bc --- /dev/null +++ b/src/fs/luks.h @@ -0,0 +1,78 @@ +/*************************************************************************** + * Copyright (C) 2010 by Volker Lanz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#if !defined(LUKS__H) + +#define LUKS__H + +#include "util/libpartitionmanagerexport.h" + +#include "fs/filesystem.h" + +#include + +class Report; + +class QString; + +namespace FS +{ + /** @brief A LUKS crypto file system. + @author vl@fidra.de + */ + class LIBPARTITIONMANAGERPRIVATE_EXPORT luks : public FileSystem + { + public: + luks(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); + + public: + static void init(); + + virtual CommandSupportType supportGetUsed() const { return m_GetUsed; } + virtual CommandSupportType supportGetLabel() const { return m_GetLabel; } + virtual CommandSupportType supportCreate() const { return m_Create; } + virtual CommandSupportType supportGrow() const { return m_Grow; } + virtual CommandSupportType supportShrink() const { return m_Shrink; } + virtual CommandSupportType supportMove() const { return m_Move; } + virtual CommandSupportType supportCheck() const { return m_Check; } + virtual CommandSupportType supportCopy() const { return m_Copy; } + virtual CommandSupportType supportBackup() const { return m_Backup; } + virtual CommandSupportType supportSetLabel() const { return m_SetLabel; } + virtual CommandSupportType supportUpdateUUID() const { return m_UpdateUUID; } + virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } + + virtual qint64 maxCapacity() const; + + public: + static CommandSupportType m_GetUsed; + static CommandSupportType m_GetLabel; + static CommandSupportType m_Create; + static CommandSupportType m_Grow; + static CommandSupportType m_Shrink; + static CommandSupportType m_Move; + static CommandSupportType m_Check; + static CommandSupportType m_Copy; + static CommandSupportType m_Backup; + static CommandSupportType m_SetLabel; + static CommandSupportType m_UpdateUUID; + static CommandSupportType m_GetUUID; + }; +} + +#endif diff --git a/src/fs/ocfs2.cpp b/src/fs/ocfs2.cpp new file mode 100644 index 0000000..4e74b72 --- /dev/null +++ b/src/fs/ocfs2.cpp @@ -0,0 +1,130 @@ +/*************************************************************************** + * Copyright (C) 2010 by Volker Lanz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "fs/ocfs2.h" + +#include "util/externalcommand.h" +#include "util/capacity.h" + +#include +#include + +#include + +namespace FS +{ + FileSystem::CommandSupportType ocfs2::m_GetUsed = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType ocfs2::m_GetLabel = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType ocfs2::m_Create = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType ocfs2::m_Grow = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType ocfs2::m_Shrink = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType ocfs2::m_Move = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType ocfs2::m_Check = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType ocfs2::m_Copy = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType ocfs2::m_Backup = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType ocfs2::m_SetLabel = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType ocfs2::m_UpdateUUID = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType ocfs2::m_GetUUID = FileSystem::cmdSupportNone; + + ocfs2::ocfs2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) : + FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Ocfs2) + { + } + + void ocfs2::init() + { + m_Create = findExternal("mkfs.ocfs2", QStringList() << "-V") ? cmdSupportFileSystem : cmdSupportNone; + m_Check = findExternal("fsck.ocfs2", QStringList(), 16) ? cmdSupportFileSystem : cmdSupportNone; + m_Grow = (m_Check != cmdSupportNone && findExternal("tunefs.ocfs2", QStringList() << "-V") && findExternal("debugfs.ocfs2", QStringList() << "-V")) ? cmdSupportFileSystem : cmdSupportNone; + m_Shrink = cmdSupportNone; + + // TODO: it seems there's no way to get the FS usage with ocfs2 + m_GetUsed = cmdSupportNone; + + m_SetLabel = findExternal("tunefs.ocfs2", QStringList() << "-V") ? cmdSupportFileSystem : cmdSupportNone; + m_UpdateUUID = findExternal("tunefs.ocfs2", QStringList() << "-V") ? cmdSupportFileSystem : cmdSupportNone; + + m_Copy = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone; + m_Move = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone; + + m_GetLabel = cmdSupportCore; + m_Backup = cmdSupportCore; + m_GetUUID = cmdSupportCore; + } + + qint64 ocfs2::maxCapacity() const + { + return Capacity::unitFactor(Capacity::Byte, Capacity::EiB); + } + + qint64 ocfs2::readUsedCapacity(const QString& deviceNode) const + { + Q_UNUSED(deviceNode); + return -1; + } + + bool ocfs2::check(Report& report, const QString& deviceNode) const + { + ExternalCommand cmd(report, "fsck.ocfs2", QStringList() << "-f" << "-y" << deviceNode); + return cmd.run(-1) && (cmd.exitCode() == 0 || cmd.exitCode() == 1 || cmd.exitCode() == 2); + } + + bool ocfs2::create(Report& report, const QString& deviceNode) const + { + ExternalCommand cmd(report, "mkfs.ocfs2", QStringList() << deviceNode); + + cmd.start(); + cmd.write("y\n"); + cmd.waitFor(-1); + + return cmd.exitCode() == 0; + } + + bool ocfs2::resize(Report& report, const QString& deviceNode, qint64 length) const + { + ExternalCommand cmdBlockSize("debugfs.ocfs2", QStringList() << "-R" << "stats" << deviceNode); + + qint32 blockSize = -1; + if (cmdBlockSize.run()) + { + QRegExp rxBlockSizeBits("Block Size Bits: (\\d+)"); + + if (rxBlockSizeBits.indexIn(cmdBlockSize.output()) != -1) + blockSize = 1 << rxBlockSizeBits.cap(1).toInt(); + } + + if (blockSize == -1) + return false; + + ExternalCommand cmd(report, "tunefs.ocfs2", QStringList() << "-y" << "-S" << deviceNode << QString::number(length / blockSize)); + return cmd.run(-1) && cmd.exitCode() == 0; + } + + bool ocfs2::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel) + { + ExternalCommand cmd(report, "tunefs.ocfs2", QStringList() << "-L" << newLabel << deviceNode); + return cmd.run(-1) && cmd.exitCode() == 0; + } + + bool ocfs2::updateUUID(Report& report, const QString& deviceNode) const + { + ExternalCommand cmd(report, "tunefs.ocfs2", QStringList() << "-U" << deviceNode); + return cmd.run(-1) && cmd.exitCode() == 0; + } +} diff --git a/src/fs/ocfs2.h b/src/fs/ocfs2.h new file mode 100644 index 0000000..e03a89a --- /dev/null +++ b/src/fs/ocfs2.h @@ -0,0 +1,85 @@ +/*************************************************************************** + * Copyright (C) 2010 by Volker Lanz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#if !defined(OCFS2__H) + +#define OCFS2__H + +#include "util/libpartitionmanagerexport.h" + +#include "fs/filesystem.h" + +#include + +class Report; + +class QString; + +namespace FS +{ + /** @brief A ocfs2 file system. + @author vl@fidra.de + */ + class LIBPARTITIONMANAGERPRIVATE_EXPORT ocfs2 : public FileSystem + { + public: + ocfs2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); + + public: + static void init(); + + virtual qint64 readUsedCapacity(const QString& deviceNode) const; + virtual bool check(Report& report, const QString& deviceNode) const; + virtual bool create(Report& report, const QString& deviceNode) const; + virtual bool resize(Report& report, const QString& deviceNode, qint64 length) const; + virtual bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel); + virtual bool updateUUID(Report& report, const QString& deviceNode) const; + + virtual CommandSupportType supportGetUsed() const { return m_GetUsed; } + virtual CommandSupportType supportGetLabel() const { return m_GetLabel; } + virtual CommandSupportType supportCreate() const { return m_Create; } + virtual CommandSupportType supportGrow() const { return m_Grow; } + virtual CommandSupportType supportShrink() const { return m_Shrink; } + virtual CommandSupportType supportMove() const { return m_Move; } + virtual CommandSupportType supportCheck() const { return m_Check; } + virtual CommandSupportType supportCopy() const { return m_Copy; } + virtual CommandSupportType supportBackup() const { return m_Backup; } + virtual CommandSupportType supportSetLabel() const { return m_SetLabel; } + virtual CommandSupportType supportUpdateUUID() const { return m_UpdateUUID; } + virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } + + virtual qint64 maxCapacity() const; + + public: + static CommandSupportType m_GetUsed; + static CommandSupportType m_GetLabel; + static CommandSupportType m_Create; + static CommandSupportType m_Grow; + static CommandSupportType m_Shrink; + static CommandSupportType m_Move; + static CommandSupportType m_Check; + static CommandSupportType m_Copy; + static CommandSupportType m_Backup; + static CommandSupportType m_SetLabel; + static CommandSupportType m_UpdateUUID; + static CommandSupportType m_GetUUID; + }; +} + +#endif diff --git a/src/fs/zfs.cpp b/src/fs/zfs.cpp new file mode 100644 index 0000000..dea54dd --- /dev/null +++ b/src/fs/zfs.cpp @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2010 by Volker Lanz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "fs/zfs.h" + +#include "util/capacity.h" + +#include + +namespace FS +{ + FileSystem::CommandSupportType zfs::m_GetUsed = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType zfs::m_GetLabel = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType zfs::m_Create = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType zfs::m_Grow = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType zfs::m_Shrink = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType zfs::m_Move = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType zfs::m_Check = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType zfs::m_Copy = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType zfs::m_Backup = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType zfs::m_SetLabel = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType zfs::m_UpdateUUID = FileSystem::cmdSupportNone; + FileSystem::CommandSupportType zfs::m_GetUUID = FileSystem::cmdSupportNone; + + zfs::zfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) : + FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Zfs) + { + } + + void zfs::init() + { + } + + qint64 zfs::maxCapacity() const + { + return Capacity::unitFactor(Capacity::Byte, Capacity::EiB); + } +} diff --git a/src/fs/zfs.h b/src/fs/zfs.h new file mode 100644 index 0000000..7844e83 --- /dev/null +++ b/src/fs/zfs.h @@ -0,0 +1,78 @@ +/*************************************************************************** + * Copyright (C) 2010 by Volker Lanz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#if !defined(ZFS__H) + +#define ZFS__H + +#include "util/libpartitionmanagerexport.h" + +#include "fs/filesystem.h" + +#include + +class Report; + +class QString; + +namespace FS +{ + /** @brief A zfs file system. + @author vl@fidra.de + */ + class LIBPARTITIONMANAGERPRIVATE_EXPORT zfs : public FileSystem + { + public: + zfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); + + public: + static void init(); + + virtual CommandSupportType supportGetUsed() const { return m_GetUsed; } + virtual CommandSupportType supportGetLabel() const { return m_GetLabel; } + virtual CommandSupportType supportCreate() const { return m_Create; } + virtual CommandSupportType supportGrow() const { return m_Grow; } + virtual CommandSupportType supportShrink() const { return m_Shrink; } + virtual CommandSupportType supportMove() const { return m_Move; } + virtual CommandSupportType supportCheck() const { return m_Check; } + virtual CommandSupportType supportCopy() const { return m_Copy; } + virtual CommandSupportType supportBackup() const { return m_Backup; } + virtual CommandSupportType supportSetLabel() const { return m_SetLabel; } + virtual CommandSupportType supportUpdateUUID() const { return m_UpdateUUID; } + virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } + + virtual qint64 maxCapacity() const; + + public: + static CommandSupportType m_GetUsed; + static CommandSupportType m_GetLabel; + static CommandSupportType m_Create; + static CommandSupportType m_Grow; + static CommandSupportType m_Shrink; + static CommandSupportType m_Move; + static CommandSupportType m_Check; + static CommandSupportType m_Copy; + static CommandSupportType m_Backup; + static CommandSupportType m_SetLabel; + static CommandSupportType m_UpdateUUID; + static CommandSupportType m_GetUUID; + }; +} + +#endif diff --git a/src/plugins/libparted/libpartedbackend.cpp b/src/plugins/libparted/libpartedbackend.cpp index cab839e..92f96bb 100644 --- a/src/plugins/libparted/libpartedbackend.cpp +++ b/src/plugins/libparted/libpartedbackend.cpp @@ -526,6 +526,11 @@ FileSystem::Type LibPartedBackend::detectFileSystem(PedPartition* pedPartition) else if (strcmp(pedPartition->fs_type->name, "fat32") == 0) rval = FileSystem::Fat32; } + else if (s == "btrfs") rval = FileSystem::Btrfs; + else if (s == "ocfs2") rval = FileSystem::Ocfs2; + else if (s == "zfs") rval = FileSystem::Zfs; + else if (s == "hpfs") rval = FileSystem::Hpfs; + else if (s == "crypto_LUKS") rval = FileSystem::Luks; else kWarning() << "blkid: unknown file system type " << s << " on " << pedPath; }