From 5a83e741cb1af5e2a8130dd7b539de3b1fd8296b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Fri, 8 Sep 2017 11:41:25 +0100 Subject: [PATCH] Add support for detecting ISO9660 file systems. BUG: 364476 --- src/fs/CMakeLists.txt | 2 + src/fs/filesystem.cpp | 4 +- src/fs/filesystem.h | 3 +- src/fs/filesystemfactory.cpp | 3 ++ src/fs/iso9660.cpp | 28 ++++++++++++ src/fs/iso9660.h | 43 +++++++++++++++++++ src/plugins/libparted/libpartedbackend.cpp | 1 + .../libparted/libpartedpartitiontable.cpp | 3 +- 8 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 src/fs/iso9660.cpp create mode 100644 src/fs/iso9660.h diff --git a/src/fs/CMakeLists.txt b/src/fs/CMakeLists.txt index 441231a..ab0b0f9 100644 --- a/src/fs/CMakeLists.txt +++ b/src/fs/CMakeLists.txt @@ -13,6 +13,7 @@ set(FS_SRC fs/hfs.cpp fs/hfsplus.cpp fs/hpfs.cpp + fs/iso9660.cpp fs/jfs.cpp fs/linuxswap.cpp fs/luks.cpp @@ -45,6 +46,7 @@ set(FS_LIB_HDRS fs/hfs.h fs/hfsplus.h fs/hpfs.h + fs/iso9660.h fs/jfs.h fs/linuxswap.h fs/luks.h diff --git a/src/fs/filesystem.cpp b/src/fs/filesystem.cpp index 96c1247..349ec39 100644 --- a/src/fs/filesystem.cpp +++ b/src/fs/filesystem.cpp @@ -63,7 +63,8 @@ const std::array< QColor, FileSystem::__lastType > FileSystem::defaultColorCode QColor( 242,155,104 ), QColor( 160,210,180 ), 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", "f2fs"), xi18nc("@item filesystem name", "udf"), + xi18nc("@item filesystem name", "iso9660"), }; return s; diff --git a/src/fs/filesystem.h b/src/fs/filesystem.h index b272499..231bd36 100644 --- a/src/fs/filesystem.h +++ b/src/fs/filesystem.h @@ -86,8 +86,9 @@ public: Lvm2_PV = 24, F2fs = 25, Udf = 26, + Iso9660 = 27, - __lastType = 27 + __lastType = 28 }; /** The type of support for a given FileSystem action */ diff --git a/src/fs/filesystemfactory.cpp b/src/fs/filesystemfactory.cpp index 3c7b905..fcd1136 100644 --- a/src/fs/filesystemfactory.cpp +++ b/src/fs/filesystemfactory.cpp @@ -31,6 +31,7 @@ #include "fs/hfs.h" #include "fs/hfsplus.h" #include "fs/hpfs.h" +#include "fs/iso9660.h" #include "fs/jfs.h" #include "fs/linuxswap.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::HfsPlus, new FS::hfsplus(-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::LinuxSwap, new FS::linuxswap(-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::HfsPlus: fs = new FS::hfsplus(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::LinuxSwap: fs = new FS::linuxswap(firstsector, lastsector, sectorsused, label); break; case FileSystem::Luks: fs = new FS::luks(firstsector, lastsector, sectorsused, label); break; diff --git a/src/fs/iso9660.cpp b/src/fs/iso9660.cpp new file mode 100644 index 0000000..05d178b --- /dev/null +++ b/src/fs/iso9660.cpp @@ -0,0 +1,28 @@ +/************************************************************************* + * Copyright (C) 2017 by Andrius Štikonas * + * * + * 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 .* + *************************************************************************/ + +#include "fs/iso9660.h" + +namespace FS +{ + +iso9660::iso9660(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) : + FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Iso9660) +{ +} + +} diff --git a/src/fs/iso9660.h b/src/fs/iso9660.h new file mode 100644 index 0000000..262cd0a --- /dev/null +++ b/src/fs/iso9660.h @@ -0,0 +1,43 @@ +/************************************************************************* + * Copyright (C) 2017 by Andrius Štikonas * + * * + * 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 .* + *************************************************************************/ + +#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 + */ +class LIBKPMCORE_EXPORT iso9660 : public FileSystem +{ +public: + iso9660(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label); + +}; + +} +#endif diff --git a/src/plugins/libparted/libpartedbackend.cpp b/src/plugins/libparted/libpartedbackend.cpp index 2fecdc9..11e37d3 100644 --- a/src/plugins/libparted/libpartedbackend.cpp +++ b/src/plugins/libparted/libpartedbackend.cpp @@ -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("f2fs")) rval = FileSystem::F2fs; else if (s == QStringLiteral("udf")) rval = FileSystem::Udf; + else if (s == QStringLiteral("iso9660")) rval = FileSystem::Iso9660; else qWarning() << "blkid: unknown file system type " << s << " on " << partitionPath; } diff --git a/src/plugins/libparted/libpartedpartitiontable.cpp b/src/plugins/libparted/libpartedpartitiontable.cpp index a71e426..34cbb10 100644 --- a/src/plugins/libparted/libpartedpartitiontable.cpp +++ b/src/plugins/libparted/libpartedpartitiontable.cpp @@ -117,7 +117,8 @@ static const struct { { FileSystem::Hfs, QStringLiteral("hfs") }, { FileSystem::HfsPlus, QStringLiteral("hfs+") }, { FileSystem::Ufs, QStringLiteral("ufs") }, - { FileSystem::Udf, QStringLiteral("ntfs") } + { FileSystem::Udf, QStringLiteral("ntfs") }, + { FileSystem::Iso9660, QStringLiteral("iso9660") } }; static PedFileSystemType* getPedFileSystemType(FileSystem::Type t)