Return and use constant reference from LVM2_PV_Info::get_vg_name() (!94)
Closes !94 - Make more getter methods use return-by-constant-reference
This commit is contained in:
parent
55a74645f6
commit
c35422a70c
|
@ -55,7 +55,7 @@ class LVM2_PV_Info
|
||||||
public:
|
public:
|
||||||
static bool is_lvm2_pv_supported();
|
static bool is_lvm2_pv_supported();
|
||||||
static void clear_cache();
|
static void clear_cache();
|
||||||
static Glib::ustring get_vg_name( const Glib::ustring & path );
|
static const Glib::ustring& get_vg_name(const Glib::ustring& path);
|
||||||
static Byte_Value get_size_bytes( const Glib::ustring & path );
|
static Byte_Value get_size_bytes( const Glib::ustring & path );
|
||||||
static Byte_Value get_free_bytes( const Glib::ustring & path );
|
static Byte_Value get_free_bytes( const Glib::ustring & path );
|
||||||
static bool has_active_lvs( const Glib::ustring & path );
|
static bool has_active_lvs( const Glib::ustring & path );
|
||||||
|
|
|
@ -1463,7 +1463,7 @@ void GParted_Core::set_mountpoints( Partition & partition )
|
||||||
|
|
||||||
if (partition.fstype == FS_LVM2_PV)
|
if (partition.fstype == FS_LVM2_PV)
|
||||||
{
|
{
|
||||||
Glib::ustring vgname = LVM2_PV_Info::get_vg_name( partition.get_path() );
|
const Glib::ustring& vgname = LVM2_PV_Info::get_vg_name(partition.get_path());
|
||||||
if ( ! vgname.empty() )
|
if ( ! vgname.empty() )
|
||||||
partition.add_mountpoint( vgname );
|
partition.add_mountpoint( vgname );
|
||||||
}
|
}
|
||||||
|
@ -3694,7 +3694,7 @@ bool GParted_Core::filesystem_resize_disallowed( const Partition & partition )
|
||||||
if (partition.fstype == FS_LVM2_PV)
|
if (partition.fstype == FS_LVM2_PV)
|
||||||
{
|
{
|
||||||
//The LVM2 PV can't be resized when it's a member of an export VG
|
//The LVM2 PV can't be resized when it's a member of an export VG
|
||||||
Glib::ustring vgname = LVM2_PV_Info::get_vg_name( partition.get_path() );
|
const Glib::ustring& vgname = LVM2_PV_Info::get_vg_name(partition.get_path());
|
||||||
if ( vgname .empty() )
|
if ( vgname .empty() )
|
||||||
return false ;
|
return false ;
|
||||||
return LVM2_PV_Info::is_vg_exported( vgname );
|
return LVM2_PV_Info::is_vg_exported( vgname );
|
||||||
|
|
|
@ -87,7 +87,8 @@ void LVM2_PV_Info::clear_cache()
|
||||||
lvm2_pv_info_cache_initialized = false;
|
lvm2_pv_info_cache_initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::ustring LVM2_PV_Info::get_vg_name( const Glib::ustring & path )
|
|
||||||
|
const Glib::ustring& LVM2_PV_Info::get_vg_name(const Glib::ustring& path)
|
||||||
{
|
{
|
||||||
initialize_if_required() ;
|
initialize_if_required() ;
|
||||||
const LVM2_PV& pv = get_pv_cache_entry_by_name(path);
|
const LVM2_PV& pv = get_pv_cache_entry_by_name(path);
|
||||||
|
|
|
@ -3597,7 +3597,7 @@ bool Win_GParted::remove_non_empty_lvm2_pv_dialog( const OperationType optype )
|
||||||
tmp_msg += "\n\n" ;
|
tmp_msg += "\n\n" ;
|
||||||
tmp_msg += _( "Do you want to continue to forcibly delete the Physical Volume?" ) ;
|
tmp_msg += _( "Do you want to continue to forcibly delete the Physical Volume?" ) ;
|
||||||
|
|
||||||
Glib::ustring vgname = LVM2_PV_Info::get_vg_name( selected_partition_ptr->get_path() );
|
const Glib::ustring& vgname = LVM2_PV_Info::get_vg_name(selected_partition_ptr->get_path());
|
||||||
std::vector<Glib::ustring> members ;
|
std::vector<Glib::ustring> members ;
|
||||||
if ( ! vgname .empty() )
|
if ( ! vgname .empty() )
|
||||||
members = LVM2_PV_Info::get_vg_members( vgname );
|
members = LVM2_PV_Info::get_vg_members( vgname );
|
||||||
|
|
|
@ -121,7 +121,7 @@ bool lvm2_pv::check_repair( const Partition & partition, OperationDetail & opera
|
||||||
|
|
||||||
bool lvm2_pv::remove( const Partition & partition, OperationDetail & operationdetail )
|
bool lvm2_pv::remove( const Partition & partition, OperationDetail & operationdetail )
|
||||||
{
|
{
|
||||||
Glib::ustring vgname = LVM2_PV_Info::get_vg_name( partition.get_path() );
|
const Glib::ustring& vgname = LVM2_PV_Info::get_vg_name(partition.get_path());
|
||||||
Glib::ustring cmd ;
|
Glib::ustring cmd ;
|
||||||
if ( vgname .empty() )
|
if ( vgname .empty() )
|
||||||
cmd = "lvm pvremove " + Glib::shell_quote( partition.get_path() );
|
cmd = "lvm pvremove " + Glib::shell_quote( partition.get_path() );
|
||||||
|
|
Loading…
Reference in New Issue