From dc75c7a11f66ba93c0ecdef7e9c3e97b7ccbdbff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Thu, 25 Feb 2016 23:29:33 +0000 Subject: [PATCH] Add basic support for F2FS. --- CMakeLists.txt | 4 +- src/fs/CMakeLists.txt | 44 +++++++++++----------- src/fs/btrfs.cpp | 1 + src/fs/btrfs.h | 3 +- src/fs/exfat.cpp | 1 + src/fs/exfat.h | 2 +- src/fs/filesystem.cpp | 4 +- src/fs/filesystem.h | 3 +- src/fs/filesystemfactory.cpp | 4 ++ src/fs/luks.h | 3 +- src/fs/lvm2_pv.cpp | 1 + src/fs/lvm2_pv.h | 3 +- src/fs/nilfs2.cpp | 1 + src/fs/nilfs2.h | 3 +- src/fs/zfs.cpp | 1 + src/fs/zfs.h | 3 +- src/plugins/libparted/libpartedbackend.cpp | 1 + 17 files changed, 51 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4637440..19425db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,10 +23,10 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) set(QT_MIN_VERSION "5.3.0") set(VERSION_MAJOR "2") set(VERSION_MINOR "0") -set(VERSION_RELEASE "2") +set(VERSION_RELEASE "50") set(VERSION_SUFFIX "") set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}${VERSION_SUFFIX}) -set(SOVERSION "1") +set(SOVERSION "2") add_definitions(-D'VERSION="${VERSION}"') #" find_package(ECM 1.0.0 REQUIRED NO_MODULE) diff --git a/src/fs/CMakeLists.txt b/src/fs/CMakeLists.txt index da28056..47a5bee 100644 --- a/src/fs/CMakeLists.txt +++ b/src/fs/CMakeLists.txt @@ -1,31 +1,32 @@ set(FS_SRC + fs/btrfs.cpp + fs/exfat.cpp + fs/ext2.cpp + fs/ext3.cpp + fs/ext4.cpp + fs/extended.cpp + fs/f2fs.cpp + fs/fat16.cpp fs/fat32.cpp fs/filesystem.cpp - fs/hfs.cpp - fs/nilfs2.cpp - fs/unknown.cpp - fs/linuxswap.cpp - fs/hfsplus.cpp - fs/ext3.cpp - fs/hpfs.cpp - fs/unformatted.cpp - fs/luks.cpp - fs/btrfs.cpp - fs/ufs.cpp - fs/reiserfs.cpp - fs/exfat.cpp fs/filesystemfactory.cpp - fs/lvm2_pv.cpp - fs/reiser4.cpp - fs/ext2.cpp + fs/hfs.cpp + fs/hfsplus.cpp + fs/hpfs.cpp fs/jfs.cpp + fs/linuxswap.cpp + fs/luks.cpp + fs/lvm2_pv.cpp + fs/nilfs2.cpp fs/ntfs.cpp - fs/fat16.cpp - fs/ext4.cpp - fs/xfs.cpp - fs/extended.cpp - fs/zfs.cpp fs/ocfs2.cpp + fs/reiser4.cpp + fs/reiserfs.cpp + fs/ufs.cpp + fs/unformatted.cpp + fs/unknown.cpp + fs/xfs.cpp + fs/zfs.cpp ) set(FS_LIB_HDRS @@ -35,6 +36,7 @@ set(FS_LIB_HDRS fs/ext3.h fs/ext4.h fs/extended.h + fs/f2fs.h fs/fat16.h fs/fat32.h fs/filesystem.h diff --git a/src/fs/btrfs.cpp b/src/fs/btrfs.cpp index 1c60564..34336ca 100644 --- a/src/fs/btrfs.cpp +++ b/src/fs/btrfs.cpp @@ -1,5 +1,6 @@ /************************************************************************* * Copyright (C) 2012 by Volker Lanz * + * Copyright (C) 2016 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 * diff --git a/src/fs/btrfs.h b/src/fs/btrfs.h index c5245e6..37fcffb 100644 --- a/src/fs/btrfs.h +++ b/src/fs/btrfs.h @@ -1,5 +1,6 @@ /************************************************************************* * Copyright (C) 2012 by Volker Lanz * + * Copyright (C) 2016 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 * @@ -32,7 +33,7 @@ class QString; namespace FS { /** A btrfs file system. - @author Volker Lanz + @author Andrius Štikonas */ class LIBKPMCORE_EXPORT btrfs : public FileSystem { diff --git a/src/fs/exfat.cpp b/src/fs/exfat.cpp index fcca9fe..b3b9929 100644 --- a/src/fs/exfat.cpp +++ b/src/fs/exfat.cpp @@ -1,5 +1,6 @@ /************************************************************************* * Copyright (C) 2012 by Volker Lanz * + * Copyright (C) 2016 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 * diff --git a/src/fs/exfat.h b/src/fs/exfat.h index 8c01736..b614219 100644 --- a/src/fs/exfat.h +++ b/src/fs/exfat.h @@ -32,7 +32,7 @@ class QString; namespace FS { /** An exfat file system. - @author Volker Lanz + @author Andrius Štikonas */ class LIBKPMCORE_EXPORT exfat : public FileSystem { diff --git a/src/fs/filesystem.cpp b/src/fs/filesystem.cpp index 43dbba0..6c6a849 100644 --- a/src/fs/filesystem.cpp +++ b/src/fs/filesystem.cpp @@ -50,7 +50,8 @@ const std::array< QColor, FileSystem::__lastType > FileSystem::defaultColorCode QColor( 33,137,108 ), QColor( 250,230,255 ), QColor( 242,155,104 ), - QColor( 160,210,180 ) + QColor( 160,210,180 ), + QColor( 255,170,0 ) }; @@ -318,6 +319,7 @@ static const QString* typeNames() i18nc("@item filesystem name", "exfat"), i18nc("@item filesystem name", "nilfs2"), i18nc("@item filesystem name", "lvm2 pv"), + i18nc("@item filesystem name", "f2fs"), }; return s; diff --git a/src/fs/filesystem.h b/src/fs/filesystem.h index d89b48f..b65fadf 100644 --- a/src/fs/filesystem.h +++ b/src/fs/filesystem.h @@ -81,8 +81,9 @@ public: Exfat = 22, Nilfs2 = 23, Lvm2_PV = 24, + F2fs = 25, - __lastType = 25 + __lastType = 26 }; /** The type of support for a given FileSystem action */ diff --git a/src/fs/filesystemfactory.cpp b/src/fs/filesystemfactory.cpp index f12d349..4daffae 100644 --- a/src/fs/filesystemfactory.cpp +++ b/src/fs/filesystemfactory.cpp @@ -24,6 +24,7 @@ #include "fs/ext3.h" #include "fs/ext4.h" #include "fs/extended.h" +#include "fs/f2fs.h" #include "fs/fat16.h" #include "fs/fat32.h" #include "fs/hfs.h" @@ -61,6 +62,7 @@ void FileSystemFactory::init() m_FileSystems.insert(FileSystem::Ext3, new FS::ext3(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Ext4, new FS::ext4(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Extended, new FS::extended(-1, -1, -1, QString())); + m_FileSystems.insert(FileSystem::F2fs, new FS::f2fs(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Fat16, new FS::fat16(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Fat32, new FS::fat32(-1, -1, -1, QString())); m_FileSystems.insert(FileSystem::Hfs, new FS::hfs(-1, -1, -1, QString())); @@ -87,6 +89,7 @@ void FileSystemFactory::init() FS::ext3::init(); FS::ext4::init(); FS::extended::init(); + FS::f2fs::init(); FS::fat16::init(); FS::fat32::init(); FS::hfs::init(); @@ -129,6 +132,7 @@ FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qi case FileSystem::Ext3: fs = new FS::ext3(firstsector, lastsector, sectorsused, label); break; case FileSystem::Ext4: fs = new FS::ext4(firstsector, lastsector, sectorsused, label); break; case FileSystem::Extended: fs = new FS::extended(firstsector, lastsector, sectorsused, label); break; + case FileSystem::F2fs: fs = new FS::f2fs(firstsector, lastsector, sectorsused, label); break; case FileSystem::Fat16: fs = new FS::fat16(firstsector, lastsector, sectorsused, label); break; case FileSystem::Fat32: fs = new FS::fat32(firstsector, lastsector, sectorsused, label); break; case FileSystem::Hfs: fs = new FS::hfs(firstsector, lastsector, sectorsused, label); break; diff --git a/src/fs/luks.h b/src/fs/luks.h index e2efa60..2a0b80e 100644 --- a/src/fs/luks.h +++ b/src/fs/luks.h @@ -1,5 +1,6 @@ /************************************************************************* * Copyright (C) 2012 by Volker Lanz * + * Copyright (C) 2013 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 * @@ -32,7 +33,7 @@ class QString; namespace FS { /** A LUKS crypto file system. - @author Volker Lanz + @author Andrius Štikonas */ class LIBKPMCORE_EXPORT luks : public FileSystem { diff --git a/src/fs/lvm2_pv.cpp b/src/fs/lvm2_pv.cpp index 5ab83e2..f4d22f5 100644 --- a/src/fs/lvm2_pv.cpp +++ b/src/fs/lvm2_pv.cpp @@ -1,5 +1,6 @@ /************************************************************************* * Copyright (C) 2012 by Volker Lanz * + * Copyright (C) 2016 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 * diff --git a/src/fs/lvm2_pv.h b/src/fs/lvm2_pv.h index 76bf59f..c4aa784 100644 --- a/src/fs/lvm2_pv.h +++ b/src/fs/lvm2_pv.h @@ -1,5 +1,6 @@ /************************************************************************* * Copyright (C) 2012 by Volker Lanz * + * Copyright (C) 2016 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 * @@ -32,7 +33,7 @@ class QString; namespace FS { /** LVM2 physical volume. - @author Andrius Štikonas + @author Andrius Štikonas */ class LIBKPMCORE_EXPORT lvm2_pv : public FileSystem { diff --git a/src/fs/nilfs2.cpp b/src/fs/nilfs2.cpp index ee0b3f9..9d2c7e0 100644 --- a/src/fs/nilfs2.cpp +++ b/src/fs/nilfs2.cpp @@ -1,5 +1,6 @@ /************************************************************************* * Copyright (C) 2012 by Volker Lanz * + * Copyright (C) 2016 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 * diff --git a/src/fs/nilfs2.h b/src/fs/nilfs2.h index 2c1f3d4..b987eba 100644 --- a/src/fs/nilfs2.h +++ b/src/fs/nilfs2.h @@ -1,5 +1,6 @@ /************************************************************************* * Copyright (C) 2012 by Volker Lanz * + * Copyright (C) 2016 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 * @@ -32,7 +33,7 @@ class QString; namespace FS { /** A nilfs2 file system. - @author Volker Lanz + @author Andrius Štikonas */ class LIBKPMCORE_EXPORT nilfs2 : public FileSystem { diff --git a/src/fs/zfs.cpp b/src/fs/zfs.cpp index 0d81864..32d6093 100644 --- a/src/fs/zfs.cpp +++ b/src/fs/zfs.cpp @@ -1,5 +1,6 @@ /************************************************************************* * Copyright (C) 2010 by Volker Lanz * + * Copyright (C) 2016 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 * diff --git a/src/fs/zfs.h b/src/fs/zfs.h index 11eb32d..19fecad 100644 --- a/src/fs/zfs.h +++ b/src/fs/zfs.h @@ -1,5 +1,6 @@ /************************************************************************* * Copyright (C) 2010 by Volker Lanz * + * Copyright (C) 2016 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 * @@ -32,7 +33,7 @@ class QString; namespace FS { /** A zfs file system. - @author Volker Lanz + @author Andrius Štikonas */ class LIBKPMCORE_EXPORT zfs : public FileSystem { diff --git a/src/plugins/libparted/libpartedbackend.cpp b/src/plugins/libparted/libpartedbackend.cpp index 6e78d97..4c44a7c 100644 --- a/src/plugins/libparted/libpartedbackend.cpp +++ b/src/plugins/libparted/libpartedbackend.cpp @@ -513,6 +513,7 @@ FileSystem::Type LibPartedBackend::detectFileSystem(PedPartition* pedPartition) else if (s == QStringLiteral("exfat")) rval = FileSystem::Exfat; else if (s == QStringLiteral("nilfs2")) rval = FileSystem::Nilfs2; else if (s == QStringLiteral("LVM2_member")) rval = FileSystem::Lvm2_PV; + else if (s == QStringLiteral("f2fs")) rval = FileSystem::F2fs; else qWarning() << "blkid: unknown file system type " << s << " on " << pedPath; }