Merge branch 'issue-1098'

- Doesn't fix the issue, but adds useful things I want in master
   already, also for debugging other issues.
This commit is contained in:
Adriaan de Groot 2019-03-01 07:09:45 -05:00
commit fdb4311a70
4 changed files with 57 additions and 36 deletions

View file

@ -43,6 +43,25 @@
namespace PartUtils
{
static QString
convenienceName( const Partition* const candidate )
{
if ( !candidate->mountPoint().isEmpty() )
return candidate->mountPoint();
if ( !candidate->partitionPath().isEmpty() )
return candidate->partitionPath();
if ( !candidate->devicePath().isEmpty() )
return candidate->devicePath();
if ( !candidate->deviceNode().isEmpty() )
return candidate->devicePath();
QString p;
QTextStream s( &p );
s << (void *)candidate;
return p;
}
bool
canBeReplaced( Partition* candidate )
{
@ -64,12 +83,12 @@ canBeReplaced( Partition* candidate )
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
cDebug() << "Storage capacity B:" << availableStorageB
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 )
<< "for" << candidate->partitionPath() << " length:" << candidate->length();
<< "for" << convenienceName( candidate ) << " length:" << candidate->length();
if ( ok &&
availableStorageB > requiredStorageB )
{
cDebug() << "Partition" << candidate->partitionPath() << "authorized for replace install.";
cDebug() << "Partition" << convenienceName( candidate ) << "authorized for replace install.";
return true;
}
@ -86,7 +105,7 @@ canBeResized( Partition* candidate )
return false;
}
cDebug() << "Checking if" << candidate->partitionPath() << "can be resized.";
cDebug() << "Checking if" << convenienceName( candidate ) << "can be resized.";
if ( !candidate->fileSystem().supportGrow() ||
!candidate->fileSystem().supportShrink() )
{
@ -140,13 +159,13 @@ canBeResized( Partition* candidate )
<< QString( "(%1GB)" ).arg( advisedStorageGB );
cDebug() << "Available storage B:" << availableStorageB
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 )
<< "for" << candidate->partitionPath() << " length:" << candidate->length()
<< "for" << convenienceName( candidate ) << " length:" << candidate->length()
<< " sectorsUsed:" << candidate->sectorsUsed() << " fsType:" << candidate->fileSystem().name();
if ( ok &&
availableStorageB > advisedStorageB )
{
cDebug() << "Partition" << candidate->partitionPath() << "authorized for resize + autopartition install.";
cDebug() << "Partition" << convenienceName( candidate ) << "authorized for resize + autopartition install.";
return true;
}
@ -382,7 +401,7 @@ isEfiSystem()
bool
isEfiBootable( const Partition* candidate )
{
cDebug() << "Check EFI bootable" << candidate->partitionPath() << candidate->devicePath();
cDebug() << "Check EFI bootable" << convenienceName( candidate ) << candidate->devicePath();
cDebug() << " .. flags" << candidate->activeFlags();
auto flags = PartitionInfo::flags( candidate );