Rename enum FILESYSTEM to FSType
There are too many different types of things named "filesystem" in the GParted code with the potential to cause confusion. Namely: std::vector<FS> FILESYSTEMS Vector of file system capabilities. class FileSystem Base class interfacing to file system specific executables for querying and modification. enum FILESYSTEM Symbolic constants representing each file system type. Many recent written or re-written functions already used a variable named fstype. Rename enum FILESYSTEM to enum FSType to clearly distinguish it from the other things with very similar names. Only changing the name of the enumeration, not the name of variables of that type too because that is a lot more lines of code and those can be changed when the relevant code is re-written.
This commit is contained in:
parent
32c483c314
commit
175d27c55d
|
@ -51,7 +51,7 @@ private:
|
||||||
unsigned short new_count,
|
unsigned short new_count,
|
||||||
const std::vector<FS> & FILESYSTEMS );
|
const std::vector<FS> & FILESYSTEMS );
|
||||||
void Build_Filesystems_Menu( bool only_unformatted ) ;
|
void Build_Filesystems_Menu( bool only_unformatted ) ;
|
||||||
Byte_Value get_filesystem_min_limit( FILESYSTEM fstype );
|
Byte_Value get_filesystem_min_limit( FSType fstype );
|
||||||
|
|
||||||
Gtk::Table table_create;
|
Gtk::Table table_create;
|
||||||
Gtk::OptionMenu optionmenu_type, optionmenu_filesystem;
|
Gtk::OptionMenu optionmenu_type, optionmenu_filesystem;
|
||||||
|
|
|
@ -59,15 +59,15 @@ public:
|
||||||
bool toggle_flag( const Partition & partition, const Glib::ustring & flag, bool state ) ;
|
bool toggle_flag( const Partition & partition, const Glib::ustring & flag, bool state ) ;
|
||||||
|
|
||||||
const std::vector<FS> & get_filesystems() const ;
|
const std::vector<FS> & get_filesystems() const ;
|
||||||
const FS & get_fs( GParted::FILESYSTEM filesystem ) const ;
|
const FS & get_fs( FSType filesystem ) const;
|
||||||
static std::vector<Glib::ustring> get_disklabeltypes() ;
|
static std::vector<Glib::ustring> get_disklabeltypes() ;
|
||||||
std::map<Glib::ustring, bool> get_available_flags( const Partition & partition ) ;
|
std::map<Glib::ustring, bool> get_available_flags( const Partition & partition ) ;
|
||||||
Glib::ustring get_libparted_version() ;
|
Glib::ustring get_libparted_version() ;
|
||||||
Glib::ustring get_thread_status_message() ;
|
Glib::ustring get_thread_status_message() ;
|
||||||
|
|
||||||
static FileSystem * get_filesystem_object( FILESYSTEM filesystem );
|
static FileSystem * get_filesystem_object( FSType filesystem );
|
||||||
static bool supported_filesystem( FILESYSTEM fstype );
|
static bool supported_filesystem( FSType fstype );
|
||||||
static FS_Limits get_filesystem_limits( FILESYSTEM fstype, const Partition & partition );
|
static FS_Limits get_filesystem_limits( FSType fstype, const Partition & partition );
|
||||||
static bool filesystem_resize_disallowed( const Partition & partition ) ;
|
static bool filesystem_resize_disallowed( const Partition & partition ) ;
|
||||||
static void insert_unallocated( const Glib::ustring & device_path,
|
static void insert_unallocated( const Glib::ustring & device_path,
|
||||||
PartitionVector & partitions,
|
PartitionVector & partitions,
|
||||||
|
@ -83,18 +83,18 @@ private:
|
||||||
void set_device_from_disk( Device & device, const Glib::ustring & device_path );
|
void set_device_from_disk( Device & device, const Glib::ustring & device_path );
|
||||||
void set_device_serial_number( Device & device );
|
void set_device_serial_number( Device & device );
|
||||||
void set_device_partitions( Device & device, PedDevice* lp_device, PedDisk* lp_disk ) ;
|
void set_device_partitions( Device & device, PedDevice* lp_device, PedDisk* lp_disk ) ;
|
||||||
void set_device_one_partition( Device & device, PedDevice * lp_device, FILESYSTEM fstype,
|
void set_device_one_partition( Device & device, PedDevice * lp_device, FSType fstype,
|
||||||
std::vector<Glib::ustring> & messages );
|
std::vector<Glib::ustring> & messages );
|
||||||
void set_luks_partition( PartitionLUKS & partition );
|
void set_luks_partition( PartitionLUKS & partition );
|
||||||
void set_partition_label_and_uuid( Partition & partition );
|
void set_partition_label_and_uuid( Partition & partition );
|
||||||
static FILESYSTEM detect_filesystem_internal( PedDevice * lp_device, PedPartition * lp_partition );
|
static FSType detect_filesystem_internal( PedDevice * lp_device, PedPartition * lp_partition );
|
||||||
static FILESYSTEM detect_filesystem( PedDevice * lp_device, PedPartition * lp_partition,
|
static FSType detect_filesystem( PedDevice * lp_device, PedPartition * lp_partition,
|
||||||
std::vector<Glib::ustring> & messages );
|
std::vector<Glib::ustring> & messages );
|
||||||
void read_label( Partition & partition ) ;
|
void read_label( Partition & partition ) ;
|
||||||
void read_uuid( Partition & partition ) ;
|
void read_uuid( Partition & partition ) ;
|
||||||
void set_mountpoints( Partition & partition );
|
void set_mountpoints( Partition & partition );
|
||||||
bool set_mountpoints_helper( Partition & partition, const Glib::ustring & path );
|
bool set_mountpoints_helper( Partition & partition, const Glib::ustring & path );
|
||||||
bool is_busy( FILESYSTEM fstype, const Glib::ustring & path ) ;
|
bool is_busy( FSType fstype, const Glib::ustring & path );
|
||||||
void set_used_sectors( Partition & partition, PedDisk* lp_disk );
|
void set_used_sectors( Partition & partition, PedDisk* lp_disk );
|
||||||
void mounted_set_used_sectors( Partition & partition ) ;
|
void mounted_set_used_sectors( Partition & partition ) ;
|
||||||
#ifdef HAVE_LIBPARTED_FS_RESIZE
|
#ifdef HAVE_LIBPARTED_FS_RESIZE
|
||||||
|
@ -233,7 +233,7 @@ private:
|
||||||
static PedExceptionOption ped_exception_handler( PedException * e ) ;
|
static PedExceptionOption ped_exception_handler( PedException * e ) ;
|
||||||
|
|
||||||
std::vector<FS> FILESYSTEMS ;
|
std::vector<FS> FILESYSTEMS ;
|
||||||
static std::map< FILESYSTEM, FileSystem * > FILESYSTEM_MAP ;
|
static std::map< FSType, FileSystem * > FILESYSTEM_MAP;
|
||||||
std::vector<PedPartitionFlag> flags;
|
std::vector<PedPartitionFlag> flags;
|
||||||
std::vector<Glib::ustring> device_paths ;
|
std::vector<Glib::ustring> device_paths ;
|
||||||
bool probe_devices ;
|
bool probe_devices ;
|
||||||
|
|
|
@ -76,7 +76,7 @@ public:
|
||||||
const Glib::ustring & partition,
|
const Glib::ustring & partition,
|
||||||
int partition_number,
|
int partition_number,
|
||||||
PartitionType type,
|
PartitionType type,
|
||||||
FILESYSTEM filesystem,
|
FSType filesystem,
|
||||||
Sector sector_start,
|
Sector sector_start,
|
||||||
Sector sector_end,
|
Sector sector_end,
|
||||||
Byte_Value sector_size,
|
Byte_Value sector_size,
|
||||||
|
@ -99,7 +99,7 @@ public:
|
||||||
bool inside_extended );
|
bool inside_extended );
|
||||||
void set_unpartitioned( const Glib::ustring & device_path,
|
void set_unpartitioned( const Glib::ustring & device_path,
|
||||||
const Glib::ustring & partition_path,
|
const Glib::ustring & partition_path,
|
||||||
FILESYSTEM fstype,
|
FSType fstype,
|
||||||
Sector length,
|
Sector length,
|
||||||
Byte_Value sector_size,
|
Byte_Value sector_size,
|
||||||
bool busy );
|
bool busy );
|
||||||
|
@ -154,7 +154,7 @@ public:
|
||||||
PartitionType type;// UNALLOCATED, PRIMARY, LOGICAL, etc...
|
PartitionType type;// UNALLOCATED, PRIMARY, LOGICAL, etc...
|
||||||
PartitionStatus status; //STAT_REAL, STAT_NEW, etc..
|
PartitionStatus status; //STAT_REAL, STAT_NEW, etc..
|
||||||
PartitionAlignment alignment; //ALIGN_CYLINDER, ALIGN_STRICT, etc
|
PartitionAlignment alignment; //ALIGN_CYLINDER, ALIGN_STRICT, etc
|
||||||
FILESYSTEM filesystem ;
|
FSType filesystem;
|
||||||
Glib::ustring uuid ;
|
Glib::ustring uuid ;
|
||||||
Glib::ustring name;
|
Glib::ustring name;
|
||||||
Sector sector_start;
|
Sector sector_start;
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
Partition * clone_as_plain() const;
|
Partition * clone_as_plain() const;
|
||||||
|
|
||||||
void set_luks( const Glib::ustring & path,
|
void set_luks( const Glib::ustring & path,
|
||||||
FILESYSTEM fstype,
|
FSType fstype,
|
||||||
Sector header_size,
|
Sector header_size,
|
||||||
Sector mapping_size,
|
Sector mapping_size,
|
||||||
Byte_Value sector_size,
|
Byte_Value sector_size,
|
||||||
|
|
|
@ -57,7 +57,7 @@ const Glib::ustring UUID_RANDOM_NTFS_HALF = _("(Half new UUID - will be randomly
|
||||||
|
|
||||||
extern const Glib::ustring DEV_MAPPER_PATH;
|
extern const Glib::ustring DEV_MAPPER_PATH;
|
||||||
|
|
||||||
enum FILESYSTEM
|
enum FSType
|
||||||
{
|
{
|
||||||
// Special partition types and functions
|
// Special partition types and functions
|
||||||
FS_UNALLOCATED = 0,
|
FS_UNALLOCATED = 0,
|
||||||
|
@ -144,7 +144,7 @@ struct FS
|
||||||
EXTERNAL = 3
|
EXTERNAL = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
FILESYSTEM filesystem ;
|
FSType filesystem;
|
||||||
Support busy ; //How to determine if partition/file system is busy
|
Support busy ; //How to determine if partition/file system is busy
|
||||||
Support read ; //Can and how to read sector usage while inactive
|
Support read ; //Can and how to read sector usage while inactive
|
||||||
Support read_label ;
|
Support read_label ;
|
||||||
|
@ -163,7 +163,7 @@ struct FS
|
||||||
Support online_grow ;
|
Support online_grow ;
|
||||||
Support online_shrink ;
|
Support online_shrink ;
|
||||||
|
|
||||||
FS( FILESYSTEM fstype = FS_UNKNOWN ) : filesystem( fstype )
|
FS( FSType fstype = FS_UNKNOWN ) : filesystem( fstype )
|
||||||
{
|
{
|
||||||
busy = read = read_label = write_label = read_uuid = write_uuid = create =
|
busy = read = read_label = write_label = read_uuid = write_uuid = create =
|
||||||
create_with_label = grow = shrink = move = check = copy = remove = online_read =
|
create_with_label = grow = shrink = move = check = copy = remove = online_read =
|
||||||
|
@ -183,15 +183,15 @@ public:
|
||||||
, float yalign = 0.5 /* ALIGN_CENTER */
|
, float yalign = 0.5 /* ALIGN_CENTER */
|
||||||
) ;
|
) ;
|
||||||
static Glib::ustring num_to_str( Sector number ) ;
|
static Glib::ustring num_to_str( Sector number ) ;
|
||||||
static Glib::ustring get_color( FILESYSTEM filesystem ) ;
|
static Glib::ustring get_color( FSType filesystem );
|
||||||
static Glib::RefPtr<Gdk::Pixbuf> get_color_as_pixbuf( FILESYSTEM filesystem, int width, int height ) ;
|
static Glib::RefPtr<Gdk::Pixbuf> get_color_as_pixbuf( FSType filesystem, int width, int height );
|
||||||
static int get_max_partition_name_length( Glib::ustring & tabletype );
|
static int get_max_partition_name_length( Glib::ustring & tabletype );
|
||||||
static int get_filesystem_label_maxlength( FILESYSTEM filesystem ) ;
|
static int get_filesystem_label_maxlength( FSType filesystem );
|
||||||
static Glib::ustring get_filesystem_string( FILESYSTEM filesystem ) ;
|
static Glib::ustring get_filesystem_string( FSType filesystem );
|
||||||
static const Glib::ustring get_encrypted_string();
|
static const Glib::ustring get_encrypted_string();
|
||||||
static const Glib::ustring get_filesystem_string( bool encrypted, FILESYSTEM fstype );
|
static const Glib::ustring get_filesystem_string( bool encrypted, FSType fstype );
|
||||||
static const Glib::ustring get_filesystem_kernel_name( FILESYSTEM fstype );
|
static const Glib::ustring get_filesystem_kernel_name( FSType fstype );
|
||||||
static Glib::ustring get_filesystem_software( FILESYSTEM filesystem ) ;
|
static Glib::ustring get_filesystem_software( FSType filesystem );
|
||||||
static bool kernel_supports_fs( const Glib::ustring & fs ) ;
|
static bool kernel_supports_fs( const Glib::ustring & fs ) ;
|
||||||
static bool kernel_version_at_least( int major_ver, int minor_ver, int patch_ver ) ;
|
static bool kernel_version_at_least( int major_ver, int minor_ver, int patch_ver ) ;
|
||||||
static Glib::ustring format_size( Sector sectors, Byte_Value sector_size ) ;
|
static Glib::ustring format_size( Sector sectors, Byte_Value sector_size ) ;
|
||||||
|
|
|
@ -60,7 +60,7 @@ private:
|
||||||
void init_toolbar() ;
|
void init_toolbar() ;
|
||||||
void init_partition_menu() ;
|
void init_partition_menu() ;
|
||||||
Gtk::Menu * create_format_menu() ;
|
Gtk::Menu * create_format_menu() ;
|
||||||
void create_format_menu_add_item( FILESYSTEM filesystem, bool activate ) ;
|
void create_format_menu_add_item( FSType filesystem, bool activate );
|
||||||
void init_device_info() ;
|
void init_device_info() ;
|
||||||
void init_hpaned_main() ;
|
void init_hpaned_main() ;
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ private:
|
||||||
void activate_new();
|
void activate_new();
|
||||||
void activate_delete();
|
void activate_delete();
|
||||||
void activate_info();
|
void activate_info();
|
||||||
void activate_format( GParted::FILESYSTEM new_fs );
|
void activate_format( FSType new_fs );
|
||||||
bool check_toggle_busy_allowed( const Glib::ustring & disallowed_msg );
|
bool check_toggle_busy_allowed( const Glib::ustring & disallowed_msg );
|
||||||
void show_toggle_failure_dialog( const Glib::ustring & failure_summary,
|
void show_toggle_failure_dialog( const Glib::ustring & failure_summary,
|
||||||
const Glib::ustring & marked_up_error );
|
const Glib::ustring & marked_up_error );
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace GParted
|
||||||
|
|
||||||
class ext2 : public FileSystem
|
class ext2 : public FileSystem
|
||||||
{
|
{
|
||||||
const enum FILESYSTEM specific_type;
|
const enum FSType specific_type;
|
||||||
Glib::ustring dump_cmd;
|
Glib::ustring dump_cmd;
|
||||||
Glib::ustring fsck_cmd;
|
Glib::ustring fsck_cmd;
|
||||||
Glib::ustring image_cmd;
|
Glib::ustring image_cmd;
|
||||||
|
@ -40,7 +40,7 @@ class ext2 : public FileSystem
|
||||||
Glib::ustring resize_cmd;
|
Glib::ustring resize_cmd;
|
||||||
Glib::ustring tune_cmd;
|
Glib::ustring tune_cmd;
|
||||||
public:
|
public:
|
||||||
ext2( enum FILESYSTEM type ) : specific_type( type ), dump_cmd( "" ), fsck_cmd( "" ), image_cmd( "" ),
|
ext2( enum FSType type ) : specific_type( type ), dump_cmd( "" ), fsck_cmd( "" ), image_cmd( "" ),
|
||||||
label_cmd( "" ), mkfs_cmd( "" ), resize_cmd( "" ), tune_cmd( "" ),
|
label_cmd( "" ), mkfs_cmd( "" ), resize_cmd( "" ), tune_cmd( "" ),
|
||||||
force_auto_64bit( false ) {};
|
force_auto_64bit( false ) {};
|
||||||
FS get_filesystem_support() ;
|
FS get_filesystem_support() ;
|
||||||
|
|
|
@ -27,11 +27,11 @@ namespace GParted
|
||||||
|
|
||||||
class fat16 : public FileSystem
|
class fat16 : public FileSystem
|
||||||
{
|
{
|
||||||
const enum FILESYSTEM specific_type ;
|
const enum FSType specific_type;
|
||||||
Glib::ustring create_cmd ;
|
Glib::ustring create_cmd ;
|
||||||
Glib::ustring check_cmd ;
|
Glib::ustring check_cmd ;
|
||||||
public:
|
public:
|
||||||
fat16( enum FILESYSTEM type ) : specific_type( type ), create_cmd( "" ), check_cmd( "" ) {} ;
|
fat16( enum FSType type ) : specific_type( type ), create_cmd( "" ), check_cmd( "" ) {};
|
||||||
const Glib::ustring get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const;
|
const Glib::ustring get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const;
|
||||||
FS get_filesystem_support() ;
|
FS get_filesystem_support() ;
|
||||||
void set_used_sectors( Partition & partition ) ;
|
void set_used_sectors( Partition & partition ) ;
|
||||||
|
|
|
@ -429,7 +429,7 @@ void Dialog_Partition_New::Build_Filesystems_Menu( bool only_unformatted )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Byte_Value Dialog_Partition_New::get_filesystem_min_limit( FILESYSTEM fstype )
|
Byte_Value Dialog_Partition_New::get_filesystem_min_limit( FSType fstype )
|
||||||
{
|
{
|
||||||
return GParted_Core::get_filesystem_limits( fstype, *new_partition ).min_size;
|
return GParted_Core::get_filesystem_limits( fstype, *new_partition ).min_size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,7 +335,7 @@ void Dialog_Rescue_Data::read_partitions_from_buffer()
|
||||||
Glib::ustring part_path;
|
Glib::ustring part_path;
|
||||||
int part_num;
|
int part_num;
|
||||||
PartitionType type=GParted::TYPE_PRIMARY;
|
PartitionType type=GParted::TYPE_PRIMARY;
|
||||||
FILESYSTEM fs=GParted::FS_UNALLOCATED;
|
FSType fs = FS_UNALLOCATED;
|
||||||
Sector sec_start=0;
|
Sector sec_start=0;
|
||||||
Sector sec_end=0;
|
Sector sec_end=0;
|
||||||
Byte_Value sec_size=this->sector_size;
|
Byte_Value sec_size=this->sector_size;
|
||||||
|
|
|
@ -111,10 +111,10 @@ void GParted_Core::find_supported_core()
|
||||||
|
|
||||||
void GParted_Core::find_supported_filesystems()
|
void GParted_Core::find_supported_filesystems()
|
||||||
{
|
{
|
||||||
std::map< FILESYSTEM, FileSystem * >::iterator f ;
|
std::map< FSType, FileSystem * >::iterator f;
|
||||||
|
|
||||||
// Iteration of std::map is ordered according to operator< of the key. Hence the
|
// Iteration of std::map is ordered according to operator< of the key. Hence the
|
||||||
// FILESYSTEMS vector is constructed in FILESYSTEM enum order: FS_UNALLOCATED,
|
// FILESYSTEMS vector is constructed in FSType enum order: FS_UNALLOCATED,
|
||||||
// FS_UNKNOWN, FS_CLEARED, FS_EXTENDED, FS_BTRFS, ..., FS_LINUX_SWRAID,
|
// FS_UNKNOWN, FS_CLEARED, FS_EXTENDED, FS_BTRFS, ..., FS_LINUX_SWRAID,
|
||||||
// LINUX_SWSUSPEND which ultimately controls the default order of file systems in
|
// LINUX_SWSUSPEND which ultimately controls the default order of file systems in
|
||||||
// menus and dialogs.
|
// menus and dialogs.
|
||||||
|
@ -779,7 +779,7 @@ const std::vector<FS> & GParted_Core::get_filesystems() const
|
||||||
|
|
||||||
// Return supported capabilities of the file system type or, if not found, not supported
|
// Return supported capabilities of the file system type or, if not found, not supported
|
||||||
// capabilities set.
|
// capabilities set.
|
||||||
const FS & GParted_Core::get_fs( GParted::FILESYSTEM filesystem ) const
|
const FS & GParted_Core::get_fs( FSType filesystem ) const
|
||||||
{
|
{
|
||||||
for ( unsigned int t = 0 ; t < FILESYSTEMS .size() ; t++ )
|
for ( unsigned int t = 0 ; t < FILESYSTEMS .size() ; t++ )
|
||||||
{
|
{
|
||||||
|
@ -885,7 +885,7 @@ void GParted_Core::set_device_from_disk( Device & device, const Glib::ustring &
|
||||||
device.cylsize = MEBIBYTE / device.sector_size;
|
device.cylsize = MEBIBYTE / device.sector_size;
|
||||||
|
|
||||||
std::vector<Glib::ustring> messages;
|
std::vector<Glib::ustring> messages;
|
||||||
FILESYSTEM fstype = detect_filesystem( lp_device, NULL, messages );
|
FSType fstype = detect_filesystem( lp_device, NULL, messages );
|
||||||
// FS_Info (blkid) recognised file system signature on whole disk device.
|
// FS_Info (blkid) recognised file system signature on whole disk device.
|
||||||
// Need to detect before libparted reported partitioning to avoid bug in
|
// Need to detect before libparted reported partitioning to avoid bug in
|
||||||
// libparted 1.9.0 to 2.3 inclusive which recognised FAT file systems as
|
// libparted 1.9.0 to 2.3 inclusive which recognised FAT file systems as
|
||||||
|
@ -1033,7 +1033,7 @@ void GParted_Core::set_device_partitions( Device & device, PedDevice* lp_device,
|
||||||
libparted_messages .clear() ;
|
libparted_messages .clear() ;
|
||||||
Partition * partition_temp = NULL;
|
Partition * partition_temp = NULL;
|
||||||
bool partition_is_busy = false ;
|
bool partition_is_busy = false ;
|
||||||
GParted::FILESYSTEM filesystem;
|
FSType filesystem;
|
||||||
std::vector<Glib::ustring> detect_messages;
|
std::vector<Glib::ustring> detect_messages;
|
||||||
|
|
||||||
//Retrieve partition path
|
//Retrieve partition path
|
||||||
|
@ -1177,7 +1177,7 @@ void GParted_Core::set_device_partitions( Device & device, PedDevice* lp_device,
|
||||||
|
|
||||||
// Create one Partition object spanning the Device after identifying the file system
|
// Create one Partition object spanning the Device after identifying the file system
|
||||||
// on the whole disk device. Much simplified equivalent of set_device_partitions().
|
// on the whole disk device. Much simplified equivalent of set_device_partitions().
|
||||||
void GParted_Core::set_device_one_partition( Device & device, PedDevice * lp_device, FILESYSTEM fstype,
|
void GParted_Core::set_device_one_partition( Device & device, PedDevice * lp_device, FSType fstype,
|
||||||
std::vector<Glib::ustring> & messages )
|
std::vector<Glib::ustring> & messages )
|
||||||
{
|
{
|
||||||
device.partitions.clear();
|
device.partitions.clear();
|
||||||
|
@ -1224,7 +1224,7 @@ void GParted_Core::set_luks_partition( PartitionLUKS & partition )
|
||||||
Glib::ustring mapping_path = DEV_MAPPER_PATH + mapping.name;
|
Glib::ustring mapping_path = DEV_MAPPER_PATH + mapping.name;
|
||||||
PedDevice* lp_device = NULL;
|
PedDevice* lp_device = NULL;
|
||||||
std::vector<Glib::ustring> detect_messages;
|
std::vector<Glib::ustring> detect_messages;
|
||||||
FILESYSTEM fstype = FS_UNKNOWN;
|
FSType fstype = FS_UNKNOWN;
|
||||||
if ( get_device( mapping_path, lp_device ) )
|
if ( get_device( mapping_path, lp_device ) )
|
||||||
{
|
{
|
||||||
fstype = detect_filesystem( lp_device, NULL, detect_messages );
|
fstype = detect_filesystem( lp_device, NULL, detect_messages );
|
||||||
|
@ -1291,11 +1291,11 @@ void GParted_Core::set_partition_label_and_uuid( Partition & partition )
|
||||||
|
|
||||||
// GParted simple internal file system signature detection. Use sparingly. Only when
|
// GParted simple internal file system signature detection. Use sparingly. Only when
|
||||||
// (old versions of) blkid and libparted don't recognise a signature.
|
// (old versions of) blkid and libparted don't recognise a signature.
|
||||||
FILESYSTEM GParted_Core::detect_filesystem_internal( PedDevice * lp_device, PedPartition * lp_partition )
|
FSType GParted_Core::detect_filesystem_internal( PedDevice * lp_device, PedPartition * lp_partition )
|
||||||
{
|
{
|
||||||
char magic1[16]; // Big enough for largest signatures[].sig1 or sig2
|
char magic1[16]; // Big enough for largest signatures[].sig1 or sig2
|
||||||
char magic2[16];
|
char magic2[16];
|
||||||
FILESYSTEM fstype = FS_UNKNOWN;
|
FSType fstype = FS_UNKNOWN;
|
||||||
|
|
||||||
char * buf = static_cast<char *>( malloc( lp_device->sector_size ) );
|
char * buf = static_cast<char *>( malloc( lp_device->sector_size ) );
|
||||||
if ( ! buf )
|
if ( ! buf )
|
||||||
|
@ -1312,7 +1312,7 @@ FILESYSTEM GParted_Core::detect_filesystem_internal( PedDevice * lp_device, PedP
|
||||||
const char * sig1;
|
const char * sig1;
|
||||||
Byte_Value offset2;
|
Byte_Value offset2;
|
||||||
const char * sig2;
|
const char * sig2;
|
||||||
FILESYSTEM fstype;
|
FSType fstype;
|
||||||
} signatures[] = {
|
} signatures[] = {
|
||||||
//offset1, sig1 , offset2, sig2 , fstype
|
//offset1, sig1 , offset2, sig2 , fstype
|
||||||
{ 65536LL, "ReIsEr4" , 0LL, NULL , FS_REISER4 },
|
{ 65536LL, "ReIsEr4" , 0LL, NULL , FS_REISER4 },
|
||||||
|
@ -1380,7 +1380,7 @@ FILESYSTEM GParted_Core::detect_filesystem_internal( PedDevice * lp_device, PedP
|
||||||
return fstype;
|
return fstype;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILESYSTEM GParted_Core::detect_filesystem( PedDevice * lp_device, PedPartition * lp_partition,
|
FSType GParted_Core::detect_filesystem( PedDevice * lp_device, PedPartition * lp_partition,
|
||||||
std::vector<Glib::ustring> & messages )
|
std::vector<Glib::ustring> & messages )
|
||||||
{
|
{
|
||||||
Glib::ustring fsname = "";
|
Glib::ustring fsname = "";
|
||||||
|
@ -1477,7 +1477,7 @@ FILESYSTEM GParted_Core::detect_filesystem( PedDevice * lp_device, PedPartition
|
||||||
}
|
}
|
||||||
|
|
||||||
// (Q4) Fallback to GParted simple internal file system detection
|
// (Q4) Fallback to GParted simple internal file system detection
|
||||||
FILESYSTEM fstype = detect_filesystem_internal( lp_device, lp_partition );
|
FSType fstype = detect_filesystem_internal( lp_device, lp_partition );
|
||||||
if ( fstype != FS_UNKNOWN )
|
if ( fstype != FS_UNKNOWN )
|
||||||
return fstype;
|
return fstype;
|
||||||
|
|
||||||
|
@ -1668,7 +1668,7 @@ bool GParted_Core::set_mountpoints_helper( Partition & partition, const Glib::us
|
||||||
}
|
}
|
||||||
|
|
||||||
//Report whether the partition is busy (mounted/active)
|
//Report whether the partition is busy (mounted/active)
|
||||||
bool GParted_Core::is_busy( FILESYSTEM fstype, const Glib::ustring & path )
|
bool GParted_Core::is_busy( FSType fstype, const Glib::ustring & path )
|
||||||
{
|
{
|
||||||
FileSystem * p_filesystem = NULL ;
|
FileSystem * p_filesystem = NULL ;
|
||||||
bool busy = false ;
|
bool busy = false ;
|
||||||
|
@ -3768,7 +3768,7 @@ bool GParted_Core::update_dmraid_entry( const Partition & partition, OperationDe
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystem * GParted_Core::get_filesystem_object( FILESYSTEM filesystem )
|
FileSystem * GParted_Core::get_filesystem_object( FSType filesystem )
|
||||||
{
|
{
|
||||||
if ( FILESYSTEM_MAP .count( filesystem ) )
|
if ( FILESYSTEM_MAP .count( filesystem ) )
|
||||||
return FILESYSTEM_MAP[ filesystem ] ;
|
return FILESYSTEM_MAP[ filesystem ] ;
|
||||||
|
@ -3777,12 +3777,12 @@ FileSystem * GParted_Core::get_filesystem_object( FILESYSTEM filesystem )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true for file systems with an implementation class, false otherwise
|
// Return true for file systems with an implementation class, false otherwise
|
||||||
bool GParted_Core::supported_filesystem( FILESYSTEM fstype )
|
bool GParted_Core::supported_filesystem( FSType fstype )
|
||||||
{
|
{
|
||||||
return get_filesystem_object( fstype ) != NULL;
|
return get_filesystem_object( fstype ) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FS_Limits GParted_Core::get_filesystem_limits( FILESYSTEM fstype, const Partition & partition )
|
FS_Limits GParted_Core::get_filesystem_limits( FSType fstype, const Partition & partition )
|
||||||
{
|
{
|
||||||
FileSystem *p_filesystem = get_filesystem_object( fstype );
|
FileSystem *p_filesystem = get_filesystem_object( fstype );
|
||||||
FS_Limits fs_limits;
|
FS_Limits fs_limits;
|
||||||
|
@ -4162,7 +4162,7 @@ void GParted_Core::init_filesystems()
|
||||||
|
|
||||||
void GParted_Core::fini_filesystems()
|
void GParted_Core::fini_filesystems()
|
||||||
{
|
{
|
||||||
std::map<FILESYSTEM, FileSystem *>::iterator fs_iter;
|
std::map<FSType, FileSystem *>::iterator fs_iter;
|
||||||
for ( fs_iter = FILESYSTEM_MAP.begin() ; fs_iter != FILESYSTEM_MAP.end() ; fs_iter ++ )
|
for ( fs_iter = FILESYSTEM_MAP.begin() ; fs_iter != FILESYSTEM_MAP.end() ; fs_iter ++ )
|
||||||
{
|
{
|
||||||
delete fs_iter->second;
|
delete fs_iter->second;
|
||||||
|
@ -4483,6 +4483,6 @@ GParted_Core::~GParted_Core()
|
||||||
|
|
||||||
Glib::Thread *GParted_Core::mainthread;
|
Glib::Thread *GParted_Core::mainthread;
|
||||||
|
|
||||||
std::map< FILESYSTEM, FileSystem * > GParted_Core::FILESYSTEM_MAP;
|
std::map< FSType, FileSystem * > GParted_Core::FILESYSTEM_MAP;
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
|
@ -61,7 +61,7 @@ void Partition::Set( const Glib::ustring & device_path,
|
||||||
const Glib::ustring & partition,
|
const Glib::ustring & partition,
|
||||||
int partition_number,
|
int partition_number,
|
||||||
PartitionType type,
|
PartitionType type,
|
||||||
FILESYSTEM filesystem,
|
FSType filesystem,
|
||||||
Sector sector_start,
|
Sector sector_start,
|
||||||
Sector sector_end,
|
Sector sector_end,
|
||||||
Byte_Value sector_size,
|
Byte_Value sector_size,
|
||||||
|
@ -198,7 +198,7 @@ void Partition::Set_Unallocated( const Glib::ustring & device_path,
|
||||||
|
|
||||||
void Partition::set_unpartitioned( const Glib::ustring & device_path,
|
void Partition::set_unpartitioned( const Glib::ustring & device_path,
|
||||||
const Glib::ustring & partition_path,
|
const Glib::ustring & partition_path,
|
||||||
FILESYSTEM fstype,
|
FSType fstype,
|
||||||
Sector length,
|
Sector length,
|
||||||
Byte_Value sector_size,
|
Byte_Value sector_size,
|
||||||
bool busy )
|
bool busy )
|
||||||
|
|
|
@ -70,7 +70,7 @@ Partition * PartitionLUKS::clone_as_plain() const
|
||||||
// like a whole disk device as /dev/mapper/CRYPTNAME contains no partition table and the
|
// like a whole disk device as /dev/mapper/CRYPTNAME contains no partition table and the
|
||||||
// file system starts from sector 0 going to the very end.
|
// file system starts from sector 0 going to the very end.
|
||||||
void PartitionLUKS::set_luks( const Glib::ustring & path,
|
void PartitionLUKS::set_luks( const Glib::ustring & path,
|
||||||
FILESYSTEM fstype,
|
FSType fstype,
|
||||||
Sector header_size,
|
Sector header_size,
|
||||||
Sector mapping_size,
|
Sector mapping_size,
|
||||||
Byte_Value sector_size,
|
Byte_Value sector_size,
|
||||||
|
|
14
src/Utils.cc
14
src/Utils.cc
|
@ -84,7 +84,7 @@ Glib::ustring Utils::num_to_str( Sector number )
|
||||||
// Use palette from GNOME Human Interface Guidelines as a starting point.
|
// Use palette from GNOME Human Interface Guidelines as a starting point.
|
||||||
// http://developer.gnome.org/hig-book/2.32/design-color.html.en
|
// http://developer.gnome.org/hig-book/2.32/design-color.html.en
|
||||||
// http://web.archive.org/web/20130922173112/https://developer.gnome.org/hig-book/stable/design-color.html.en
|
// http://web.archive.org/web/20130922173112/https://developer.gnome.org/hig-book/stable/design-color.html.en
|
||||||
Glib::ustring Utils::get_color( FILESYSTEM filesystem )
|
Glib::ustring Utils::get_color( FSType filesystem )
|
||||||
{
|
{
|
||||||
switch( filesystem )
|
switch( filesystem )
|
||||||
{
|
{
|
||||||
|
@ -128,7 +128,7 @@ Glib::ustring Utils::get_color( FILESYSTEM filesystem )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::RefPtr<Gdk::Pixbuf> Utils::get_color_as_pixbuf( FILESYSTEM filesystem, int width, int height )
|
Glib::RefPtr<Gdk::Pixbuf> Utils::get_color_as_pixbuf( FSType filesystem, int width, int height )
|
||||||
{
|
{
|
||||||
Glib::RefPtr<Gdk::Pixbuf> pixbuf = Gdk::Pixbuf::create( Gdk::COLORSPACE_RGB, false, 8, width, height ) ;
|
Glib::RefPtr<Gdk::Pixbuf> pixbuf = Gdk::Pixbuf::create( Gdk::COLORSPACE_RGB, false, 8, width, height ) ;
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ int Utils::get_max_partition_name_length( Glib::ustring & tabletype )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Utils::get_filesystem_label_maxlength( FILESYSTEM filesystem )
|
int Utils::get_filesystem_label_maxlength( FSType filesystem )
|
||||||
{
|
{
|
||||||
switch( filesystem )
|
switch( filesystem )
|
||||||
{
|
{
|
||||||
|
@ -242,7 +242,7 @@ int Utils::get_filesystem_label_maxlength( FILESYSTEM filesystem )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return libparted file system name / GParted display name
|
// Return libparted file system name / GParted display name
|
||||||
Glib::ustring Utils::get_filesystem_string( FILESYSTEM filesystem )
|
Glib::ustring Utils::get_filesystem_string( FSType filesystem )
|
||||||
{
|
{
|
||||||
switch( filesystem )
|
switch( filesystem )
|
||||||
{
|
{
|
||||||
|
@ -314,7 +314,7 @@ const Glib::ustring Utils::get_encrypted_string()
|
||||||
return "[" + Glib::ustring( _("Encrypted") ) + "]";
|
return "[" + Glib::ustring( _("Encrypted") ) + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
const Glib::ustring Utils::get_filesystem_string( bool encrypted, FILESYSTEM fstype )
|
const Glib::ustring Utils::get_filesystem_string( bool encrypted, FSType fstype )
|
||||||
{
|
{
|
||||||
if ( encrypted )
|
if ( encrypted )
|
||||||
return get_encrypted_string() + " " + get_filesystem_string( fstype );
|
return get_encrypted_string() + " " + get_filesystem_string( fstype );
|
||||||
|
@ -324,7 +324,7 @@ const Glib::ustring Utils::get_filesystem_string( bool encrypted, FILESYSTEM fst
|
||||||
|
|
||||||
// Return Linux kernel name only for mountable file systems.
|
// Return Linux kernel name only for mountable file systems.
|
||||||
// (Identical to a subset of the libparted names except that it's hfsplus instead of hfs+).
|
// (Identical to a subset of the libparted names except that it's hfsplus instead of hfs+).
|
||||||
const Glib::ustring Utils::get_filesystem_kernel_name( FILESYSTEM fstype )
|
const Glib::ustring Utils::get_filesystem_kernel_name( FSType fstype )
|
||||||
{
|
{
|
||||||
switch ( fstype )
|
switch ( fstype )
|
||||||
{
|
{
|
||||||
|
@ -350,7 +350,7 @@ const Glib::ustring Utils::get_filesystem_kernel_name( FILESYSTEM fstype )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::ustring Utils::get_filesystem_software( FILESYSTEM filesystem )
|
Glib::ustring Utils::get_filesystem_software( FSType filesystem )
|
||||||
{
|
{
|
||||||
switch( filesystem )
|
switch( filesystem )
|
||||||
{
|
{
|
||||||
|
|
|
@ -447,7 +447,7 @@ Gtk::Menu * Win_GParted::create_format_menu()
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add one entry to the Partition --> Format to --> (file system list) menu
|
//Add one entry to the Partition --> Format to --> (file system list) menu
|
||||||
void Win_GParted::create_format_menu_add_item( FILESYSTEM filesystem, bool activate )
|
void Win_GParted::create_format_menu_add_item( FSType filesystem, bool activate )
|
||||||
{
|
{
|
||||||
hbox = manage( new Gtk::HBox() ) ;
|
hbox = manage( new Gtk::HBox() ) ;
|
||||||
//the colored square
|
//the colored square
|
||||||
|
@ -460,8 +460,7 @@ void Win_GParted::create_format_menu_add_item( FILESYSTEM filesystem, bool activ
|
||||||
menu ->items() .push_back( * manage( new Gtk::MenuItem( *hbox ) ) ) ;
|
menu ->items() .push_back( * manage( new Gtk::MenuItem( *hbox ) ) ) ;
|
||||||
if ( activate )
|
if ( activate )
|
||||||
menu ->items() .back() .signal_activate() .connect(
|
menu ->items() .back() .signal_activate() .connect(
|
||||||
sigc::bind<GParted::FILESYSTEM>( sigc::mem_fun( *this, &Win_GParted::activate_format ),
|
sigc::bind<FSType>( sigc::mem_fun( *this, &Win_GParted::activate_format ), filesystem ) );
|
||||||
filesystem ) ) ;
|
|
||||||
else
|
else
|
||||||
menu ->items() .back() .set_sensitive( false ) ;
|
menu ->items() .back() .set_sensitive( false ) ;
|
||||||
}
|
}
|
||||||
|
@ -1796,7 +1795,7 @@ void Win_GParted::activate_resize()
|
||||||
|
|
||||||
Partition * working_ptn;
|
Partition * working_ptn;
|
||||||
const Partition & selected_filesystem_ptn = selected_partition_ptr->get_filesystem_partition();
|
const Partition & selected_filesystem_ptn = selected_partition_ptr->get_filesystem_partition();
|
||||||
const FILESYSTEM fstype = selected_filesystem_ptn.filesystem;
|
const FSType fstype = selected_filesystem_ptn.filesystem;
|
||||||
FS fs_cap = gparted_core.get_fs( fstype );
|
FS fs_cap = gparted_core.get_fs( fstype );
|
||||||
FS_Limits fs_limits = gparted_core.get_filesystem_limits( fstype, selected_filesystem_ptn );
|
FS_Limits fs_limits = gparted_core.get_filesystem_limits( fstype, selected_filesystem_ptn );
|
||||||
|
|
||||||
|
@ -2248,7 +2247,7 @@ void Win_GParted::activate_info()
|
||||||
dialog .run();
|
dialog .run();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win_GParted::activate_format( GParted::FILESYSTEM new_fs )
|
void Win_GParted::activate_format( FSType new_fs )
|
||||||
{
|
{
|
||||||
g_assert( selected_partition_ptr != NULL ); // Bug: Partition callback without a selected partition
|
g_assert( selected_partition_ptr != NULL ); // Bug: Partition callback without a selected partition
|
||||||
g_assert( valid_display_partition_ptr( selected_partition_ptr ) ); // Bug: Not pointing at a valid display partition object
|
g_assert( valid_display_partition_ptr( selected_partition_ptr ) ); // Bug: Not pointing at a valid display partition object
|
||||||
|
|
Loading…
Reference in New Issue