[gparted] Limit FILESYSTEM_MAP entries to supported and basic supported FSs (!13)



commit ba79ddaf728c06b645103fe2915b23df1c87cf26
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Mon Sep 10 19:23:17 2018 +0100

    Limit FILESYSTEM_MAP entries to supported and basic supported FSs (!13)
    
    Introduce a third category of basic file system support to go along with
    the existing full and none.  Use the file system's entry in
    FILESYSTEM_MAP to determine the level of support.  See comment in
    GParted_Core::init_filesystems() for details.
    
    Add and remove FILESYSTEM_MAP NULL pointer entries as required, so that
    only the file system types intended to have basic support have such
    entries.
    
    Closes !13 - Support copying and moving of unsupported partition content

 include/Utils.h     |  4 ++--
 src/GParted_Core.cc | 23 ++++++++++++++++-------
 2 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/include/Utils.h b/include/Utils.h
index be37e87b..6c0fc8d2 100644
--- a/include/Utils.h
+++ b/include/Utils.h
@@ -67,7 +67,7 @@ enum FSType
        FS_CLEARED         = 4,  // Clear existing file system signatures
        FS_EXTENDED        = 5,
 
-       // Supported file system types
+       // Fully supported file system types
        FS_BTRFS           = 6,
        FS_EXFAT           = 7, /* Also known as fat64 */
        FS_EXT2            = 8,
@@ -91,7 +91,7 @@ enum FSType
        FS_UFS             = 26,
        FS_XFS             = 27,
 
-       // Recognised signatures but otherwise unsupported file system types
+       // Other recognised file system types
        FS_BITLOCKER       = 28,
        FS_GRUB2_CORE_IMG  = 29,
        FS_ISO9660         = 30,
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 737d73c0..53c9c0e3 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -115,9 +115,9 @@ void GParted_Core::find_supported_filesystems()
        std::map< FSType, FileSystem * >::iterator f;
 
        // Iteration of std::map is ordered according to operator< of the key.  Hence the
-       // FILESYSTEMS vector is constructed in FSType enum order: FS_UNSUPPORTED, ...
-       // FS_BTRFS, ..., FS_XFS, ... .  This ultimately controls the default order of the
-       // file systems in the menus and dialogs.
+       // FILESYSTEMS vector is constructed in FSType enum order: FS_UNKNOWN, FS_BTRFS,
+       // ..., FS_XFS, ... .  This ultimately controls the default order of the file
+       // systems in the menus and dialogs.
        FILESYSTEMS .clear() ;
 
        for ( f = FILESYSTEM_MAP .begin() ; f != FILESYSTEM_MAP .end() ; f++ ) {
@@ -4136,11 +4136,16 @@ bool GParted_Core::update_bootsector( const Partition & partition, OperationDeta
 
 void GParted_Core::init_filesystems()
 {
-       FILESYSTEM_MAP[FS_UNSUPPORTED]     = NULL;
-       FILESYSTEM_MAP[FS_UNALLOCATED]     = NULL;
+       // File system support falls into 3 categories determined by their entry in
+       // FILESYSTEM_MAP:
+       // 1)  Fully supported file systems have an entry pointing to the instance of
+       //     their derived FileSystem object.
+       //     supported_filesystem() -> true
+       // 2)  Basic supported file systems have a NULL pointer entry.
+       //     supported_filesystem() -> false
+       // 3)  Unsupported file systems have no entry.
+       //     supported_filesystem() -> false
        FILESYSTEM_MAP[FS_UNKNOWN]         = NULL;
-       FILESYSTEM_MAP[FS_CLEARED]         = NULL;
-       FILESYSTEM_MAP[FS_EXTENDED]        = NULL;
        FILESYSTEM_MAP[FS_BTRFS]           = new btrfs();
        FILESYSTEM_MAP[FS_EXFAT]           = new exfat();
        FILESYSTEM_MAP[FS_EXT2]            = new ext2( FS_EXT2 );
@@ -4164,8 +4169,12 @@ void GParted_Core::init_filesystems()
        FILESYSTEM_MAP[FS_UFS]             = new ufs();
        FILESYSTEM_MAP[FS_XFS]             = new xfs();
        FILESYSTEM_MAP[FS_BITLOCKER]       = NULL;
+       FILESYSTEM_MAP[FS_GRUB2_CORE_IMG]  = NULL;
+       FILESYSTEM_MAP[FS_ISO9660]         = NULL;
        FILESYSTEM_MAP[FS_LINUX_SWRAID]    = NULL;
        FILESYSTEM_MAP[FS_LINUX_SWSUSPEND] = NULL;
+       FILESYSTEM_MAP[FS_REFS]            = NULL;
+       FILESYSTEM_MAP[FS_ZFS]             = NULL;
 }
 
 void GParted_Core::fini_filesystems()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]