Add support for getting fat16 and fat32 volume labels (no support for setting,
still). svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=964225
This commit is contained in:
parent
9a1a21f3e7
commit
9c5580d1e2
|
@ -22,6 +22,8 @@
|
||||||
#include "util/externalcommand.h"
|
#include "util/externalcommand.h"
|
||||||
#include "util/capacity.h"
|
#include "util/capacity.h"
|
||||||
|
|
||||||
|
#include <kdebug.h>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
|
@ -31,6 +33,7 @@
|
||||||
namespace FS
|
namespace FS
|
||||||
{
|
{
|
||||||
FileSystem::SupportType fat16::m_GetUsed = FileSystem::SupportNone;
|
FileSystem::SupportType fat16::m_GetUsed = FileSystem::SupportNone;
|
||||||
|
FileSystem::SupportType fat16::m_GetLabel = FileSystem::SupportNone;
|
||||||
FileSystem::SupportType fat16::m_Create = FileSystem::SupportNone;
|
FileSystem::SupportType fat16::m_Create = FileSystem::SupportNone;
|
||||||
FileSystem::SupportType fat16::m_Grow = FileSystem::SupportNone;
|
FileSystem::SupportType fat16::m_Grow = FileSystem::SupportNone;
|
||||||
FileSystem::SupportType fat16::m_Shrink = FileSystem::SupportNone;
|
FileSystem::SupportType fat16::m_Shrink = FileSystem::SupportNone;
|
||||||
|
@ -48,13 +51,14 @@ namespace FS
|
||||||
|
|
||||||
void fat16::init()
|
void fat16::init()
|
||||||
{
|
{
|
||||||
// There is no support for getting or setting labels for FAT16 and FAT32 right now.
|
// There is no support for setting labels for FAT16 and FAT32 right now.
|
||||||
// The mtools package is able to do that, but requires mappings from Unix device nodes
|
// The mtools package is able to do that, but requires mappings from Unix device nodes
|
||||||
// to Windows-like drive letters -- something we cannot support. It would, however,
|
// to Windows-like drive letters -- something we cannot support. It would, however,
|
||||||
// probably be possible to implement the file system label stuff ourselves here.
|
// probably be possible to implement the file system label stuff ourselves here.
|
||||||
|
|
||||||
m_Create = findExternal("mkfs.msdos") ? SupportExternal : SupportNone;
|
m_Create = findExternal("mkfs.msdos") ? SupportExternal : SupportNone;
|
||||||
m_GetUsed = m_Check = findExternal("fsck.msdos", QStringList(), 2) ? SupportExternal : SupportNone;
|
m_GetUsed = m_Check = findExternal("fsck.msdos", QStringList(), 2) ? SupportExternal : SupportNone;
|
||||||
|
m_GetLabel = findExternal("vol_id") ? SupportExternal : SupportNone;
|
||||||
m_Grow = SupportLibParted;
|
m_Grow = SupportLibParted;
|
||||||
m_Shrink = SupportLibParted;
|
m_Shrink = SupportLibParted;
|
||||||
m_Move = SupportInternal;
|
m_Move = SupportInternal;
|
||||||
|
@ -129,4 +133,19 @@ namespace FS
|
||||||
|
|
||||||
return cmd.waitFor(-1);
|
return cmd.waitFor(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString fat16::readLabel(const QString& deviceNode) const
|
||||||
|
{
|
||||||
|
ExternalCommand cmd("vol_id", QStringList() << deviceNode);
|
||||||
|
|
||||||
|
if (cmd.run())
|
||||||
|
{
|
||||||
|
QRegExp rxLabel("ID_FS_LABEL=(\\w+)");
|
||||||
|
|
||||||
|
if (rxLabel.indexIn(cmd.output()) != -1)
|
||||||
|
return rxLabel.cap(1).simplified();
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,11 +43,13 @@ namespace FS
|
||||||
static void init();
|
static void init();
|
||||||
|
|
||||||
virtual qint64 readUsedCapacity(const QString& deviceNode) const;
|
virtual qint64 readUsedCapacity(const QString& deviceNode) const;
|
||||||
|
virtual QString readLabel(const QString& deviceNode) const;
|
||||||
virtual bool check(Report& report, const QString& deviceNode) const;
|
virtual bool check(Report& report, const QString& deviceNode) const;
|
||||||
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 SupportType supportGetUsed() const { return m_GetUsed; }
|
virtual SupportType supportGetUsed() const { return m_GetUsed; }
|
||||||
|
virtual SupportType supportGetLabel() const { return m_GetLabel; }
|
||||||
virtual SupportType supportCreate() const { return m_Create; }
|
virtual SupportType supportCreate() const { return m_Create; }
|
||||||
virtual SupportType supportGrow() const { return m_Grow; }
|
virtual SupportType supportGrow() const { return m_Grow; }
|
||||||
virtual SupportType supportShrink() const { return m_Shrink; }
|
virtual SupportType supportShrink() const { return m_Shrink; }
|
||||||
|
@ -62,6 +64,7 @@ namespace FS
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static SupportType m_GetUsed;
|
static SupportType m_GetUsed;
|
||||||
|
static SupportType m_GetLabel;
|
||||||
static SupportType m_Create;
|
static SupportType m_Create;
|
||||||
static SupportType m_Grow;
|
static SupportType m_Grow;
|
||||||
static SupportType m_Shrink;
|
static SupportType m_Shrink;
|
||||||
|
|
Loading…
Reference in New Issue