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.
This commit is contained in:
Sinlu Bes 2013-06-05 23:15:47 +02:00 committed by Curtis Gedak
parent aed1fb58cf
commit 20006e1f8e
14 changed files with 40 additions and 6 deletions

View file

@ -126,6 +126,7 @@ struct FS
Support read_uuid ; Support read_uuid ;
Support write_uuid ; Support write_uuid ;
Support create ; Support create ;
Support create_with_label ; //Can and how to format file system with label
Support grow ; Support grow ;
Support shrink ; Support shrink ;
Support move ; //startpoint and endpoint Support move ; //startpoint and endpoint
@ -139,8 +140,8 @@ struct FS
FS() FS()
{ {
read = read_label = write_label = read_uuid = write_uuid = create = grow = shrink = read = read_label = write_label = read_uuid = write_uuid = create = create_with_label =
move = check = copy = remove = online_read = NONE ; grow = shrink = move = check = copy = remove = online_read = NONE ;
MIN = MAX = 0 ; MIN = MAX = 0 ;
} }
} ; } ;

View file

@ -33,7 +33,10 @@ FS btrfs::get_filesystem_support()
fs .filesystem = GParted::FS_BTRFS ; fs .filesystem = GParted::FS_BTRFS ;
if ( ! Glib::find_program_in_path( "mkfs.btrfs" ) .empty() ) if ( ! Glib::find_program_in_path( "mkfs.btrfs" ) .empty() )
{
fs .create = GParted::FS::EXTERNAL ; fs .create = GParted::FS::EXTERNAL ;
fs .create_with_label = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "btrfsck" ) .empty() ) if ( ! Glib::find_program_in_path( "btrfsck" ) .empty() )
fs .check = GParted::FS::EXTERNAL ; fs .check = GParted::FS::EXTERNAL ;

View file

@ -33,6 +33,7 @@ FS ext2::get_filesystem_support()
if ( ! Glib::find_program_in_path( "mkfs." + Utils::get_filesystem_string( specific_type ) ).empty() ) if ( ! Glib::find_program_in_path( "mkfs." + Utils::get_filesystem_string( specific_type ) ).empty() )
{ {
fs .create = FS::EXTERNAL ; fs .create = FS::EXTERNAL ;
fs .create_with_label = FS::EXTERNAL ;
if ( ! Glib::find_program_in_path( "dumpe2fs" ) .empty() ) if ( ! Glib::find_program_in_path( "dumpe2fs" ) .empty() )
fs .read = FS::EXTERNAL ; fs .read = FS::EXTERNAL ;

View file

@ -28,7 +28,10 @@ FS f2fs::get_filesystem_support()
fs .filesystem = FS_F2FS ; fs .filesystem = FS_F2FS ;
if ( ! Glib::find_program_in_path( "mkfs.f2fs" ) .empty() ) if ( ! Glib::find_program_in_path( "mkfs.f2fs" ) .empty() )
{
fs .create = GParted::FS::EXTERNAL ; fs .create = GParted::FS::EXTERNAL ;
fs .create_with_label = GParted::FS::EXTERNAL ;
}
fs .copy = FS::GPARTED ; fs .copy = FS::GPARTED ;
fs .move = FS::GPARTED ; fs .move = FS::GPARTED ;

View file

@ -68,7 +68,10 @@ FS fat16::get_filesystem_support()
//find out if we can create fat file systems //find out if we can create fat file systems
if ( ! Glib::find_program_in_path( "mkdosfs" ) .empty() ) if ( ! Glib::find_program_in_path( "mkdosfs" ) .empty() )
{
fs .create = GParted::FS::EXTERNAL ; fs .create = GParted::FS::EXTERNAL ;
fs .create_with_label = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "dosfsck" ) .empty() ) if ( ! Glib::find_program_in_path( "dosfsck" ) .empty() )
{ {

View file

@ -34,7 +34,10 @@ FS hfs::get_filesystem_support()
#endif #endif
if ( ! Glib::find_program_in_path( "hformat" ) .empty() ) if ( ! Glib::find_program_in_path( "hformat" ) .empty() )
{
fs .create = GParted::FS::EXTERNAL ; fs .create = GParted::FS::EXTERNAL ;
fs .create_with_label = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "hfsck" ) .empty() ) if ( ! Glib::find_program_in_path( "hfsck" ) .empty() )
fs .check = FS::EXTERNAL ; fs .check = FS::EXTERNAL ;

View file

@ -34,7 +34,10 @@ FS hfsplus::get_filesystem_support()
#endif #endif
if ( ! Glib::find_program_in_path( "mkfs.hfsplus" ) .empty() ) if ( ! Glib::find_program_in_path( "mkfs.hfsplus" ) .empty() )
{
fs .create = GParted::FS::EXTERNAL ; fs .create = GParted::FS::EXTERNAL ;
fs .create_with_label = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "fsck.hfsplus" ) .empty() ) if ( ! Glib::find_program_in_path( "fsck.hfsplus" ) .empty() )
fs .check = FS::EXTERNAL ; fs .check = FS::EXTERNAL ;

View file

@ -39,7 +39,10 @@ FS jfs::get_filesystem_support()
} }
if ( ! Glib::find_program_in_path( "mkfs.jfs" ) .empty() ) if ( ! Glib::find_program_in_path( "mkfs.jfs" ) .empty() )
{
fs .create = GParted::FS::EXTERNAL ; fs .create = GParted::FS::EXTERNAL ;
fs .create_with_label = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "jfs_fsck" ) .empty() ) if ( ! Glib::find_program_in_path( "jfs_fsck" ) .empty() )
fs .check = GParted::FS::EXTERNAL ; fs .check = GParted::FS::EXTERNAL ;

View file

@ -46,6 +46,7 @@ FS linux_swap::get_filesystem_support()
if ( ! Glib::find_program_in_path( "mkswap" ) .empty() ) if ( ! Glib::find_program_in_path( "mkswap" ) .empty() )
{ {
fs .create = GParted::FS::EXTERNAL ; fs .create = GParted::FS::EXTERNAL ;
fs .create_with_label = GParted::FS::EXTERNAL ;
fs .grow = GParted::FS::EXTERNAL ; fs .grow = GParted::FS::EXTERNAL ;
fs .shrink = GParted::FS::EXTERNAL ; fs .shrink = GParted::FS::EXTERNAL ;
} }

View file

@ -29,6 +29,7 @@ FS nilfs2::get_filesystem_support()
if ( ! Glib::find_program_in_path( "mkfs.nilfs2" ) .empty() ) if ( ! Glib::find_program_in_path( "mkfs.nilfs2" ) .empty() )
{ {
fs .create = GParted::FS::EXTERNAL ; fs .create = GParted::FS::EXTERNAL ;
fs .create_with_label = GParted::FS::EXTERNAL ;
} }
if ( ! Glib::find_program_in_path( "nilfs-tune" ) .empty() ) if ( ! Glib::find_program_in_path( "nilfs-tune" ) .empty() )

View file

@ -85,7 +85,10 @@ FS ntfs::get_filesystem_support()
} }
if ( ! Glib::find_program_in_path( "mkntfs" ) .empty() ) if ( ! Glib::find_program_in_path( "mkntfs" ) .empty() )
{
fs .create = GParted::FS::EXTERNAL ; fs .create = GParted::FS::EXTERNAL ;
fs .create_with_label = GParted::FS::EXTERNAL ;
}
//resizing is a delicate process ... //resizing is a delicate process ...
if ( fs .read && fs .check ) if ( fs .read && fs .check )

View file

@ -35,7 +35,10 @@ FS reiser4::get_filesystem_support()
} }
if ( ! Glib::find_program_in_path( "mkfs.reiser4" ) .empty() ) if ( ! Glib::find_program_in_path( "mkfs.reiser4" ) .empty() )
{
fs .create = GParted::FS::EXTERNAL ; fs .create = GParted::FS::EXTERNAL ;
fs .create_with_label = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "fsck.reiser4" ) .empty() ) if ( ! Glib::find_program_in_path( "fsck.reiser4" ) .empty() )
fs .check = GParted::FS::EXTERNAL ; fs .check = GParted::FS::EXTERNAL ;

View file

@ -41,7 +41,10 @@ FS reiserfs::get_filesystem_support()
} }
if ( ! Glib::find_program_in_path( "mkreiserfs" ) .empty() ) if ( ! Glib::find_program_in_path( "mkreiserfs" ) .empty() )
{
fs .create = GParted::FS::EXTERNAL ; fs .create = GParted::FS::EXTERNAL ;
fs .create_with_label = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "reiserfsck" ) .empty() ) if ( ! Glib::find_program_in_path( "reiserfsck" ) .empty() )
fs .check = GParted::FS::EXTERNAL ; fs .check = GParted::FS::EXTERNAL ;

View file

@ -41,7 +41,10 @@ FS xfs::get_filesystem_support()
} }
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 = GParted::FS::EXTERNAL ;
fs .create_with_label = GParted::FS::EXTERNAL ;
}
if ( ! Glib::find_program_in_path( "xfs_repair" ) .empty() ) if ( ! Glib::find_program_in_path( "xfs_repair" ) .empty() )
fs .check = GParted::FS::EXTERNAL ; fs .check = GParted::FS::EXTERNAL ;