mirror of
https://gitlab.gnome.org/GNOME/gparted
synced 2024-06-30 23:05:09 +00:00
Compare commits
4 Commits
946e482800
...
69fa0beaba
Author | SHA1 | Date | |
---|---|---|---|
|
69fa0beaba | ||
|
e03fb23359 | ||
|
7b047ec6e8 | ||
|
26a3140d4b |
|
@ -210,12 +210,11 @@ void DMRaid::get_devices( std::vector<Glib::ustring> & device_list )
|
|||
Glib::ustring DMRaid::get_dmraid_name( const Glib::ustring & dev_path )
|
||||
{
|
||||
//Retrieve name of dmraid device
|
||||
Glib::ustring dmraid_name = "" ;
|
||||
Glib::ustring regexp = "" ;
|
||||
Glib::ustring dmraid_name;
|
||||
|
||||
for ( unsigned int k=0; k < dmraid_devices .size(); k++ )
|
||||
{
|
||||
regexp = ".*(" + dmraid_devices[k] + ").*" ;
|
||||
Glib::ustring regexp = ".*(" + dmraid_devices[k] + ").*";
|
||||
if ( Utils::regexp_label( dev_path, regexp ) == dmraid_devices[k] )
|
||||
dmraid_name = dmraid_devices[k] ;
|
||||
}
|
||||
|
@ -256,7 +255,7 @@ void DMRaid::get_dmraid_dir_entries( const Glib::ustring & dev_path, std::vector
|
|||
Glib::ustring dmraid_name = get_dmraid_name( dev_path ) ;
|
||||
|
||||
//Loop through the entries in the directory
|
||||
Glib::ustring filename = "" ;
|
||||
Glib::ustring filename;
|
||||
Glib::Dir dir( DEV_MAPPER_PATH );
|
||||
while ( ( filename = dir .read_name() ) != "" )
|
||||
{
|
||||
|
@ -277,9 +276,9 @@ int DMRaid::get_partition_number( const Glib::ustring & partition_name )
|
|||
Glib::ustring DMRaid::get_udev_dm_name( const Glib::ustring & dev_path )
|
||||
{
|
||||
//Retrieve DM_NAME of device using udev information
|
||||
Glib::ustring output = "" ;
|
||||
Glib::ustring error = "" ;
|
||||
Glib::ustring dm_name = "" ;
|
||||
Glib::ustring output;
|
||||
Glib::ustring error;
|
||||
Glib::ustring dm_name;
|
||||
|
||||
if (udevadm_found)
|
||||
Utils::execute_command( "udevadm info --query=all --name=" + Glib::shell_quote( dev_path ),
|
||||
|
|
|
@ -228,7 +228,7 @@ void Dialog_Partition_Info::Display_Info()
|
|||
|
||||
Sector ptn_sectors = partition .get_sector_length() ;
|
||||
|
||||
Glib::ustring vgname = "" ; //Also used in partition status message
|
||||
Glib::ustring vgname;
|
||||
if (filesystem_ptn.fstype == FS_LVM2_PV)
|
||||
vgname = LVM2_PV_Info::get_vg_name( filesystem_ptn.get_path() );
|
||||
|
||||
|
|
|
@ -1235,7 +1235,6 @@ FSType GParted_Core::detect_filesystem(const PedDevice *lp_device, const PedPart
|
|||
{
|
||||
g_assert(lp_device != nullptr); // Bug: Not initialised by call to ped_device_get() or ped_device_get_next()
|
||||
|
||||
Glib::ustring fsname = "";
|
||||
Glib::ustring path;
|
||||
DMRaid dmraid;
|
||||
|
||||
|
@ -1257,7 +1256,7 @@ FSType GParted_Core::detect_filesystem(const PedDevice *lp_device, const PedPart
|
|||
// (Q2) FS_Info (blkid) file system detection
|
||||
// Blkid detects more signatures and generally has less limitations so use before
|
||||
// libparted detection, but it doesn't report anything for extended partitions.
|
||||
fsname = FS_Info::get_fs_type( path );
|
||||
Glib::ustring fsname = FS_Info::get_fs_type(path);
|
||||
|
||||
// (Q3) Libparted file system detection
|
||||
// Only used when blkid didn't report anything and only on partitions, not whole
|
||||
|
|
|
@ -535,14 +535,17 @@ bool Utils::kernel_version_at_least( int major_ver, int minor_ver, int patch_ver
|
|||
Glib::ustring Utils::format_size( Sector sectors, Byte_Value sector_size )
|
||||
{
|
||||
std::stringstream ss ;
|
||||
ss << std::setiosflags( std::ios::fixed ) << std::setprecision( 2 ) ;
|
||||
ss << std::setiosflags(std::ios::fixed);
|
||||
|
||||
if ( (sectors * sector_size) < KIBIBYTE )
|
||||
{
|
||||
ss << std::setprecision(0);
|
||||
ss << sector_to_unit( sectors, sector_size, UNIT_BYTE ) ;
|
||||
return Glib::ustring::compose( _("%1 B"), ss .str() ) ;
|
||||
}
|
||||
else if ( (sectors * sector_size) < MEBIBYTE )
|
||||
|
||||
ss << std::setprecision(2);
|
||||
if (sectors * sector_size < MEBIBYTE)
|
||||
{
|
||||
ss << sector_to_unit( sectors, sector_size, UNIT_KIB ) ;
|
||||
return Glib::ustring::compose( _("%1 KiB"), ss .str() ) ;
|
||||
|
|
|
@ -3322,7 +3322,7 @@ void Win_GParted::activate_change_uuid()
|
|||
Gtk::MESSAGE_WARNING,
|
||||
Gtk::BUTTONS_OK,
|
||||
true );
|
||||
Glib::ustring tmp_msg = "" ;
|
||||
Glib::ustring tmp_msg;
|
||||
for ( i = 1 ; filesystem_object->get_custom_text( CTEXT_CHANGE_UUID_WARNING, i ) != "" ; i++ )
|
||||
{
|
||||
if ( i > 1 )
|
||||
|
@ -3563,18 +3563,8 @@ bool Win_GParted::remove_non_empty_lvm2_pv_dialog( const OperationType optype )
|
|||
Gtk::Label *label_members = Utils::mk_label("<b>" + Glib::ustring(members_label) + "</b>",
|
||||
true, false, false, Gtk::ALIGN_START);
|
||||
grid->attach(*label_members, 0, 1, 1, 1);
|
||||
|
||||
Glib::ustring members_str = "" ;
|
||||
if ( ! members .empty() )
|
||||
{
|
||||
for ( unsigned int i = 0 ; i < members .size() ; i ++ )
|
||||
{
|
||||
if ( i > 0 )
|
||||
members_str += "\n" ;
|
||||
members_str += members[i] ;
|
||||
}
|
||||
}
|
||||
Gtk::Label *value_members = Utils::mk_label(members_str, true, false, true, Gtk::ALIGN_START);
|
||||
Gtk::Label *value_members = Utils::mk_label(Glib::build_path("\n", members),
|
||||
true, false, true, Gtk::ALIGN_START);
|
||||
grid->attach(*value_members, 1, 1, 1, 1);
|
||||
value_members->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
||||
label_members->get_accessible());
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
|
||||
#include "bcachefs.h"
|
||||
#include "BlockSpecial.h"
|
||||
#include "FileSystem.h"
|
||||
#include "OperationDetail.h"
|
||||
#include "Partition.h"
|
||||
|
@ -73,6 +74,35 @@ void bcachefs::set_used_sectors(Partition& partition)
|
|||
return;
|
||||
}
|
||||
|
||||
// Example output:
|
||||
// # bcachefs fs usage /mnt/1 | egrep ' \(device |free:|capacity:'
|
||||
// (no label) (device 0): sdb1 rw
|
||||
// free: 522190848 3984
|
||||
// capacity: 1073741824 8192
|
||||
// (no label) (device 1): sdb2 rw
|
||||
// free: 1061945344 8102
|
||||
// capacity: 1073741824 8192
|
||||
//
|
||||
// Substring the output down to just the device section for this partition.
|
||||
BlockSpecial wanted = BlockSpecial(partition.get_path());
|
||||
bool found = false;
|
||||
Glib::ustring::size_type start_offset = output.find(" (device ");
|
||||
while (start_offset != Glib::ustring::npos)
|
||||
{
|
||||
Glib::ustring device_name = Utils::regexp_label(output.substr(start_offset),
|
||||
" \\(device [[:digit:]]+\\):[[:blank:]]+([[:graph:]]+)");
|
||||
Glib::ustring::size_type end_offset = output.find(" (device ", start_offset + 9);
|
||||
if (wanted == BlockSpecial("/dev/" + device_name))
|
||||
{
|
||||
output = output.substr(start_offset, end_offset - start_offset);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
start_offset = end_offset;
|
||||
}
|
||||
if (! found)
|
||||
return;
|
||||
|
||||
// Device specific free space in bytes
|
||||
long long dev_free_bytes = -1;
|
||||
Glib::ustring::size_type index = output.find("free:");
|
||||
|
|
|
@ -128,7 +128,7 @@ bool f2fs::create( const Partition & new_partition, OperationDetail & operationd
|
|||
|
||||
bool f2fs::resize(const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition)
|
||||
{
|
||||
Glib::ustring size = "";
|
||||
Glib::ustring size;
|
||||
if (! fill_partition)
|
||||
// resize.f2fs works in sector size units of whatever device the file
|
||||
// system is currently stored on.
|
||||
|
|
|
@ -209,7 +209,7 @@ void fat16::read_label(Partition& partition)
|
|||
|
||||
bool fat16::write_label( const Partition & partition, OperationDetail & operationdetail )
|
||||
{
|
||||
Glib::ustring cmd = "" ;
|
||||
Glib::ustring cmd;
|
||||
if ( partition.get_filesystem_label().empty() )
|
||||
cmd = "mlabel -c -i " + Glib::shell_quote(partition.get_path()) + " ::";
|
||||
else
|
||||
|
|
|
@ -57,7 +57,7 @@ FS hfs::get_filesystem_support()
|
|||
|
||||
bool hfs::create( const Partition & new_partition, OperationDetail & operationdetail )
|
||||
{
|
||||
Glib::ustring cmd = "";
|
||||
Glib::ustring cmd;
|
||||
if( new_partition.get_filesystem_label().empty() )
|
||||
cmd = "hformat " + Glib::shell_quote( new_partition.get_path() );
|
||||
else
|
||||
|
|
|
@ -55,7 +55,7 @@ FS hfsplus::get_filesystem_support()
|
|||
|
||||
bool hfsplus::create( const Partition & new_partition, OperationDetail & operationdetail )
|
||||
{
|
||||
Glib::ustring cmd = "";
|
||||
Glib::ustring cmd;
|
||||
if( new_partition.get_filesystem_label().empty() )
|
||||
cmd = "mkfs.hfsplus " + Glib::shell_quote( new_partition.get_path() );
|
||||
else
|
||||
|
|
|
@ -151,7 +151,7 @@ bool luks::resize( const Partition & partition_new, OperationDetail & operationd
|
|||
}
|
||||
}
|
||||
|
||||
Glib::ustring size = "";
|
||||
Glib::ustring size;
|
||||
if ( ! fill_partition )
|
||||
// Cryptsetup resize takes the size of the encryption mapping, not the
|
||||
// size of the underlying block device. Both device-mapper and cryptsetup
|
||||
|
|
|
@ -105,7 +105,7 @@ bool lvm2_pv::create( const Partition & new_partition, OperationDetail & operati
|
|||
|
||||
bool lvm2_pv::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
|
||||
{
|
||||
Glib::ustring size = "" ;
|
||||
Glib::ustring size;
|
||||
if ( ! fill_partition )
|
||||
size = " --yes --setphysicalvolumesize " +
|
||||
Utils::num_to_str(partition_new.get_byte_length() / KIBIBYTE) + "K ";
|
||||
|
|
|
@ -190,7 +190,7 @@ bool ntfs::create( const Partition & new_partition, OperationDetail & operationd
|
|||
bool ntfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
|
||||
{
|
||||
bool success;
|
||||
Glib::ustring size = "" ;
|
||||
Glib::ustring size;
|
||||
if ( ! fill_partition )
|
||||
size = " -s " + Utils::num_to_str(partition_new.get_byte_length());
|
||||
Glib::ustring cmd = "ntfsresize --force --force" + size ;
|
||||
|
|
|
@ -176,7 +176,7 @@ bool reiserfs::create( const Partition & new_partition, OperationDetail & operat
|
|||
|
||||
bool reiserfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
|
||||
{
|
||||
Glib::ustring size = "" ;
|
||||
Glib::ustring size;
|
||||
if ( ! fill_partition )
|
||||
size = " -s " + Utils::num_to_str(partition_new.get_byte_length());
|
||||
const Glib::ustring resize_cmd = "echo y | resize_reiserfs" + size +
|
||||
|
|
Loading…
Reference in New Issue
Block a user