mirror of https://github.com/cutefishos/calamares
Merge branch 'wip/resize-partition'
commit
1c9265cd21
@ -0,0 +1,56 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <CheckFileSystemJob.h>
|
||||
|
||||
// CalaPM
|
||||
#include <core/partition.h>
|
||||
#include <fs/filesystem.h>
|
||||
#include <util/report.h>
|
||||
|
||||
CheckFileSystemJob::CheckFileSystemJob( Partition* partition )
|
||||
: PartitionJob( partition )
|
||||
{}
|
||||
|
||||
QString
|
||||
CheckFileSystemJob::prettyName() const
|
||||
{
|
||||
QString path = partition()->partitionPath();
|
||||
return tr( "Checking file system on partition %1." ).arg( path );
|
||||
}
|
||||
|
||||
Calamares::JobResult
|
||||
CheckFileSystemJob::exec()
|
||||
{
|
||||
FileSystem& fs = partition()->fileSystem();
|
||||
|
||||
// if we cannot check, assume everything is fine
|
||||
if ( fs.supportCheck() != FileSystem::cmdSupportFileSystem )
|
||||
return Calamares::JobResult::ok();
|
||||
|
||||
Report report( nullptr );
|
||||
bool ok = fs.check( report, partition()->partitionPath() );
|
||||
if ( !ok )
|
||||
return Calamares::JobResult::error(
|
||||
tr( "The file system check on partition %1 failed." )
|
||||
.arg( partition()->partitionPath() ),
|
||||
report.toText()
|
||||
);
|
||||
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CHECKFILESYSTEMJOB_H
|
||||
#define CHECKFILESYSTEMJOB_H
|
||||
|
||||
#include <PartitionJob.h>
|
||||
|
||||
class CheckFileSystemJob : public PartitionJob
|
||||
{
|
||||
public:
|
||||
CheckFileSystemJob( Partition* partition );
|
||||
|
||||
QString prettyName() const override;
|
||||
Calamares::JobResult exec() override;
|
||||
};
|
||||
|
||||
#endif /* CHECKFILESYSTEMJOB_H */
|
@ -0,0 +1,85 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <ColorUtils.h>
|
||||
|
||||
#include <PMUtils.h>
|
||||
|
||||
// CalaPM
|
||||
#include <core/partition.h>
|
||||
|
||||
// Qt
|
||||
#include <QColor>
|
||||
|
||||
static QColor COLORS[ 4 ] =
|
||||
{
|
||||
"#448eca",
|
||||
"#a5cc42",
|
||||
"#d87e30",
|
||||
"#ffbdbd",
|
||||
};
|
||||
static QColor FREE_SPACE_COLOR = "#777777";
|
||||
static QColor EXTENDED_COLOR = "#aaaaaa";
|
||||
|
||||
|
||||
namespace ColorUtils
|
||||
{
|
||||
|
||||
QColor freeSpaceColor()
|
||||
{
|
||||
return FREE_SPACE_COLOR;
|
||||
}
|
||||
|
||||
QColor colorForPartition( Partition* partition )
|
||||
{
|
||||
if ( PMUtils::isPartitionFreeSpace( partition ) )
|
||||
return FREE_SPACE_COLOR;
|
||||
if ( partition->roles().has( PartitionRole::Extended ) )
|
||||
return EXTENDED_COLOR;
|
||||
// No partition-specific color needed, pick one from our list, but skip
|
||||
// free space: we don't want a partition to change colors if space before
|
||||
// it is inserted or removed
|
||||
PartitionNode* parent = partition->parent();
|
||||
Q_ASSERT( parent );
|
||||
int colorIdx = 0;
|
||||
for ( auto child : parent->children() )
|
||||
{
|
||||
if ( child == partition )
|
||||
break;
|
||||
if ( !PMUtils::isPartitionFreeSpace( child ) )
|
||||
++colorIdx;
|
||||
}
|
||||
return COLORS[ colorIdx % 4 ];
|
||||
}
|
||||
|
||||
QColor colorForPartitionInFreeSpace( Partition* partition )
|
||||
{
|
||||
PartitionNode* parent = partition->parent();
|
||||
Q_ASSERT( parent );
|
||||
int colorIdx = 0;
|
||||
for ( auto child : parent->children() )
|
||||
{
|
||||
if ( child == partition )
|
||||
break;
|
||||
if ( !PMUtils::isPartitionFreeSpace( child ) )
|
||||
++colorIdx;
|
||||
}
|
||||
return COLORS[ colorIdx % 4 ];
|
||||
}
|
||||
|
||||
} // namespace
|
@ -0,0 +1,238 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// This class is heavily based on the MoveFileSystemJob class from KDE Partition
|
||||
// Manager.
|
||||
// The copyBlock functions come from Partition Manager Job class.
|
||||
// Original copyright follow:
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
|
||||
#include <MoveFileSystemJob.h>
|
||||
|
||||
#include <utils/Logger.h>
|
||||
|
||||
// CalaPM
|
||||
#include <core/copysourcedevice.h>
|
||||
#include <core/copytargetdevice.h>
|
||||
#include <core/device.h>
|
||||
#include <core/partition.h>
|
||||
#include <fs/filesystem.h>
|
||||
#include <util/report.h>
|
||||
|
||||
MoveFileSystemJob::MoveFileSystemJob( Device* device, Partition* partition, qint64 oldFirstSector, qint64 newFirstSector, qint64 length )
|
||||
: PartitionJob( partition )
|
||||
, m_device( device )
|
||||
, m_oldFirstSector( oldFirstSector )
|
||||
, m_newFirstSector( newFirstSector )
|
||||
, m_length( length )
|
||||
{}
|
||||
|
||||
QString
|
||||
MoveFileSystemJob::prettyName() const
|
||||
{
|
||||
return tr( "Move file system of partition %1." ).arg( partition()->partitionPath() );
|
||||
}
|
||||
|
||||
Calamares::JobResult
|
||||
MoveFileSystemJob::exec()
|
||||
{
|
||||
Report report( nullptr );
|
||||
QString partitionPath = partition()->partitionPath();
|
||||
CopySourceDevice moveSource( *m_device, m_oldFirstSector, m_oldFirstSector + m_length - 1 );
|
||||
CopyTargetDevice moveTarget( *m_device, m_newFirstSector, m_newFirstSector + m_length - 1 );
|
||||
|
||||
if ( !moveSource.open() )
|
||||
return Calamares::JobResult::error(
|
||||
QString(),
|
||||
tr( "Could not open file system on partition %1 for moving." ).arg( partitionPath )
|
||||
);
|
||||
|
||||
if ( !moveTarget.open() )
|
||||
return Calamares::JobResult::error(
|
||||
QString(),
|
||||
tr( "Could not create target for moving file system on partition %1." ).arg( partitionPath )
|
||||
);
|
||||
|
||||
bool ok = copyBlocks( report, moveTarget, moveSource );
|
||||
if ( !ok )
|
||||
{
|
||||
if ( rollbackCopyBlocks( report, moveTarget, moveSource ) )
|
||||
return Calamares::JobResult::error(
|
||||
QString(),
|
||||
tr( "Moving of partition %1 failed, changes have been rolled back." ).arg( partitionPath )
|
||||
+ '\n' + report.toText()
|
||||
);
|
||||
else
|
||||
return Calamares::JobResult::error(
|
||||
QString(),
|
||||
tr( "Moving of partition %1 failed. Roll back of the changes have failed." ).arg( partitionPath )
|
||||
+ '\n' + report.toText()
|
||||
);
|
||||
}
|
||||
|
||||
FileSystem& fs = partition()->fileSystem();
|
||||
fs.setFirstSector( m_newFirstSector );
|
||||
fs.setLastSector( m_newFirstSector + m_length - 1 );
|
||||
|
||||
if ( !fs.updateBootSector( report, partitionPath ) )
|
||||
return Calamares::JobResult::error(
|
||||
QString(),
|
||||
tr( "Updating boot sector after the moving of partition %1 failed." ).arg( partitionPath )
|
||||
+ '\n' + report.toText()
|
||||
);
|
||||
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
bool
|
||||
MoveFileSystemJob::copyBlocks( Report& report, CopyTargetDevice& target, CopySourceDevice& source )
|
||||
{
|
||||
/** @todo copyBlocks() assumes that source.sectorSize() == target.sectorSize(). */
|
||||
|
||||
if ( source.sectorSize() != target.sectorSize() )
|
||||
{
|
||||
report.line() << tr( "The logical sector sizes in the source and target for copying are not the same. This is currently unsupported." );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool rval = true;
|
||||
const qint64 blockSize = 16065 * 8; // number of sectors per block to copy
|
||||
const qint64 blocksToCopy = source.length() / blockSize;
|
||||
|
||||
qint64 readOffset = source.firstSector();
|
||||
qint64 writeOffset = target.firstSector();
|
||||
qint32 copyDir = 1;
|
||||
|
||||
if ( target.firstSector() > source.firstSector() )
|
||||
{
|
||||
readOffset = source.firstSector() + source.length() - blockSize;
|
||||
writeOffset = target.firstSector() + source.length() - blockSize;
|
||||
copyDir = -1;
|
||||
}
|
||||
|
||||
qint64 blocksCopied = 0;
|
||||
|
||||
void* buffer = malloc( blockSize * source.sectorSize() );
|
||||
int percent = 0;
|
||||
|
||||
while ( blocksCopied < blocksToCopy )
|
||||
{
|
||||
rval = source.readSectors( buffer, readOffset + blockSize * blocksCopied * copyDir, blockSize );
|
||||
if ( !rval )
|
||||
break;
|
||||
|
||||
rval = target.writeSectors( buffer, writeOffset + blockSize * blocksCopied * copyDir, blockSize );
|
||||
if ( !rval )
|
||||
break;
|
||||
|
||||
if ( ++blocksCopied * 100 / blocksToCopy != percent )
|
||||
{
|
||||
percent = blocksCopied * 100 / blocksToCopy;
|
||||
progress( qreal( percent ) / 100. );
|
||||
}
|
||||
}
|
||||
|
||||
const qint64 lastBlock = source.length() % blockSize;
|
||||
|
||||
// copy the remainder
|
||||
if ( rval && lastBlock > 0 )
|
||||
{
|
||||
Q_ASSERT( lastBlock < blockSize );
|
||||
|
||||
if ( lastBlock >= blockSize )
|
||||
cLog() << "warning: lastBlock: " << lastBlock << ", blockSize: " << blockSize;
|
||||
|
||||
const qint64 lastBlockReadOffset = copyDir > 0 ? readOffset + blockSize * blocksCopied : source.firstSector();
|
||||
const qint64 lastBlockWriteOffset = copyDir > 0 ? writeOffset + blockSize * blocksCopied : target.firstSector();
|
||||
|
||||
rval = source.readSectors( buffer, lastBlockReadOffset, lastBlock );
|
||||
|
||||
if ( rval )
|
||||
rval = target.writeSectors( buffer, lastBlockWriteOffset, lastBlock );
|
||||
|
||||
if ( rval )
|
||||
emit progress( 1.0 );
|
||||
}
|
||||
|
||||
free( buffer );
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
bool
|
||||
MoveFileSystemJob::rollbackCopyBlocks( Report& report, CopyTargetDevice& origTarget, CopySourceDevice& origSource )
|
||||
{
|
||||
if ( !origSource.overlaps( origTarget ) )
|
||||
{
|
||||
report.line() << tr( "Source and target for copying do not overlap: Rollback is not required." );
|
||||
return true;
|
||||
}
|
||||
|
||||
// default: use values as if we were copying from front to back.
|
||||
qint64 undoSourceFirstSector = origTarget.firstSector();
|
||||
qint64 undoSourceLastSector = origTarget.firstSector() + origTarget.sectorsWritten() - 1;
|
||||
|
||||
qint64 undoTargetFirstSector = origSource.firstSector();
|
||||
qint64 undoTargetLastSector = origSource.firstSector() + origTarget.sectorsWritten() - 1;
|
||||
|
||||
if ( origTarget.firstSector() > origSource.firstSector() )
|
||||
{
|
||||
// we were copying from back to front
|
||||
undoSourceFirstSector = origTarget.firstSector() + origSource.length() - origTarget.sectorsWritten();
|
||||
undoSourceLastSector = origTarget.firstSector() + origSource.length() - 1;
|
||||
|
||||
undoTargetFirstSector = origSource.lastSector() - origTarget.sectorsWritten() + 1;
|
||||
undoTargetLastSector = origSource.lastSector();
|
||||
}
|
||||
|
||||
CopySourceDevice undoSource( origTarget.device(), undoSourceFirstSector, undoSourceLastSector );
|
||||
if ( !undoSource.open() )
|
||||
{
|
||||
report.line() << tr( "Could not open device %1 to rollback copying." )
|
||||
.arg( origTarget.device().deviceNode() );
|
||||
return false;
|
||||
}
|
||||
|
||||
CopyTargetDevice undoTarget( origSource.device(), undoTargetFirstSector, undoTargetLastSector );
|
||||
if ( !undoTarget.open() )
|
||||
{
|
||||
report.line() << tr( "Could not open device %1 to rollback copying." )
|
||||
.arg( origSource.device().deviceNode() );
|
||||
return false;
|
||||
}
|
||||
|
||||
return copyBlocks( report, undoTarget, undoSource );
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// This class is heavily based on the MoveFileSystemJob class from KDE Partition
|
||||
// Manager. Original copyright follow:
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
#ifndef MOVEFILESYSTEMJOB_H
|
||||
#define MOVEFILESYSTEMJOB_H
|
||||
|
||||
#include <PartitionJob.h>
|
||||
|
||||
class CopySourceDevice;
|
||||
class CopyTargetDevice;
|
||||
class Device;
|
||||
class Partition;
|
||||
class Report;
|
||||
|
||||
class MoveFileSystemJob : public PartitionJob
|
||||
{
|
||||
public:
|
||||
MoveFileSystemJob( Device* device, Partition* partition, qint64 oldFirstSector, qint64 newFirstSector, qint64 length );
|
||||
|
||||
QString prettyName() const override;
|
||||
|
||||
Calamares::JobResult exec() override;
|
||||
|
||||
private:
|
||||
Device* m_device;
|
||||
qint64 m_oldFirstSector;
|
||||
qint64 m_newFirstSector;
|
||||
qint64 m_length;
|
||||
bool copyBlocks( Report& report, CopyTargetDevice& target, CopySourceDevice& source );
|
||||
bool rollbackCopyBlocks( Report& report, CopyTargetDevice& origTarget, CopySourceDevice& origSource );
|
||||
};
|
||||
|
||||
#endif /* MOVEFILESYSTEMJOB_H */
|
@ -0,0 +1,123 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <PartitionSizeController.h>
|
||||
|
||||
#include <ColorUtils.h>
|
||||
|
||||
// Qt
|
||||
#include <QSpinBox>
|
||||
|
||||
// CalaPM
|
||||
#include <core/device.h>
|
||||
#include <core/partition.h>
|
||||
#include <gui/partresizerwidget.h>
|
||||
|
||||
// stdc++
|
||||
#include <limits>
|
||||
|
||||
PartitionSizeController::PartitionSizeController( QObject* parent )
|
||||
: QObject( parent )
|
||||
{}
|
||||
|
||||
void
|
||||
PartitionSizeController::setPartResizerWidget( PartResizerWidget* widget )
|
||||
{
|
||||
if ( m_partResizerWidget )
|
||||
disconnect( m_partResizerWidget, 0, this, 0 );
|
||||
m_partResizerWidget = widget;
|
||||
// FIXME: Should be set by PartResizerWidget itself
|
||||
m_partResizerWidget->setFixedHeight( PartResizerWidget::handleHeight() );
|
||||
|
||||
QPalette pal = widget->palette();
|
||||
pal.setColor( QPalette::Base, ColorUtils::freeSpaceColor() );
|
||||
pal.setColor( QPalette::Button, m_partitionColor );
|
||||
m_partResizerWidget->setPalette( pal );
|
||||
updateConnections();
|
||||
}
|
||||
|
||||
void
|
||||
PartitionSizeController::setSpinBox( QSpinBox* spinBox )
|
||||
{
|
||||
if ( m_spinBox )
|
||||
disconnect( m_spinBox, 0, this, 0 );
|
||||
m_spinBox = spinBox;
|
||||
m_spinBox->setMaximum( std::numeric_limits< int >::max() );
|
||||
updateConnections();
|
||||
}
|
||||
|
||||
void
|
||||
PartitionSizeController::init( Device* device, Partition* partition, const QColor& color )
|
||||
{
|
||||
m_device = device;
|
||||
m_partition = partition;
|
||||
m_partitionColor = color;
|
||||
}
|
||||
|
||||
void
|
||||
PartitionSizeController::updateConnections()
|
||||
{
|
||||
if ( !m_spinBox || !m_partResizerWidget )
|
||||
return;
|
||||
|
||||
connect( m_spinBox, SIGNAL( editingFinished() ), SLOT( updatePartResizerWidget() ) );
|
||||
connect( m_partResizerWidget, SIGNAL( firstSectorChanged( qint64 ) ), SLOT( updateSpinBox() ) );
|
||||
connect( m_partResizerWidget, SIGNAL( lastSectorChanged( qint64 ) ), SLOT( updateSpinBox() ) );
|
||||
updateSpinBox();
|
||||
}
|
||||
|
||||
void
|
||||
PartitionSizeController::updatePartResizerWidget()
|
||||
{
|
||||
if ( m_updating )
|
||||
return;
|
||||
m_updating = true;
|
||||
qint64 sectorSize = qint64( m_spinBox->value() ) * 1024 * 1024 / m_device->logicalSectorSize();
|
||||
|
||||
qint64 firstSector = m_partition->firstSector();
|
||||
qint64 lastSector = firstSector + sectorSize - 1;
|
||||
if ( lastSector > m_partResizerWidget->maximumLastSector() )
|
||||
{
|
||||
qint64 delta = lastSector - m_partResizerWidget->maximumLastSector();
|
||||
firstSector -= delta;
|
||||
lastSector -= delta;
|
||||
}
|
||||
m_partResizerWidget->updateLastSector( lastSector );
|
||||
m_partResizerWidget->updateFirstSector( firstSector );
|
||||
|
||||
// Update spinbox value in case it was an impossible value
|
||||
doUpdateSpinBox();
|
||||
m_updating = false;
|
||||
}
|
||||
|
||||
void
|
||||
PartitionSizeController::updateSpinBox()
|
||||
{
|
||||
if ( m_updating )
|
||||
return;
|
||||
m_updating = true;
|
||||
doUpdateSpinBox();
|
||||
m_updating = false;
|
||||
}
|
||||
|
||||
void
|
||||
PartitionSizeController::doUpdateSpinBox()
|
||||
{
|
||||
qint64 mbSize = ( m_partition->lastSector() - m_partition->firstSector() + 1 ) * m_device->logicalSectorSize() / 1024 / 1024;
|
||||
m_spinBox->setValue( mbSize );
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PARTITIONSIZECONTROLLER_H
|
||||
#define PARTITIONSIZECONTROLLER_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
|
||||
class QSpinBox;
|
||||
|
||||
class Device;
|
||||
class Partition;
|
||||
class PartResizerWidget;
|
||||
|
||||
/**
|
||||
* Synchronize a PartResizerWidget and a QSpinBox
|
||||
*/
|
||||
class PartitionSizeController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PartitionSizeController( QObject* parent = nullptr );
|
||||
void setPartResizerWidget( PartResizerWidget* widget );
|
||||
void setSpinBox( QSpinBox* spinBox );
|
||||
void init( Device* device, Partition* partition, const QColor& color );
|
||||
|
||||
private:
|
||||
QPointer< PartResizerWidget > m_partResizerWidget;
|
||||
QPointer< QSpinBox > m_spinBox;
|
||||
Device* m_device = nullptr;
|
||||
Partition* m_partition = nullptr;
|
||||
QColor m_partitionColor;
|
||||
bool m_updating = false;
|
||||
|
||||
void updateConnections();
|
||||
void doUpdateSpinBox();
|
||||
|
||||
private Q_SLOTS:
|
||||
void updatePartResizerWidget();
|
||||
void updateSpinBox();
|
||||
};
|
||||
|
||||
#endif /* PARTITIONSIZECONTROLLER_H */
|
@ -1,100 +0,0 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <PartitionSizeWidget.h>
|
||||
|
||||
#include <utils/Logger.h>
|
||||
|
||||
// CalaPM
|
||||
#include <core/device.h>
|
||||
#include <core/partition.h>
|
||||
#include <core/partitiontable.h>
|
||||
|
||||
PartitionSizeWidget::PartitionSizeWidget( QWidget* parent )
|
||||
: QSpinBox( parent )
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
PartitionSizeWidget::init( Device* device, Partition* partition )
|
||||
{
|
||||
m_device = device;
|
||||
m_partition = partition;
|
||||
Q_ASSERT( m_device->partitionTable() );
|
||||
|
||||
qint64 minSector = computeMinSector();
|
||||
qint64 maxSector = computeMaxSector();
|
||||
cLog() << minSector << maxSector;
|
||||
setMaximum( mbSizeForSectorRange( minSector, maxSector ) );
|
||||
|
||||
m_initialValue = mbSizeForSectorRange( partition->firstSector(), partition->lastSector() );
|
||||
setValue( m_initialValue );
|
||||
}
|
||||
|
||||
PartitionSizeWidget::SectorRange
|
||||
PartitionSizeWidget::sectorRange() const
|
||||
{
|
||||
qint64 minSector = computeMinSector();
|
||||
qint64 maxSector = computeMaxSector();
|
||||
|
||||
int mbSize = value();
|
||||
if ( mbSize == maximum() )
|
||||
{
|
||||
// If we are at the maximum value, select the last sector to avoid
|
||||
// potential rounding errors which could leave a few sectors at the end
|
||||
// unused
|
||||
return SectorRange( minSector, maxSector );
|
||||
}
|
||||
|
||||
qint64 lastSector = minSector + qint64( mbSize ) * 1024 * 1024 / m_device->logicalSectorSize();
|
||||
Q_ASSERT( lastSector <= maxSector );
|
||||
if ( lastSector > maxSector )
|
||||
{
|
||||
cLog() << "lastSector (" << lastSector << ") > maxSector (" << maxSector << "). This should not happen!";
|
||||
lastSector = maxSector;
|
||||
}
|
||||
return SectorRange( minSector, lastSector );
|
||||
}
|
||||
|
||||
bool
|
||||
PartitionSizeWidget::isDirty() const
|
||||
{
|
||||
return m_initialValue != value();
|
||||
}
|
||||
|
||||
qint64
|
||||
PartitionSizeWidget::mbSizeForSectorRange( qint64 first, qint64 last ) const
|
||||
{
|
||||
return ( last - first + 1 ) * m_device->logicalSectorSize() / 1024 / 1024;
|
||||
}
|
||||
|
||||
qint64
|
||||
PartitionSizeWidget::computeMaxSector() const
|
||||
{
|
||||
Q_ASSERT( m_device );
|
||||
Q_ASSERT( m_partition );
|
||||
return m_partition->lastSector() + m_device->partitionTable()->freeSectorsAfter( *m_partition );
|
||||
}
|
||||
|
||||
qint64
|
||||
PartitionSizeWidget::computeMinSector() const
|
||||
{
|
||||
Q_ASSERT( m_device );
|
||||
Q_ASSERT( m_partition );
|
||||
return m_partition->firstSector() - m_device->partitionTable()->freeSectorsBefore( *m_partition );
|
||||
}
|
@ -0,0 +1,302 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// This class is heavily based on the ResizeOperation class from KDE Partition
|
||||
// Manager. Original copyright follow:
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008,2012 by Volker Lanz <vl@fidra.de> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
|
||||
#include <ResizePartitionJob.h>
|
||||
|
||||
#include <CheckFileSystemJob.h>
|
||||
#include <MoveFileSystemJob.h>
|
||||
#include <utils/Logger.h>
|
||||
|
||||
// CalaPM
|
||||
#include <backend/corebackend.h>
|
||||
#include <backend/corebackendmanager.h>
|
||||
#include <backend/corebackenddevice.h>
|
||||
#include <backend/corebackendpartition.h>
|
||||
#include <backend/corebackendpartitiontable.h>
|
||||
#include <core/device.h>
|
||||
#include <core/partition.h>
|
||||
#include <util/report.h>
|
||||
|
||||
// Qt
|
||||
#include <QScopedPointer>
|
||||
|
||||
//- Context --------------------------------------------------------------------
|
||||
struct Context
|
||||
{
|
||||
Context( ResizePartitionJob* job_ )
|
||||
: job( job_ )
|
||||
{}
|
||||
|
||||
ResizePartitionJob* job;
|
||||
qint64 oldFirstSector;
|
||||
qint64 oldLastSector;
|
||||
|
||||
QScopedPointer< CoreBackendPartitionTable > backendPartitionTable;
|
||||
};
|
||||
|
||||
//- ResizeFileSystemJob --------------------------------------------------------
|
||||
class ResizeFileSystemJob : public Calamares::Job
|
||||
{
|
||||
public:
|
||||
ResizeFileSystemJob( Context* context, qint64 length )
|
||||
: m_context( context )
|
||||
, m_length( length )
|
||||
{}
|
||||
|
||||
QString prettyName() const override
|
||||
{
|
||||
QString path = m_context->job->partition()->partitionPath();
|
||||
return tr( "Resize file system on partition %1." ).arg( path );
|
||||
}
|
||||
|
||||
Calamares::JobResult exec() override
|
||||
{
|
||||
Report report( nullptr );
|
||||
Device* device = m_context->job->device();
|
||||
Partition* partition = m_context->job->partition();
|
||||
FileSystem& fs = partition->fileSystem();
|
||||
FileSystem::CommandSupportType support = m_length < fs.length() ? fs.supportShrink() : fs.supportGrow();
|
||||
|
||||
switch ( support )
|
||||
{
|
||||
case FileSystem::cmdSupportBackend:
|
||||
if ( !backendResize( &report ) )
|
||||
return Calamares::JobResult::error(
|
||||
QString(),
|
||||
tr( "Parted failed to resize filesystem." ) + '\n' + report.toText()
|
||||
);
|
||||
break;
|
||||
case FileSystem::cmdSupportFileSystem:
|
||||
{
|
||||
qint64 byteLength = device->logicalSectorSize() * m_length;
|
||||
bool ok = fs.resize( report, partition->partitionPath(), byteLength );
|
||||
if ( !ok )
|
||||
return Calamares::JobResult::error(
|
||||
QString(),
|
||||
tr( "Failed to resize filesystem." ) + '\n' + report.toText()
|
||||
);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
fs.setLastSector( fs.firstSector() + m_length - 1 );
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
private:
|
||||
Context* m_context;
|
||||
qint64 m_length;
|
||||
|
||||
bool backendResize( Report* report )
|
||||
{
|
||||
Partition* partition = m_context->job->partition();
|
||||
bool ok = m_context->backendPartitionTable->resizeFileSystem( *report, *partition, m_length );
|
||||
if ( !ok )
|
||||
return false;
|
||||
m_context->backendPartitionTable->commit();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
//- SetPartGeometryJob ---------------------------------------------------------
|
||||
class SetPartGeometryJob : public Calamares::Job
|
||||
{
|
||||
public:
|
||||
SetPartGeometryJob( Context* context, qint64 firstSector, qint64 length )
|
||||
: m_context( context )
|
||||
, m_firstSector( firstSector )
|
||||
, m_length( length )
|
||||
{}
|
||||
|
||||
QString prettyName() const override
|
||||
{
|
||||
QString path = m_context->job->partition()->partitionPath();
|
||||
return tr( "Update geometry of partition %1." ).arg( path );
|
||||
}
|
||||
|
||||
Calamares::JobResult exec() override
|
||||
{
|
||||
Report report( nullptr );
|
||||
Partition* partition = m_context->job->partition();
|
||||
qint64 lastSector = m_firstSector + m_length - 1;
|
||||
bool ok = m_context->backendPartitionTable->updateGeometry( report, *partition, m_firstSector, lastSector );
|
||||
if ( !ok )
|
||||
{
|
||||
return Calamares::JobResult::error(
|
||||
QString(),
|
||||
tr( "Failed to change the geometry of the partition." ) + '\n' + report.toText() );
|
||||
}
|
||||
partition->setFirstSector( m_firstSector );
|
||||
partition->setLastSector( lastSector );
|
||||
m_context->backendPartitionTable->commit();
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
private:
|
||||
Context* m_context;
|
||||
qint64 m_firstSector;
|
||||
qint64 m_length;
|
||||
};
|
||||
|
||||
//- ResizePartitionJob ---------------------------------------------------------
|
||||
ResizePartitionJob::ResizePartitionJob( Device* device, Partition* partition, qint64 firstSector, qint64 lastSector )
|
||||
: PartitionJob( partition )
|
||||
, m_device( device )
|
||||
, m_oldFirstSector( partition->firstSector() ) // Keep a copy of old sectors because they will be overwritten in updatePreview()
|
||||
, m_oldLastSector( partition->lastSector() )
|
||||
, m_newFirstSector( firstSector )
|
||||
, m_newLastSector( lastSector )
|
||||
{
|
||||
}
|
||||
|
||||
QString
|
||||
ResizePartitionJob::prettyName() const
|
||||
{
|
||||
// FIXME: Copy PM ResizeOperation code which generates a description of the
|
||||
// operation
|
||||
return tr( "Resize partition %1." ).arg( partition()->partitionPath() );
|
||||
}
|
||||
|
||||
Calamares::JobResult
|
||||
ResizePartitionJob::exec()
|
||||
{
|
||||
qint64 oldLength = m_oldLastSector - m_oldFirstSector + 1;
|
||||
qint64 newLength = m_newLastSector - m_newFirstSector + 1;
|
||||
|
||||
// Assuming updatePreview() has been called, `partition` uses its new
|
||||
// position and size. Reset it to the old values: part of the libparted
|
||||
// backend relies on this (for example:
|
||||
// LibPartedPartitionTable::updateGeometry())
|
||||
// The jobs are responsible for updating the partition back when they are
|
||||
// done.
|
||||
m_partition->setFirstSector( m_oldFirstSector );
|
||||
m_partition->setLastSector( m_oldLastSector );
|
||||
|
||||
// Setup context
|
||||
QString partitionPath = m_partition->partitionPath();
|
||||
Context context( this );
|
||||
context.oldFirstSector = m_oldFirstSector;
|
||||
context.oldLastSector = m_oldLastSector;
|
||||
|
||||
CoreBackend* backend = CoreBackendManager::self()->backend();
|
||||
QScopedPointer<CoreBackendDevice> backendDevice( backend->openDevice( m_device->deviceNode() ) );
|
||||
if ( !backendDevice.data() )
|
||||
{
|
||||
QString errorMessage = tr( "The installer failed to resize partition %1 on disk '%2'." )
|
||||
.arg( m_partition->partitionPath() )
|
||||
.arg( m_device->name() );
|
||||
return Calamares::JobResult::error(
|
||||
errorMessage,
|
||||
tr( "Could not open device '%1'." ).arg( m_device->deviceNode() )
|
||||
);
|
||||
}
|
||||
context.backendPartitionTable.reset( backendDevice->openPartitionTable() );
|
||||
|
||||
// Create jobs
|
||||
QList< Calamares::job_ptr > jobs;
|
||||
jobs << Calamares::job_ptr( new CheckFileSystemJob( partition() ) );
|
||||
if ( m_partition->roles().has( PartitionRole::Extended ) )
|
||||
jobs << Calamares::job_ptr( new SetPartGeometryJob( &context, m_newFirstSector, newLength ) );
|
||||
else
|
||||
{
|
||||
bool shrink = newLength < oldLength;
|
||||
bool grow = newLength > oldLength;
|
||||
bool moveRight = m_newFirstSector > m_oldFirstSector;
|
||||
bool moveLeft = m_newFirstSector < m_oldFirstSector;
|
||||
if ( shrink )
|
||||
{
|
||||
jobs << Calamares::job_ptr( new ResizeFileSystemJob( &context, newLength ) );
|
||||
jobs << Calamares::job_ptr( new SetPartGeometryJob( &context, m_oldFirstSector, newLength ) );
|
||||
}
|
||||
if ( moveRight || moveLeft )
|
||||
{
|
||||
// At this point, we need to set the partition's length to either the resized length, if it has already been
|
||||
// shrunk, or to the original length (it may or may not then later be grown, we don't care here)
|
||||
const qint64 length = shrink ? newLength : oldLength;
|
||||
jobs << Calamares::job_ptr( new SetPartGeometryJob( &context, m_newFirstSector, length ) );
|
||||
jobs << Calamares::job_ptr( new MoveFileSystemJob( m_device, m_partition, m_oldFirstSector, m_newFirstSector, length ) );
|
||||
}
|
||||
if ( grow )
|
||||
{
|
||||
jobs << Calamares::job_ptr( new SetPartGeometryJob( &context, m_newFirstSector, newLength ) );
|
||||
jobs << Calamares::job_ptr( new ResizeFileSystemJob( &context, newLength ) );
|
||||
}
|
||||
}
|
||||
jobs << Calamares::job_ptr( new CheckFileSystemJob( partition() ) );
|
||||
return execJobList( jobs );
|
||||
}
|
||||
|
||||
void
|
||||
ResizePartitionJob::updatePreview()
|
||||
{
|
||||
m_device->partitionTable()->removeUnallocated();
|
||||
m_partition->parent()->remove( m_partition );
|
||||
m_partition->setFirstSector( m_newFirstSector );
|
||||
m_partition->setLastSector( m_newLastSector );
|
||||
m_partition->parent()->insert( m_partition );
|
||||
m_device->partitionTable()->updateUnallocated( *m_device );
|
||||
}
|
||||
|
||||
Calamares::JobResult
|
||||
ResizePartitionJob::execJobList( const QList< Calamares::job_ptr >& jobs )
|
||||
{
|
||||
QString errorMessage = tr( "The installer failed to resize partition %1 on disk '%2'." )
|
||||
.arg( m_partition->partitionPath() )
|
||||
.arg( m_device->name() );
|
||||
|
||||
int nbJobs = jobs.size();
|
||||
int count = 0;
|
||||
for ( Calamares::job_ptr job : jobs )
|
||||
{
|
||||
cLog() << "- " + job->prettyName();
|
||||
Calamares::JobResult result = job->exec();
|
||||
if ( !result )
|
||||
{
|
||||
if ( result.message().isEmpty() )
|
||||
result.setMessage( errorMessage );
|
||||
return result;
|
||||
}
|
||||
++count;
|
||||
progress( qreal( count ) / nbJobs );
|
||||
}
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef RESIZEPARTITIONJOB_H
|
||||
#define RESIZEPARTITIONJOB_H
|
||||
|
||||
#include <PartitionJob.h>
|
||||
|
||||
class Device;
|
||||
class Partition;
|
||||
class FileSystem;
|
||||
|
||||
struct Context;
|
||||
|
||||
class ResizePartitionJob : public PartitionJob
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ResizePartitionJob( Device* device, Partition* partition, qint64 firstSector, qint64 lastSector );
|
||||
QString prettyName() const override;
|
||||
Calamares::JobResult exec() override;
|
||||
|
||||
void updatePreview();
|
||||
|
||||
Device* device() const
|
||||
{
|
||||
return m_device;
|
||||
}
|
||||
|
||||
private:
|
||||
Device* m_device;
|
||||
qint64 m_oldFirstSector;
|
||||
qint64 m_oldLastSector;
|
||||
qint64 m_newFirstSector;
|
||||
qint64 m_newLastSector;
|
||||
|
||||
Calamares::JobResult execJobList( const QList< Calamares::job_ptr >& jobs );
|
||||
|
||||
friend struct Context;
|
||||
};
|
||||
|
||||
#endif /* RESIZEPARTITIONJOB_H */
|
@ -1 +1 @@
|
||||
Subproject commit f958c7be734135f22454e464518c1f7110298a95
|
||||
Subproject commit 8726fc2b3f2a703b9a72cf76038be1bab22d8a3f
|
Loading…
Reference in New Issue