Reorder construction of nilfs2 resize command (!119)

Pass string literal containing the nilfs2 resize command to
execute_command() rather than a string variable containing the same
command.  This makes it the same as how most of the other calls to
execute_command() are written and it makes it more grep friendly.

Before:
    $ grep execute_command src/nilfs2.cc
        if ( ! Utils::execute_command( "nilfs-tune -l " + Glib::shell_quote( partition.get_path() ),
        if ( ! Utils::execute_command( "nilfs-tune -l " + Glib::shell_quote( partition.get_path() ),
        return ! execute_command( "nilfs-tune -L " + Glib::shell_quote( partition.get_filesystem_label() ) +
        if ( ! Utils::execute_command( "nilfs-tune -l " + Glib::shell_quote( partition.get_path() ),
        return ! execute_command( "nilfs-tune -U " + Glib::shell_quote( Utils::generate_uuid() ) +
        return ! execute_command( "mkfs.nilfs2 -L " + Glib::shell_quote( new_partition.get_filesystem_label() ) +
            success &= ! execute_command( "mount -v -t nilfs2 " + Glib::shell_quote( partition_new.get_path() ) +
>>          success &= ! execute_command( cmd, operationdetail, EXEC_CHECK_STATUS );
                success &= ! execute_command( "umount -v " + Glib::shell_quote( mount_point ),

After:
    $ grep execute_command src/nilfs2.cc
        if ( ! Utils::execute_command( "nilfs-tune -l " + Glib::shell_quote( partition.get_path() ),
        if ( ! Utils::execute_command( "nilfs-tune -l " + Glib::shell_quote( partition.get_path() ),
        return ! execute_command( "nilfs-tune -L " + Glib::shell_quote( partition.get_filesystem_label() ) +
        if ( ! Utils::execute_command( "nilfs-tune -l " + Glib::shell_quote( partition.get_path() ),
        return ! execute_command( "nilfs-tune -U " + Glib::shell_quote( Utils::generate_uuid() ) +
        return ! execute_command( "mkfs.nilfs2 -L " + Glib::shell_quote( new_partition.get_filesystem_label() ) +
            success &= ! execute_command( "mount -v -t nilfs2 " + Glib::shell_quote( partition_new.get_path() ) +
>>          success &= ! execute_command("nilfs-resize -v -y " + Glib::shell_quote(partition_new.get_path()) + size,
                success &= ! execute_command( "umount -v " + Glib::shell_quote( mount_point ),

Closes !119 -  Tidy-ups for file system interface classes
This commit is contained in:
Mike Fleetwood 2023-10-08 09:25:14 +01:00 committed by Curtis Gedak
parent f098ba1ec7
commit 1d2a02b6ec
1 changed files with 4 additions and 6 deletions

View File

@ -196,13 +196,11 @@ bool nilfs2::resize( const Partition & partition_new, OperationDetail & operatio
if ( success )
{
Glib::ustring cmd = "nilfs-resize -v -y " + Glib::shell_quote( partition_new.get_path() );
Glib::ustring size;
if ( ! fill_partition )
{
Glib::ustring size = Utils::num_to_str(partition_new.get_byte_length() / KIBIBYTE) + "K";
cmd += " " + size ;
}
success &= ! execute_command( cmd, operationdetail, EXEC_CHECK_STATUS );
size = " " + Utils::num_to_str(partition_new.get_byte_length() / KIBIBYTE) + "K";
success &= ! execute_command("nilfs-resize -v -y " + Glib::shell_quote(partition_new.get_path()) + size,
operationdetail, EXEC_CHECK_STATUS);
if ( ! partition_new. busy )
success &= ! execute_command( "umount -v " + Glib::shell_quote( mount_point ),