Add support for detecting ISO9660 file systems.

BUG: 364476
This commit is contained in:
Andrius Štikonas 2017-09-08 11:41:25 +01:00
parent 2cfcefd9c9
commit 5a83e741cb
8 changed files with 84 additions and 3 deletions

View File

@ -13,6 +13,7 @@ set(FS_SRC
fs/hfs.cpp fs/hfs.cpp
fs/hfsplus.cpp fs/hfsplus.cpp
fs/hpfs.cpp fs/hpfs.cpp
fs/iso9660.cpp
fs/jfs.cpp fs/jfs.cpp
fs/linuxswap.cpp fs/linuxswap.cpp
fs/luks.cpp fs/luks.cpp
@ -45,6 +46,7 @@ set(FS_LIB_HDRS
fs/hfs.h fs/hfs.h
fs/hfsplus.h fs/hfsplus.h
fs/hpfs.h fs/hpfs.h
fs/iso9660.h
fs/jfs.h fs/jfs.h
fs/linuxswap.h fs/linuxswap.h
fs/luks.h fs/luks.h

View File

@ -63,7 +63,8 @@ const std::array< QColor, FileSystem::__lastType > FileSystem::defaultColorCode
QColor( 242,155,104 ), QColor( 242,155,104 ),
QColor( 160,210,180 ), QColor( 160,210,180 ),
QColor( 255,170,0 ), QColor( 255,170,0 ),
QColor( 170, 120, 255) QColor( 170, 120, 255 ),
QColor( 177, 82, 69 )
} }
}; };
@ -434,6 +435,7 @@ static const QString* typeNames()
xi18nc("@item filesystem name", "lvm2 pv"), xi18nc("@item filesystem name", "lvm2 pv"),
xi18nc("@item filesystem name", "f2fs"), xi18nc("@item filesystem name", "f2fs"),
xi18nc("@item filesystem name", "udf"), xi18nc("@item filesystem name", "udf"),
xi18nc("@item filesystem name", "iso9660"),
}; };
return s; return s;

View File

@ -86,8 +86,9 @@ public:
Lvm2_PV = 24, Lvm2_PV = 24,
F2fs = 25, F2fs = 25,
Udf = 26, Udf = 26,
Iso9660 = 27,
__lastType = 27 __lastType = 28
}; };
/** The type of support for a given FileSystem action */ /** The type of support for a given FileSystem action */

View File

@ -31,6 +31,7 @@
#include "fs/hfs.h" #include "fs/hfs.h"
#include "fs/hfsplus.h" #include "fs/hfsplus.h"
#include "fs/hpfs.h" #include "fs/hpfs.h"
#include "fs/iso9660.h"
#include "fs/jfs.h" #include "fs/jfs.h"
#include "fs/linuxswap.h" #include "fs/linuxswap.h"
#include "fs/luks.h" #include "fs/luks.h"
@ -70,6 +71,7 @@ void FileSystemFactory::init()
m_FileSystems.insert(FileSystem::Hfs, new FS::hfs(-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::HfsPlus, new FS::hfsplus(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Hpfs, new FS::hpfs(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Hpfs, new FS::hpfs(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Iso9660, new FS::iso9660(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Jfs, new FS::jfs(-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::LinuxSwap, new FS::linuxswap(-1, -1, -1, QString()));
m_FileSystems.insert(FileSystem::Luks, new FS::luks(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Luks, new FS::luks(-1, -1, -1, QString()));
@ -117,6 +119,7 @@ FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qi
case FileSystem::Hfs: fs = new FS::hfs(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::HfsPlus: fs = new FS::hfsplus(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Hpfs: fs = new FS::hpfs(firstsector, lastsector, sectorsused, label); break; case FileSystem::Hpfs: fs = new FS::hpfs(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Iso9660: fs = new FS::iso9660(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Jfs: fs = new FS::jfs(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::LinuxSwap: fs = new FS::linuxswap(firstsector, lastsector, sectorsused, label); break;
case FileSystem::Luks: fs = new FS::luks(firstsector, lastsector, sectorsused, label); break; case FileSystem::Luks: fs = new FS::luks(firstsector, lastsector, sectorsused, label); break;

28
src/fs/iso9660.cpp Normal file
View File

@ -0,0 +1,28 @@
/*************************************************************************
* Copyright (C) 2017 by Andrius Štikonas <andrius@stikonas.eu> *
* *
* 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 3 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, see <http://www.gnu.org/licenses/>.*
*************************************************************************/
#include "fs/iso9660.h"
namespace FS
{
iso9660::iso9660(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Iso9660)
{
}
}

43
src/fs/iso9660.h Normal file
View File

@ -0,0 +1,43 @@
/*************************************************************************
* Copyright (C) 2017 by Andrius Štikonas <andrius@stikonas.eu> *
* *
* 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 3 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, see <http://www.gnu.org/licenses/>.*
*************************************************************************/
#if !defined(ISO9660__H)
#define ISO9660__H
#include "util/libpartitionmanagerexport.h"
#include "fs/filesystem.h"
class Report;
class QString;
namespace FS
{
/** A iso9660 file system.
@author Andrius Štikonas <andrius@stikonas.eu>
*/
class LIBKPMCORE_EXPORT iso9660 : public FileSystem
{
public:
iso9660(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
};
}
#endif

View File

@ -513,6 +513,7 @@ FileSystem::Type LibPartedBackend::detectFileSystem(const QString& partitionPath
else if (s == QStringLiteral("LVM2_member")) rval = FileSystem::Lvm2_PV; else if (s == QStringLiteral("LVM2_member")) rval = FileSystem::Lvm2_PV;
else if (s == QStringLiteral("f2fs")) rval = FileSystem::F2fs; else if (s == QStringLiteral("f2fs")) rval = FileSystem::F2fs;
else if (s == QStringLiteral("udf")) rval = FileSystem::Udf; else if (s == QStringLiteral("udf")) rval = FileSystem::Udf;
else if (s == QStringLiteral("iso9660")) rval = FileSystem::Iso9660;
else else
qWarning() << "blkid: unknown file system type " << s << " on " << partitionPath; qWarning() << "blkid: unknown file system type " << s << " on " << partitionPath;
} }

View File

@ -117,7 +117,8 @@ static const struct {
{ FileSystem::Hfs, QStringLiteral("hfs") }, { FileSystem::Hfs, QStringLiteral("hfs") },
{ FileSystem::HfsPlus, QStringLiteral("hfs+") }, { FileSystem::HfsPlus, QStringLiteral("hfs+") },
{ FileSystem::Ufs, QStringLiteral("ufs") }, { FileSystem::Ufs, QStringLiteral("ufs") },
{ FileSystem::Udf, QStringLiteral("ntfs") } { FileSystem::Udf, QStringLiteral("ntfs") },
{ FileSystem::Iso9660, QStringLiteral("iso9660") }
}; };
static PedFileSystemType* getPedFileSystemType(FileSystem::Type t) static PedFileSystemType* getPedFileSystemType(FileSystem::Type t)