rename msdos_vista to msdos and make sure to use sector-based-alignment instead

of vista. also use cylinder based instead of msdos legacy.

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1097441
This commit is contained in:
Volker Lanz 2010-03-01 12:00:07 +00:00
parent c7bc3368e4
commit 856ef859eb
11 changed files with 44 additions and 43 deletions

View File

@ -322,8 +322,8 @@ static void scanDevicePartitions(PedDevice* pedDevice, Device& d, PedDisk* pedDi
d.partitionTable()->updateUnallocated(d);
if (d.partitionTable()->isVistaTableType())
d.partitionTable()->setType(d, PartitionTable::msdos_vista);
if (d.partitionTable()->isSectorBased())
d.partitionTable()->setType(d, PartitionTable::msdos_sectorbased);
foreach(const Partition* part, partitions)
PartitionTable::isAligned(d, *part);

View File

@ -19,7 +19,7 @@
<entry name="sectorAlignment" type="Int">
<default>2048</default>
</entry>
<entry name="useLegacyMsDosAlignment" type="Bool">
<entry name="useCylinderAlignment" type="Bool">
<default>false</default>
</entry>
<entry name="allowApplyOperationsAsNonRoot" type="Bool">

View File

@ -461,7 +461,8 @@ Partition* createUnallocated(const Device& device, PartitionNode& parent, qint64
return NULL;
}
// Leave a track (msdos) or sector alignment sectors (vista) free at the start for a new partition's metadata
// Leave a track (cylinder aligned) or sector alignment sectors (sector based) free at the
// start for a new partition's metadata
start += device.partitionTable()->type() == PartitionTable::msdos ? device.sectorsPerTrack() : sectorAlignment(device);
// .. and also at the end for the metadata for a partition to follow us, if we're not
@ -567,7 +568,7 @@ void PartitionTable::updateUnallocated(const Device& d)
qint64 PartitionTable::defaultFirstUsable(const Device& d, TableType t)
{
if (t == msdos && Config::useLegacyMsDosAlignment())
if (t == msdos && Config::useCylinderAlignment())
return d.sectorsPerTrack();
return Config::sectorAlignment();
@ -594,7 +595,7 @@ static struct
{ "bsd", 8, false, true, PartitionTable::bsd },
{ "dasd", 1, false, true, PartitionTable::dasd },
{ "msdos", 4, true, false, PartitionTable::msdos },
{ "msdos (vista)", 4, true, false, PartitionTable::msdos_vista },
{ "msdos", 4, true, false, PartitionTable::msdos_sectorbased },
{ "dvh", 16, true, true, PartitionTable::dvh },
{ "gpt", 128, false, false, PartitionTable::gpt },
{ "loop", 1, false, true, PartitionTable::loop },
@ -649,25 +650,25 @@ bool PartitionTable::tableTypeIsReadOnly(TableType l)
return false;
}
/** Simple heuristic to determine if the PartitionTable is MS Vista compatible (i.e.
/** Simple heuristic to determine if the PartitionTable is sector aligned (i.e.
if its Partitions begin at sectors evenly divisable by Config::sectorAlignment().
@return true if is msdos_vista, otherwise false
@return true if is sector aligned, otherwise false
*/
bool PartitionTable::isVistaTableType() const
bool PartitionTable::isSectorBased() const
{
if (type() == PartitionTable::msdos)
{
// user has turned ms dos legacy off and partition table is empty
if (Config::useLegacyMsDosAlignment() == false && children().size() == 0)
// user has turned cylinder based alignment off and partition table is empty
if (Config::useCylinderAlignment() == false && children().size() == 0)
return true;
// if not all partitions start at a point evenly divisable by sectorAlignment it's
// a legacy msdos partition table
// a cylinder-aligned msdos partition table
foreach(const Partition* p, children())
if (p->firstSector() % Config::sectorAlignment() != 0)
return false;
// must be vista
// must be sector aligned
return true;
}

View File

@ -56,7 +56,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT PartitionTable : public PartitionNode
bsd,
dasd,
msdos,
msdos_vista,
msdos_sectorbased,
dvh,
gpt,
loop,
@ -123,7 +123,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT PartitionTable : public PartitionNode
void updateUnallocated(const Device& d);
void insertUnallocated(const Device& d, PartitionNode* p, qint64 start) const;
bool isVistaTableType() const;
bool isSectorBased() const;
static QList<Flag> flagList();
static QString flagName(Flag f);

View File

@ -15,9 +15,9 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_useLegacyMsDosAlignment">
<widget class="QCheckBox" name="kcfg_useCylinderAlignment">
<property name="text">
<string>Use Legacy MS-Dos Partition Alignment (Windows XP compatible)</string>
<string>Use Cylinder Based MS-Dos Partition Alignment (Windows XP compatible)</string>
</property>
<property name="checked">
<bool>true</bool>

View File

@ -42,8 +42,8 @@ PartitionTable::TableType CreatePartitionTableDialog::type() const
if (widget().radioGPT().isChecked())
return PartitionTable::gpt;
if (widget().radioMSDOS().isChecked() && Config::useLegacyMsDosAlignment() == true)
if (widget().radioMSDOS().isChecked() && Config::useCylinderAlignment() == true)
return PartitionTable::msdos;
return PartitionTable::msdos_vista;
return PartitionTable::msdos_sectorbased;
}

View File

@ -83,9 +83,9 @@ void DevicePropsDialog::setupDialog()
dialogWidget().type().setText(type);
if (device().partitionTable()->type() == PartitionTable::msdos)
dialogWidget().radioLegacy().setChecked(true);
else if (device().partitionTable()->type() == PartitionTable::msdos_vista)
dialogWidget().radioVista().setChecked(true);
dialogWidget().radioCylinderBased().setChecked(true);
else if (device().partitionTable()->type() == PartitionTable::msdos_sectorbased)
dialogWidget().radioSectorBased().setChecked(true);
else
dialogWidget().hideTypeRadioButtons();
@ -95,8 +95,8 @@ void DevicePropsDialog::setupDialog()
void DevicePropsDialog::setupConnections()
{
connect(&dialogWidget().radioVista(), SIGNAL(toggled(bool)), SLOT(setDirty(bool)));
connect(&dialogWidget().radioLegacy(), SIGNAL(toggled(bool)), SLOT(setDirty(bool)));
connect(&dialogWidget().radioSectorBased(), SIGNAL(toggled(bool)), SLOT(setDirty(bool)));
connect(&dialogWidget().radioCylinderBased(), SIGNAL(toggled(bool)), SLOT(setDirty(bool)));
}
void DevicePropsDialog::setDirty(bool)
@ -105,12 +105,12 @@ void DevicePropsDialog::setDirty(bool)
enableButtonOk(true);
}
bool DevicePropsDialog::legacyAlignment() const
bool DevicePropsDialog::cylinderBasedAlignment() const
{
return dialogWidget().radioLegacy().isChecked();
return dialogWidget().radioCylinderBased().isChecked();
}
bool DevicePropsDialog::vistaAlignment() const
bool DevicePropsDialog::sectorBasedAlignment() const
{
return dialogWidget().radioVista().isChecked();
return dialogWidget().radioSectorBased().isChecked();
}

View File

@ -45,8 +45,8 @@ class DevicePropsDialog : public KDialog
~DevicePropsDialog();
public:
bool legacyAlignment() const;
bool vistaAlignment() const;
bool cylinderBasedAlignment() const;
bool sectorBasedAlignment() const;
protected:
void setupDialog();

View File

@ -44,18 +44,18 @@ class DevicePropsWidget : public QWidget, public Ui::DevicePropsWidgetBase
QLabel& totalSectors() { Q_ASSERT(m_LabelTotalSectors); return *m_LabelTotalSectors; }
QLabel& type() { Q_ASSERT(m_LabelType); return *m_LabelType; }
QRadioButton& radioLegacy() { Q_ASSERT(m_RadioLegacy); return *m_RadioLegacy; }
const QRadioButton& radioLegacy() const { Q_ASSERT(m_RadioLegacy); return *m_RadioLegacy; }
QRadioButton& radioCylinderBased() { Q_ASSERT(m_RadioCylinderBased); return *m_RadioCylinderBased; }
const QRadioButton& radioCylinderBased() const { Q_ASSERT(m_RadioCylinderBased); return *m_RadioCylinderBased; }
QRadioButton& radioVista() { Q_ASSERT(m_RadioVista); return *m_RadioVista; }
const QRadioButton& radioVista() const { Q_ASSERT(m_RadioVista); return *m_RadioVista; }
QRadioButton& radioSectorBased() { Q_ASSERT(m_RadioSectorBased); return *m_RadioSectorBased; }
const QRadioButton& radioSectorBased() const { Q_ASSERT(m_RadioSectorBased); return *m_RadioSectorBased; }
QSpacerItem& spacerType() { Q_ASSERT(m_SpacerType); return *m_SpacerType; }
void hideTypeRadioButtons()
{
radioVista().setVisible(false);
radioLegacy().setVisible(false);
radioSectorBased().setVisible(false);
radioCylinderBased().setVisible(false);
}
};

View File

@ -81,16 +81,16 @@
<item row="3" column="1">
<layout class="QHBoxLayout" name="m_TypeLayout">
<item>
<widget class="QRadioButton" name="m_RadioLegacy">
<widget class="QRadioButton" name="m_RadioCylinderBased">
<property name="text">
<string>Legacy Alignment</string>
<string>Cylinder Alignment</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_RadioVista">
<widget class="QRadioButton" name="m_RadioSectorBased">
<property name="text">
<string>Vista Compatible Alignment</string>
<string>Sector Based Alignment</string>
</property>
</widget>
</item>

View File

@ -688,9 +688,9 @@ void MainWindow::onPropertiesDevice(const QString&)
QPointer<DevicePropsDialog> dlg = new DevicePropsDialog(this, d);
if (dlg->exec() == KDialog::Accepted)
{
if (d.partitionTable()->type() == PartitionTable::msdos && dlg->vistaAlignment())
d.partitionTable()->setType(d, PartitionTable::msdos_vista);
else if (d.partitionTable()->type() == PartitionTable::msdos_vista && dlg->legacyAlignment())
if (d.partitionTable()->type() == PartitionTable::msdos && dlg->sectorBasedAlignment())
d.partitionTable()->setType(d, PartitionTable::msdos_sectorbased);
else if (d.partitionTable()->type() == PartitionTable::msdos_sectorbased && dlg->cylinderBasedAlignment())
d.partitionTable()->setType(d, PartitionTable::msdos);
on_m_OperationStack_devicesChanged();