add a method to the backend plugin interface to let backend plugins set fs

command support types

export the fs implementation class symbols to let backend plugins access them

make the static properties holding the command support information in the
implementations public so backend plugins can change them

rename resizeInternal to resizeBackend in the resize filesystem job

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1119648
This commit is contained in:
Volker Lanz 2010-04-27 14:53:04 +00:00
parent a26bda1ca8
commit be3fbd844a
30 changed files with 117 additions and 56 deletions

7
TODO
View File

@ -1,8 +1,5 @@
Plans and ideas for 1.1: Plans and ideas for 1.1:
* don't hardcode any support for libparted-related stuff like shrinking fat16
in the file system classes.
* save SMART details to html file? * save SMART details to html file?
=============================================================================== ===============================================================================
@ -30,7 +27,9 @@ For releases after 1.1:
libraries to achieve the same things. Libraries in this case being libntfs-3g libraries to achieve the same things. Libraries in this case being libntfs-3g
and libext2fs. There's one for reiserfs too, iirc. and libext2fs. There's one for reiserfs too, iirc.
* Convert the fs implementations into plugins. * Convert the fs implementations into plugins. Redesign the support-stuff, make
that more flexible (no statics in the FS classes, some helper class or at
least an array in FileSystem).
* Write a udisks backend plugin. * Write a udisks backend plugin.

View File

@ -53,6 +53,8 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT CoreBackend : public QObject
public: public:
virtual const KAboutData& about() const { return *m_AboutData; } virtual const KAboutData& about() const { return *m_AboutData; }
virtual void initFSSupport() = 0;
virtual QList<Device*> scanDevices() = 0; virtual QList<Device*> scanDevices() = 0;
virtual Device* scanDevice(const QString& device_node) = 0; virtual Device* scanDevice(const QString& device_node) = 0;
virtual CoreBackendDevice* openDevice(const QString& device_node) = 0; virtual CoreBackendDevice* openDevice(const QString& device_node) = 0;

View File

@ -21,6 +21,8 @@
#define EXT2__H #define EXT2__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include <qglobal.h> #include <qglobal.h>
@ -34,7 +36,7 @@ namespace FS
/** @brief An ext2 file system. /** @brief An ext2 file system.
@author vl@fidra.de @author vl@fidra.de
*/ */
class ext2 : public FileSystem class LIBPARTITIONMANAGERPRIVATE_EXPORT ext2 : public FileSystem
{ {
public: public:
ext2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t = FileSystem::Ext2); ext2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t = FileSystem::Ext2);
@ -64,7 +66,7 @@ namespace FS
virtual qint64 maxCapacity() const; virtual qint64 maxCapacity() const;
protected: public:
static CommandSupportType m_GetUsed; static CommandSupportType m_GetUsed;
static CommandSupportType m_GetLabel; static CommandSupportType m_GetLabel;
static CommandSupportType m_Create; static CommandSupportType m_Create;

View File

@ -21,6 +21,8 @@
#define EXT3__H #define EXT3__H
#include "util/libpartitionmanagerexport.h"
#include "fs/ext2.h" #include "fs/ext2.h"
#include <qglobal.h> #include <qglobal.h>
@ -37,7 +39,7 @@ namespace FS
@author vl@fidra.de @author vl@fidra.de
*/ */
class ext3 : public ext2 class LIBPARTITIONMANAGERPRIVATE_EXPORT ext3 : public ext2
{ {
public: public:
ext3(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); ext3(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);

View File

@ -21,6 +21,8 @@
#define EXT4__H #define EXT4__H
#include "util/libpartitionmanagerexport.h"
#include "fs/ext2.h" #include "fs/ext2.h"
#include <qglobal.h> #include <qglobal.h>
@ -37,7 +39,7 @@ namespace FS
@author vl@fidra.de @author vl@fidra.de
*/ */
class ext4 : public ext2 class LIBPARTITIONMANAGERPRIVATE_EXPORT ext4 : public ext2
{ {
public: public:
ext4(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); ext4(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);

View File

@ -21,6 +21,8 @@
#define EXTENDED__H #define EXTENDED__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include <qglobal.h> #include <qglobal.h>
@ -30,14 +32,14 @@ class QString;
namespace FS namespace FS
{ {
/** @brief An extended file system. /** @brief An extended file system.
A FileSystem for an extended Partition. Of course, extended partitions do not actually have A FileSystem for an extended Partition. Of course, extended partitions do not actually have
a file system, but we need this to be able to create, grow, shrink or move them. a file system, but we need this to be able to create, grow, shrink or move them.
@author vl@fidra.de @author vl@fidra.de
*/ */
class extended : public FileSystem class LIBPARTITIONMANAGERPRIVATE_EXPORT extended : public FileSystem
{ {
public: public:
extended(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); extended(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
@ -51,8 +53,8 @@ namespace FS
virtual CommandSupportType supportGrow() const { return m_Grow; } virtual CommandSupportType supportGrow() const { return m_Grow; }
virtual CommandSupportType supportShrink() const { return m_Shrink; } virtual CommandSupportType supportShrink() const { return m_Shrink; }
virtual CommandSupportType supportMove() const { return m_Move; } virtual CommandSupportType supportMove() const { return m_Move; }
protected: public:
static CommandSupportType m_Create; static CommandSupportType m_Create;
static CommandSupportType m_Grow; static CommandSupportType m_Grow;
static CommandSupportType m_Shrink; static CommandSupportType m_Shrink;

View File

@ -60,8 +60,8 @@ namespace FS
m_GetUsed = m_Check = findExternal("fsck.msdos", QStringList(), 2) ? cmdSupportFileSystem : cmdSupportNone; m_GetUsed = m_Check = findExternal("fsck.msdos", QStringList(), 2) ? cmdSupportFileSystem : cmdSupportNone;
m_GetLabel = cmdSupportCore; m_GetLabel = cmdSupportCore;
m_SetLabel = cmdSupportFileSystem; m_SetLabel = cmdSupportFileSystem;
m_Grow = cmdSupportCore; m_Grow = cmdSupportNone;
m_Shrink = cmdSupportCore; m_Shrink = cmdSupportNone;
m_Move = cmdSupportCore; m_Move = cmdSupportCore;
m_Copy = cmdSupportCore; m_Copy = cmdSupportCore;
m_Backup = cmdSupportCore; m_Backup = cmdSupportCore;

View File

@ -21,6 +21,8 @@
#define FAT16__H #define FAT16__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include <qglobal.h> #include <qglobal.h>
@ -34,7 +36,7 @@ namespace FS
/** @brief A fat16 file system. /** @brief A fat16 file system.
@author vl@fidra.de @author vl@fidra.de
*/ */
class fat16 : public FileSystem class LIBPARTITIONMANAGERPRIVATE_EXPORT fat16 : public FileSystem
{ {
public: public:
fat16(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t = FileSystem::Fat16); fat16(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, FileSystem::Type t = FileSystem::Fat16);
@ -64,7 +66,7 @@ namespace FS
virtual qint64 minCapacity() const; virtual qint64 minCapacity() const;
virtual qint64 maxCapacity() const; virtual qint64 maxCapacity() const;
protected: public:
static CommandSupportType m_GetUsed; static CommandSupportType m_GetUsed;
static CommandSupportType m_GetLabel; static CommandSupportType m_GetLabel;
static CommandSupportType m_SetLabel; static CommandSupportType m_SetLabel;

View File

@ -21,6 +21,8 @@
#define FAT32__H #define FAT32__H
#include "util/libpartitionmanagerexport.h"
#include "fs/fat16.h" #include "fs/fat16.h"
#include <qglobal.h> #include <qglobal.h>
@ -37,7 +39,7 @@ namespace FS
@author vl@fidra.de @author vl@fidra.de
*/ */
class fat32 : public fat16 class LIBPARTITIONMANAGERPRIVATE_EXPORT fat32 : public fat16
{ {
public: public:
fat32(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); fat32(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
@ -47,7 +49,7 @@ namespace FS
virtual bool create(Report& report, const QString& deviceNode) const; virtual bool create(Report& report, const QString& deviceNode) const;
virtual bool updateUUID(Report& report, const QString& deviceNode) const; virtual bool updateUUID(Report& report, const QString& deviceNode) const;
virtual qint64 minCapacity() const; virtual qint64 minCapacity() const;
virtual qint64 maxCapacity() const; virtual qint64 maxCapacity() const;
}; };

View File

@ -69,9 +69,10 @@ class FileSystem
/** The type of support for a given FileSystem action */ /** The type of support for a given FileSystem action */
enum CommandSupportType enum CommandSupportType
{ {
cmdSupportNone = 0, /**< no support */ cmdSupportNone = 0, /**< no support */
cmdSupportCore = 1, /**< internal support */ cmdSupportCore = 1, /**< internal support */
cmdSupportFileSystem = 2 /**< supported by some external command */ cmdSupportFileSystem = 2, /**< supported by some external command */
cmdSupportBackend = 4 /**< supported by the backend */
}; };
Q_DECLARE_FLAGS(CommandSupportTypes, CommandSupportType) Q_DECLARE_FLAGS(CommandSupportTypes, CommandSupportType)

View File

@ -38,6 +38,9 @@
#include "fs/unknown.h" #include "fs/unknown.h"
#include "fs/xfs.h" #include "fs/xfs.h"
#include "backend/corebackendmanager.h"
#include "backend/corebackend.h"
FileSystemFactory::FileSystems FileSystemFactory::m_FileSystems; FileSystemFactory::FileSystems FileSystemFactory::m_FileSystems;
/** Initializes the instance. */ /** Initializes the instance. */
@ -81,6 +84,8 @@ void FileSystemFactory::init()
FS::unformatted::init(); FS::unformatted::init();
FS::unknown::init(); FS::unknown::init();
FS::xfs::init(); FS::xfs::init();
CoreBackendManager::self()->backend()->initFSSupport();
} }
/** Creates a new FileSystem /** Creates a new FileSystem

View File

@ -48,7 +48,7 @@ namespace FS
m_Check = findExternal("hfsck") ? cmdSupportFileSystem : cmdSupportNone; m_Check = findExternal("hfsck") ? cmdSupportFileSystem : cmdSupportNone;
m_GetUsed = cmdSupportCore; m_GetUsed = cmdSupportCore;
m_Shrink = cmdSupportCore; m_Shrink = cmdSupportNone;
m_Move = m_Copy = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone; m_Move = m_Copy = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone;
m_Backup = cmdSupportCore; m_Backup = cmdSupportCore;

View File

@ -21,6 +21,8 @@
#define HFS__H #define HFS__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include <qglobal.h> #include <qglobal.h>
@ -34,7 +36,7 @@ namespace FS
/** @brief An hfs file system. /** @brief An hfs file system.
@author vl@fidra.de @author vl@fidra.de
*/ */
class hfs : public FileSystem class LIBPARTITIONMANAGERPRIVATE_EXPORT hfs : public FileSystem
{ {
public: public:
hfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); hfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
@ -56,7 +58,7 @@ namespace FS
virtual qint64 maxCapacity() const; virtual qint64 maxCapacity() const;
protected: public:
static CommandSupportType m_GetUsed; static CommandSupportType m_GetUsed;
static CommandSupportType m_GetLabel; static CommandSupportType m_GetLabel;
static CommandSupportType m_Create; static CommandSupportType m_Create;

View File

@ -43,7 +43,7 @@ namespace FS
m_Check = findExternal("hpfsck") ? cmdSupportFileSystem : cmdSupportNone; m_Check = findExternal("hpfsck") ? cmdSupportFileSystem : cmdSupportNone;
m_GetUsed = cmdSupportCore; m_GetUsed = cmdSupportCore;
m_Shrink = cmdSupportCore; m_Shrink = cmdSupportNone;
m_Copy = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone; m_Copy = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone;
m_Move = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone; m_Move = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone;
m_Backup = cmdSupportCore; m_Backup = cmdSupportCore;
@ -53,7 +53,7 @@ namespace FS
{ {
return Capacity::unitFactor(Capacity::Byte, Capacity::EiB); return Capacity::unitFactor(Capacity::Byte, Capacity::EiB);
} }
bool hfsplus::check(Report& report, const QString& deviceNode) const bool hfsplus::check(Report& report, const QString& deviceNode) const
{ {
ExternalCommand cmd(report, "hpfsck", QStringList() << "-v" << deviceNode); ExternalCommand cmd(report, "hpfsck", QStringList() << "-v" << deviceNode);

View File

@ -21,6 +21,8 @@
#define HFSPLUS__H #define HFSPLUS__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include <qglobal.h> #include <qglobal.h>
@ -34,7 +36,7 @@ namespace FS
/** @brief An hfsplus file system. /** @brief An hfsplus file system.
@author vl@fidra.de @author vl@fidra.de
*/ */
class hfsplus : public FileSystem class LIBPARTITIONMANAGERPRIVATE_EXPORT hfsplus : public FileSystem
{ {
public: public:
hfsplus(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); hfsplus(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
@ -50,10 +52,10 @@ namespace FS
virtual CommandSupportType supportCheck() const { return m_Check; } virtual CommandSupportType supportCheck() const { return m_Check; }
virtual CommandSupportType supportCopy() const { return m_Copy; } virtual CommandSupportType supportCopy() const { return m_Copy; }
virtual CommandSupportType supportBackup() const { return m_Backup; } virtual CommandSupportType supportBackup() const { return m_Backup; }
virtual qint64 maxCapacity() const; virtual qint64 maxCapacity() const;
protected: public:
static CommandSupportType m_GetUsed; static CommandSupportType m_GetUsed;
static CommandSupportType m_Shrink; static CommandSupportType m_Shrink;
static CommandSupportType m_Move; static CommandSupportType m_Move;

View File

@ -21,6 +21,8 @@
#define JFS__H #define JFS__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include <qglobal.h> #include <qglobal.h>
@ -34,7 +36,7 @@ namespace FS
/** @brief A JFS file system. /** @brief A JFS file system.
@author vl@fidra.de @author vl@fidra.de
*/ */
class jfs : public FileSystem class LIBPARTITIONMANAGERPRIVATE_EXPORT jfs : public FileSystem
{ {
public: public:
jfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); jfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
@ -60,7 +62,7 @@ namespace FS
virtual qint64 minCapacity() const; virtual qint64 minCapacity() const;
protected: public:
static CommandSupportType m_GetUsed; static CommandSupportType m_GetUsed;
static CommandSupportType m_GetLabel; static CommandSupportType m_GetLabel;
static CommandSupportType m_Create; static CommandSupportType m_Create;

View File

@ -21,6 +21,8 @@
#define LINUXSWAP__H #define LINUXSWAP__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include <qglobal.h> #include <qglobal.h>
@ -34,7 +36,7 @@ namespace FS
/** @brief A linux swap pseudo file system. /** @brief A linux swap pseudo file system.
@author vl@fidra.de @author vl@fidra.de
*/ */
class linuxswap : public FileSystem class LIBPARTITIONMANAGERPRIVATE_EXPORT linuxswap : public FileSystem
{ {
public: public:
linuxswap(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); linuxswap(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
@ -64,7 +66,7 @@ namespace FS
virtual CommandSupportType supportSetLabel() const { return m_SetLabel; } virtual CommandSupportType supportSetLabel() const { return m_SetLabel; }
virtual CommandSupportType supportGetUUID() const { return m_GetUUID; } virtual CommandSupportType supportGetUUID() const { return m_GetUUID; }
protected: public:
static CommandSupportType m_Create; static CommandSupportType m_Create;
static CommandSupportType m_Grow; static CommandSupportType m_Grow;
static CommandSupportType m_Shrink; static CommandSupportType m_Shrink;

View File

@ -21,6 +21,8 @@
#define NTFS__H #define NTFS__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include <qglobal.h> #include <qglobal.h>
@ -34,7 +36,7 @@ namespace FS
/** @brief An NTFS file system. /** @brief An NTFS file system.
@author vl@fidra.de @author vl@fidra.de
*/ */
class ntfs : public FileSystem class LIBPARTITIONMANAGERPRIVATE_EXPORT ntfs : public FileSystem
{ {
public: public:
ntfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); ntfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
@ -66,7 +68,7 @@ namespace FS
virtual qint64 maxCapacity() const; virtual qint64 maxCapacity() const;
protected: public:
static CommandSupportType m_GetUsed; static CommandSupportType m_GetUsed;
static CommandSupportType m_GetLabel; static CommandSupportType m_GetLabel;
static CommandSupportType m_Create; static CommandSupportType m_Create;

View File

@ -21,6 +21,8 @@
#define REISER4__H #define REISER4__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include <qglobal.h> #include <qglobal.h>
@ -34,7 +36,7 @@ namespace FS
/** @brief A Reiser4 file system. /** @brief A Reiser4 file system.
@author vl@fidra.de @author vl@fidra.de
*/ */
class reiser4 : public FileSystem class LIBPARTITIONMANAGERPRIVATE_EXPORT reiser4 : public FileSystem
{ {
public: public:
reiser4(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); reiser4(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
@ -54,7 +56,7 @@ namespace FS
virtual CommandSupportType supportCopy() const { return m_Copy; } virtual CommandSupportType supportCopy() const { return m_Copy; }
virtual CommandSupportType supportBackup() const { return m_Backup; } virtual CommandSupportType supportBackup() const { return m_Backup; }
protected: public:
static CommandSupportType m_GetUsed; static CommandSupportType m_GetUsed;
static CommandSupportType m_GetLabel; static CommandSupportType m_GetLabel;
static CommandSupportType m_Create; static CommandSupportType m_Create;

View File

@ -21,6 +21,8 @@
#define REISERFS__H #define REISERFS__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include "util/capacity.h" #include "util/capacity.h"
@ -36,7 +38,7 @@ namespace FS
/** @brief A ReiserFS file system. /** @brief A ReiserFS file system.
@author vl@fidra.de @author vl@fidra.de
*/ */
class reiserfs : public FileSystem class LIBPARTITIONMANAGERPRIVATE_EXPORT reiserfs : public FileSystem
{ {
public: public:
reiserfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); reiserfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
@ -67,7 +69,7 @@ namespace FS
virtual qint64 minCapacity() const; virtual qint64 minCapacity() const;
virtual qint64 maxCapacity() const; virtual qint64 maxCapacity() const;
protected: public:
static CommandSupportType m_GetUsed; static CommandSupportType m_GetUsed;
static CommandSupportType m_GetLabel; static CommandSupportType m_GetLabel;
static CommandSupportType m_Create; static CommandSupportType m_Create;

View File

@ -21,6 +21,8 @@
#define UFS__H #define UFS__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include <qglobal.h> #include <qglobal.h>
@ -32,7 +34,7 @@ namespace FS
/** @brief A UFS file system. /** @brief A UFS file system.
@author vl@fidra.de @author vl@fidra.de
*/ */
class ufs : public FileSystem class LIBPARTITIONMANAGERPRIVATE_EXPORT ufs : public FileSystem
{ {
public: public:
ufs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); ufs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
@ -43,8 +45,8 @@ namespace FS
virtual CommandSupportType supportMove() const { return m_Move; } virtual CommandSupportType supportMove() const { return m_Move; }
virtual CommandSupportType supportCopy() const { return m_Copy; } virtual CommandSupportType supportCopy() const { return m_Copy; }
virtual CommandSupportType supportBackup() const { return m_Backup; } virtual CommandSupportType supportBackup() const { return m_Backup; }
protected: public:
static CommandSupportType m_Move; static CommandSupportType m_Move;
static CommandSupportType m_Copy; static CommandSupportType m_Copy;
static CommandSupportType m_Backup; static CommandSupportType m_Backup;

View File

@ -21,6 +21,8 @@
#define UNFORMATTED__H #define UNFORMATTED__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include <qglobal.h> #include <qglobal.h>
@ -34,19 +36,19 @@ namespace FS
/** @brief A pseudo file system for unformatted partitions. /** @brief A pseudo file system for unformatted partitions.
@author vl@fidra.de @author vl@fidra.de
*/ */
class unformatted : public FileSystem class LIBPARTITIONMANAGERPRIVATE_EXPORT unformatted : public FileSystem
{ {
public: public:
unformatted(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); unformatted(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
public: public:
static void init() {} static void init() {}
virtual bool create(Report&, const QString&) const; virtual bool create(Report&, const QString&) const;
virtual CommandSupportType supportCreate() const { return m_Create; } virtual CommandSupportType supportCreate() const { return m_Create; }
protected: public:
static CommandSupportType m_Create; static CommandSupportType m_Create;
}; };
} }

View File

@ -21,6 +21,8 @@
#define UNKNOWN__H #define UNKNOWN__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include <qglobal.h> #include <qglobal.h>
@ -30,7 +32,7 @@ namespace FS
/** @brief A pseudo file system for partitions whose file system we cannot determine. /** @brief A pseudo file system for partitions whose file system we cannot determine.
@author vl@fidra.de @author vl@fidra.de
*/ */
class unknown : public FileSystem class LIBPARTITIONMANAGERPRIVATE_EXPORT unknown : public FileSystem
{ {
public: public:
unknown(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); unknown(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);

View File

@ -21,6 +21,8 @@
#define XFS__H #define XFS__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include <qglobal.h> #include <qglobal.h>
@ -34,7 +36,7 @@ namespace FS
/** @brief An XFS file system. /** @brief An XFS file system.
@author vl@fidra.de @author vl@fidra.de
*/ */
class xfs : public FileSystem class LIBPARTITIONMANAGERPRIVATE_EXPORT xfs : public FileSystem
{ {
public: public:
xfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); xfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
@ -61,7 +63,7 @@ namespace FS
virtual qint64 minCapacity() const; virtual qint64 minCapacity() const;
protected: public:
static CommandSupportType m_GetUsed; static CommandSupportType m_GetUsed;
static CommandSupportType m_GetLabel; static CommandSupportType m_GetLabel;
static CommandSupportType m_Create; static CommandSupportType m_Create;

View File

@ -83,11 +83,11 @@ bool ResizeFileSystemJob::run(Report& parent)
switch(support) switch(support)
{ {
case FileSystem::cmdSupportCore: case FileSystem::cmdSupportBackend:
{ {
Report* childReport = report->newChild(); Report* childReport = report->newChild();
childReport->line() << i18nc("@info/plain", "Resizing a %1 file system using internal backend functions.", partition().fileSystem().name()); childReport->line() << i18nc("@info/plain", "Resizing a %1 file system using internal backend functions.", partition().fileSystem().name());
rval = resizeFileSystemInternal(*childReport); rval = resizeFileSystemBackend(*childReport);
break; break;
} }
@ -112,7 +112,7 @@ bool ResizeFileSystemJob::run(Report& parent)
return rval; return rval;
} }
bool ResizeFileSystemJob::resizeFileSystemInternal(Report& report) bool ResizeFileSystemJob::resizeFileSystemBackend(Report& report)
{ {
bool rval = false; bool rval = false;

View File

@ -47,7 +47,7 @@ class ResizeFileSystemJob : public Job
virtual QString description() const; virtual QString description() const;
protected: protected:
bool resizeFileSystemInternal(Report& report); bool resizeFileSystemBackend(Report& report);
Partition& partition() { return m_Partition; } Partition& partition() { return m_Partition; }
const Partition& partition() const { return m_Partition; } const Partition& partition() const { return m_Partition; }

View File

@ -64,6 +64,10 @@ DummyBackend::DummyBackend(QObject*, const QList<QVariant>&) :
{ {
} }
void DummyBackend::initFSSupport()
{
}
QList<Device*> DummyBackend::scanDevices() QList<Device*> DummyBackend::scanDevices()
{ {
QList<Device*> result; QList<Device*> result;

View File

@ -44,6 +44,8 @@ class DummyBackend : public CoreBackend
DummyBackend(QObject* parent, const QList<QVariant>& args); DummyBackend(QObject* parent, const QList<QVariant>& args);
public: public:
virtual void initFSSupport();
virtual QList<Device*> scanDevices(); virtual QList<Device*> scanDevices();
virtual CoreBackendDevice* openDevice(const QString& device_node); virtual CoreBackendDevice* openDevice(const QString& device_node);
virtual CoreBackendDevice* openDeviceExclusive(const QString& device_node); virtual CoreBackendDevice* openDeviceExclusive(const QString& device_node);

View File

@ -31,6 +31,10 @@
#include "fs/filesystem.h" #include "fs/filesystem.h"
#include "fs/filesystemfactory.h" #include "fs/filesystemfactory.h"
#include "fs/fat16.h"
#include "fs/hfs.h"
#include "fs/hfsplus.h"
#include "util/globallog.h" #include "util/globallog.h"
#include <QString> #include <QString>
@ -276,6 +280,14 @@ LibPartedBackend::LibPartedBackend(QObject*, const QList<QVariant>&) :
ped_exception_set_handler(pedExceptionHandler); ped_exception_set_handler(pedExceptionHandler);
} }
void LibPartedBackend::initFSSupport()
{
FS::fat16::m_Shrink = FileSystem::cmdSupportBackend;
FS::fat16::m_Grow = FileSystem::cmdSupportBackend;
FS::hfs::m_Shrink = FileSystem::cmdSupportBackend;
FS::hfsplus::m_Shrink = FileSystem::cmdSupportBackend;
}
/** Scans a Device for Partitions. /** Scans a Device for Partitions.
This method will scan a Device for all Partitions on it, detect the FileSystem for each Partition, This method will scan a Device for all Partitions on it, detect the FileSystem for each Partition,

View File

@ -59,6 +59,8 @@ class LibPartedBackend : public CoreBackend
LibPartedBackend(QObject* parent, const QList<QVariant>& args); LibPartedBackend(QObject* parent, const QList<QVariant>& args);
public: public:
virtual void initFSSupport();
virtual CoreBackendDevice* openDevice(const QString& device_node); virtual CoreBackendDevice* openDevice(const QString& device_node);
virtual CoreBackendDevice* openDeviceExclusive(const QString& device_node); virtual CoreBackendDevice* openDeviceExclusive(const QString& device_node);
virtual bool closeDevice(CoreBackendDevice* core_device); virtual bool closeDevice(CoreBackendDevice* core_device);