Tidy-up GParted_Core::init/fini_filesystems() function declarations

These member functions are only used within the GParted_Core class and
only operate on the static member variable FILESYSTEM_MAP.

Make both functions private and also make init_filesystems() static.
This commit is contained in:
Mike Fleetwood 2015-04-24 21:57:49 +01:00 committed by Curtis Gedak
parent 40820bada7
commit df000a94a6
2 changed files with 42 additions and 41 deletions

View File

@ -35,8 +35,6 @@ public:
GParted_Core() ;
~GParted_Core() ;
void init_filesystems() ;
static void fini_filesystems();
void find_supported_filesystems() ;
void set_user_devices( const std::vector<Glib::ustring> & user_devices ) ;
void set_devices( std::vector<Device> & devices ) ;
@ -188,6 +186,9 @@ private:
bool update_bootsector( const Partition & partition, OperationDetail & operationdetail ) ;
//general..
static void init_filesystems();
static void fini_filesystems();
bool flush_device( PedDevice * lp_device ) ;
bool get_device( const Glib::ustring & device_path, PedDevice *& lp_device, bool flush = false );
bool get_disk( PedDevice *& lp_device, PedDisk *& lp_disk, bool strict = true );

View File

@ -99,45 +99,6 @@ GParted_Core::GParted_Core()
find_supported_filesystems() ;
}
void GParted_Core::init_filesystems()
{
FILESYSTEM_MAP[ FS_UNKNOWN ] = NULL ;
FILESYSTEM_MAP[ FS_CLEARED ] = NULL ;
FILESYSTEM_MAP[ FS_BTRFS ] = new btrfs() ;
FILESYSTEM_MAP[ FS_EXFAT ] = new exfat() ;
FILESYSTEM_MAP[ FS_EXT2 ] = new ext2( FS_EXT2 ) ;
FILESYSTEM_MAP[ FS_EXT3 ] = new ext2( FS_EXT3 ) ;
FILESYSTEM_MAP[ FS_EXT4 ] = new ext2( FS_EXT4 ) ;
FILESYSTEM_MAP[ FS_F2FS ] = new f2fs() ;
FILESYSTEM_MAP[ FS_FAT16 ] = new fat16( FS_FAT16 ) ;
FILESYSTEM_MAP[ FS_FAT32 ] = new fat16( FS_FAT32 ) ;
FILESYSTEM_MAP[ FS_HFS ] = new hfs() ;
FILESYSTEM_MAP[ FS_HFSPLUS ] = new hfsplus() ;
FILESYSTEM_MAP[ FS_JFS ] = new jfs() ;
FILESYSTEM_MAP[ FS_LINUX_SWAP ] = new linux_swap() ;
FILESYSTEM_MAP[ FS_LVM2_PV ] = new lvm2_pv() ;
FILESYSTEM_MAP[ FS_NILFS2 ] = new nilfs2() ;
FILESYSTEM_MAP[ FS_NTFS ] = new ntfs() ;
FILESYSTEM_MAP[ FS_REISER4 ] = new reiser4() ;
FILESYSTEM_MAP[ FS_REISERFS ] = new reiserfs() ;
FILESYSTEM_MAP[ FS_UFS ] = new ufs() ;
FILESYSTEM_MAP[ FS_XFS ] = new xfs() ;
FILESYSTEM_MAP[ FS_BITLOCKER ] = NULL ;
FILESYSTEM_MAP[ FS_LUKS ] = NULL ;
FILESYSTEM_MAP[ FS_LINUX_SWRAID ] = NULL ;
FILESYSTEM_MAP[ FS_LINUX_SWSUSPEND ] = NULL ;
}
void GParted_Core::fini_filesystems()
{
std::map<FILESYSTEM, FileSystem *>::iterator fs_iter;
for ( fs_iter = FILESYSTEM_MAP.begin() ; fs_iter != FILESYSTEM_MAP.end() ; fs_iter ++ )
{
delete fs_iter->second;
fs_iter->second = NULL;
}
}
void GParted_Core::find_supported_filesystems()
{
std::map< FILESYSTEM, FileSystem * >::iterator f ;
@ -3804,6 +3765,45 @@ bool GParted_Core::update_bootsector( const Partition & partition, OperationDeta
return true ;
}
void GParted_Core::init_filesystems()
{
FILESYSTEM_MAP[FS_UNKNOWN] = NULL;
FILESYSTEM_MAP[FS_CLEARED] = NULL;
FILESYSTEM_MAP[FS_BTRFS] = new btrfs();
FILESYSTEM_MAP[FS_EXFAT] = new exfat();
FILESYSTEM_MAP[FS_EXT2] = new ext2( FS_EXT2 );
FILESYSTEM_MAP[FS_EXT3] = new ext2( FS_EXT3 );
FILESYSTEM_MAP[FS_EXT4] = new ext2( FS_EXT4 );
FILESYSTEM_MAP[FS_F2FS] = new f2fs();
FILESYSTEM_MAP[FS_FAT16] = new fat16( FS_FAT16 );
FILESYSTEM_MAP[FS_FAT32] = new fat16( FS_FAT32 );
FILESYSTEM_MAP[FS_HFS] = new hfs();
FILESYSTEM_MAP[FS_HFSPLUS] = new hfsplus();
FILESYSTEM_MAP[FS_JFS] = new jfs();
FILESYSTEM_MAP[FS_LINUX_SWAP] = new linux_swap();
FILESYSTEM_MAP[FS_LVM2_PV] = new lvm2_pv();
FILESYSTEM_MAP[FS_NILFS2] = new nilfs2();
FILESYSTEM_MAP[FS_NTFS] = new ntfs();
FILESYSTEM_MAP[FS_REISER4] = new reiser4();
FILESYSTEM_MAP[FS_REISERFS] = new reiserfs();
FILESYSTEM_MAP[FS_UFS] = new ufs();
FILESYSTEM_MAP[FS_XFS] = new xfs();
FILESYSTEM_MAP[FS_BITLOCKER] = NULL;
FILESYSTEM_MAP[FS_LUKS] = NULL;
FILESYSTEM_MAP[FS_LINUX_SWRAID] = NULL;
FILESYSTEM_MAP[FS_LINUX_SWSUSPEND] = NULL;
}
void GParted_Core::fini_filesystems()
{
std::map<FILESYSTEM, FileSystem *>::iterator fs_iter;
for ( fs_iter = FILESYSTEM_MAP.begin() ; fs_iter != FILESYSTEM_MAP.end() ; fs_iter ++ )
{
delete fs_iter->second;
fs_iter->second = NULL;
}
}
//Flush the Linux kernel caches, and therefore ensure coherency between the caches of the
// whole disk device and the partition devices.
//