[gparted] Add create_with_label flag to struct FS (#701569)



commit 20006e1f8ec8fa23e67e7199004632fbeba10afe
Author: Sinlu Bes <e80f00 gmail com>
Date:   Wed Jun 5 23:15:47 2013 +0200

    Add create_with_label flag to struct FS (#701569)
    
    It was difficult to retrieve whether a filesystem's label can be set on reformat.
    
    The read_label flag can't be used as it decides whether to use the logic in the filesystem class
    rather than the fallback in GParted::set_device_partitions, to determine the label of a partition.
    
    The create_with_label flag is NONE for file systems that we cannot format with a
    label (or that we cannot format at all).
    The value is usually EXTERNAL for file systems that we can format with a label.

 include/Utils.h   |    5 +++--
 src/btrfs.cc      |    3 +++
 src/ext2.cc       |    1 +
 src/f2fs.cc       |    3 +++
 src/fat16.cc      |    5 ++++-
 src/hfs.cc        |    3 +++
 src/hfsplus.cc    |    5 ++++-
 src/jfs.cc        |    5 ++++-
 src/linux_swap.cc |    1 +
 src/nilfs2.cc     |    1 +
 src/ntfs.cc       |    3 +++
 src/reiser4.cc    |    3 +++
 src/reiserfs.cc   |    3 +++
 src/xfs.cc        |    5 ++++-
 14 files changed, 40 insertions(+), 6 deletions(-)
---
diff --git a/include/Utils.h b/include/Utils.h
index 62f8ba8..77a5d32 100644
--- a/include/Utils.h
+++ b/include/Utils.h
@@ -126,6 +126,7 @@ struct FS
        Support read_uuid ;
        Support write_uuid ;
        Support create ;
+       Support create_with_label ;  //Can and how to format file system with label
        Support grow ;
        Support shrink ;
        Support move ; //startpoint and endpoint
@@ -139,8 +140,8 @@ struct FS
        
        FS()
        {
-               read = read_label = write_label = read_uuid = write_uuid = create = grow = shrink =
-               move = check = copy = remove = online_read = NONE ;
+               read = read_label = write_label = read_uuid = write_uuid = create = create_with_label =
+               grow = shrink = move = check = copy = remove = online_read = NONE ;
                MIN = MAX = 0 ;
        } 
 } ;
diff --git a/src/btrfs.cc b/src/btrfs.cc
index c7cf842..d3f3575 100644
--- a/src/btrfs.cc
+++ b/src/btrfs.cc
@@ -33,7 +33,10 @@ FS btrfs::get_filesystem_support()
        fs .filesystem = GParted::FS_BTRFS ;
 
        if ( ! Glib::find_program_in_path( "mkfs.btrfs" ) .empty() )
+       {
                fs .create = GParted::FS::EXTERNAL ;
+               fs .create_with_label = GParted::FS::EXTERNAL ;
+       }
 
        if ( ! Glib::find_program_in_path( "btrfsck" ) .empty() )
                fs .check = GParted::FS::EXTERNAL ;
diff --git a/src/ext2.cc b/src/ext2.cc
index 2b3bdd4..47f1eab 100644
--- a/src/ext2.cc
+++ b/src/ext2.cc
@@ -33,6 +33,7 @@ FS ext2::get_filesystem_support()
        if ( ! Glib::find_program_in_path( "mkfs." + Utils::get_filesystem_string( specific_type ) ).empty() )
        {
                fs .create = FS::EXTERNAL ;
+               fs .create_with_label = FS::EXTERNAL ;
 
                if ( ! Glib::find_program_in_path( "dumpe2fs" ) .empty() )
                        fs .read = FS::EXTERNAL ;
diff --git a/src/f2fs.cc b/src/f2fs.cc
index a3b62e1..23b3f00 100644
--- a/src/f2fs.cc
+++ b/src/f2fs.cc
@@ -28,7 +28,10 @@ FS f2fs::get_filesystem_support()
        fs .filesystem = FS_F2FS ;
 
        if ( ! Glib::find_program_in_path( "mkfs.f2fs" ) .empty() )
+       {
                fs .create = GParted::FS::EXTERNAL ;
+               fs .create_with_label = GParted::FS::EXTERNAL ;
+       }
 
        fs .copy = FS::GPARTED ;
        fs .move = FS::GPARTED ;
diff --git a/src/fat16.cc b/src/fat16.cc
index a0556e8..ea76b94 100644
--- a/src/fat16.cc
+++ b/src/fat16.cc
@@ -68,8 +68,11 @@ FS fat16::get_filesystem_support()
 
        //find out if we can create fat file systems
        if ( ! Glib::find_program_in_path( "mkdosfs" ) .empty() )
+       {
                fs .create = GParted::FS::EXTERNAL ;
-       
+               fs .create_with_label = GParted::FS::EXTERNAL ;
+       }
+
        if ( ! Glib::find_program_in_path( "dosfsck" ) .empty() )
        {
                fs .check = GParted::FS::EXTERNAL ;
diff --git a/src/hfs.cc b/src/hfs.cc
index 760cb1d..e8b86d8 100644
--- a/src/hfs.cc
+++ b/src/hfs.cc
@@ -34,7 +34,10 @@ FS hfs::get_filesystem_support()
 #endif
 
        if ( ! Glib::find_program_in_path( "hformat" ) .empty() )
+       {
                fs .create = GParted::FS::EXTERNAL ;
+               fs .create_with_label = GParted::FS::EXTERNAL ;
+       }
 
        if ( ! Glib::find_program_in_path( "hfsck" ) .empty() )
                fs .check = FS::EXTERNAL ;
diff --git a/src/hfsplus.cc b/src/hfsplus.cc
index b257afa..5775d42 100644
--- a/src/hfsplus.cc
+++ b/src/hfsplus.cc
@@ -34,8 +34,11 @@ FS hfsplus::get_filesystem_support()
 #endif
 
        if ( ! Glib::find_program_in_path( "mkfs.hfsplus" ) .empty() )
+       {
                fs .create = GParted::FS::EXTERNAL ;
-       
+               fs .create_with_label = GParted::FS::EXTERNAL ;
+       }
+
        if ( ! Glib::find_program_in_path( "fsck.hfsplus" ) .empty() )
                fs .check = FS::EXTERNAL ;
 
diff --git a/src/jfs.cc b/src/jfs.cc
index 606da2e..a15f5ad 100644
--- a/src/jfs.cc
+++ b/src/jfs.cc
@@ -39,8 +39,11 @@ FS jfs::get_filesystem_support()
        }
 
        if ( ! Glib::find_program_in_path( "mkfs.jfs" ) .empty() )
+       {
                fs .create = GParted::FS::EXTERNAL ;
-       
+               fs .create_with_label = GParted::FS::EXTERNAL ;
+       }
+
        if ( ! Glib::find_program_in_path( "jfs_fsck" ) .empty() )
                fs .check = GParted::FS::EXTERNAL ;
        
diff --git a/src/linux_swap.cc b/src/linux_swap.cc
index f9c0886..01d4872 100644
--- a/src/linux_swap.cc
+++ b/src/linux_swap.cc
@@ -46,6 +46,7 @@ FS linux_swap::get_filesystem_support()
        if ( ! Glib::find_program_in_path( "mkswap" ) .empty() )
        {
                fs .create = GParted::FS::EXTERNAL ;
+               fs .create_with_label = GParted::FS::EXTERNAL ;
                fs .grow = GParted::FS::EXTERNAL ;
                fs .shrink = GParted::FS::EXTERNAL ;
        }
diff --git a/src/nilfs2.cc b/src/nilfs2.cc
index d0b84de..c593efd 100644
--- a/src/nilfs2.cc
+++ b/src/nilfs2.cc
@@ -29,6 +29,7 @@ FS nilfs2::get_filesystem_support()
        if ( ! Glib::find_program_in_path( "mkfs.nilfs2" ) .empty() )
        {
                fs .create = GParted::FS::EXTERNAL ;
+               fs .create_with_label = GParted::FS::EXTERNAL ;
        }
 
        if ( ! Glib::find_program_in_path( "nilfs-tune" ) .empty() )
diff --git a/src/ntfs.cc b/src/ntfs.cc
index 12b8ac6..d90544d 100644
--- a/src/ntfs.cc
+++ b/src/ntfs.cc
@@ -85,7 +85,10 @@ FS ntfs::get_filesystem_support()
        }
 
        if ( ! Glib::find_program_in_path( "mkntfs" ) .empty() )
+       {
                fs .create = GParted::FS::EXTERNAL ;
+               fs .create_with_label = GParted::FS::EXTERNAL ;
+       }
 
        //resizing is a delicate process ...
        if ( fs .read && fs .check )
diff --git a/src/reiser4.cc b/src/reiser4.cc
index 9c3d4c1..a7e4f86 100644
--- a/src/reiser4.cc
+++ b/src/reiser4.cc
@@ -35,7 +35,10 @@ FS reiser4::get_filesystem_support()
        }
 
        if ( ! Glib::find_program_in_path( "mkfs.reiser4" ) .empty() )
+       {
                fs .create = GParted::FS::EXTERNAL ;
+               fs .create_with_label = GParted::FS::EXTERNAL ;
+       }
        
        if ( ! Glib::find_program_in_path( "fsck.reiser4" ) .empty() )
                fs .check = GParted::FS::EXTERNAL ;
diff --git a/src/reiserfs.cc b/src/reiserfs.cc
index 0c4eb27..2275f14 100644
--- a/src/reiserfs.cc
+++ b/src/reiserfs.cc
@@ -41,7 +41,10 @@ FS reiserfs::get_filesystem_support()
        }
 
        if ( ! Glib::find_program_in_path( "mkreiserfs" ) .empty() )
+       {
                fs .create = GParted::FS::EXTERNAL ;
+               fs .create_with_label = GParted::FS::EXTERNAL ;
+       }
        
        if ( ! Glib::find_program_in_path( "reiserfsck" ) .empty() )
                fs .check = GParted::FS::EXTERNAL ;
diff --git a/src/xfs.cc b/src/xfs.cc
index 53505c8..0255342 100644
--- a/src/xfs.cc
+++ b/src/xfs.cc
@@ -40,8 +40,11 @@ FS xfs::get_filesystem_support()
                fs .write_uuid = FS::EXTERNAL ;
        }
 
-       if ( ! Glib::find_program_in_path( "mkfs.xfs" ) .empty() )      
+       if ( ! Glib::find_program_in_path( "mkfs.xfs" ) .empty() )
+       {
                fs .create = GParted::FS::EXTERNAL ;
+               fs .create_with_label = GParted::FS::EXTERNAL ;
+       }
        
        if ( ! Glib::find_program_in_path( "xfs_repair" ) .empty() )    
                fs .check = GParted::FS::EXTERNAL ;


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