2016-06-08 16:50:40 +01:00
|
|
|
/*************************************************************************
|
2016-06-18 20:54:52 +01:00
|
|
|
* Copyright (C) 2016 by Chantara Tith <tith.chantara@gmail.com> *
|
|
|
|
* *
|
2016-06-08 16:50:40 +01:00
|
|
|
* 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 3 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, see <http://www.gnu.org/licenses/>.*
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#if !defined(VOLUMEMANAGERDEVICE__H)
|
|
|
|
|
|
|
|
#define VOLUMEMANAGERDEVICE__H
|
|
|
|
|
|
|
|
#include "util/libpartitionmanagerexport.h"
|
|
|
|
#include "core/device.h"
|
|
|
|
|
|
|
|
#include <QString>
|
2016-08-07 21:30:47 +01:00
|
|
|
#include <QStringList>
|
2016-06-08 16:50:40 +01:00
|
|
|
#include <QObject>
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
|
|
|
class PartitionTable;
|
|
|
|
class CreatePartitionTableOperation;
|
|
|
|
class CoreBackend;
|
|
|
|
class SmartStatus;
|
|
|
|
class Partition;
|
|
|
|
|
2016-08-10 03:13:53 +01:00
|
|
|
/** A Volume Manager of real physical devices represented as an abstract device.
|
2016-06-08 16:50:40 +01:00
|
|
|
|
2016-08-10 03:13:53 +01:00
|
|
|
VolumeManagerDevice is an abstract class of volume manager. e.g: LVM, SoftRAID.
|
|
|
|
a device like /dev/sda, /dev/sdb1.
|
2016-06-08 16:50:40 +01:00
|
|
|
|
|
|
|
Devices are the outermost entity; they contain a PartitionTable that itself contains Partitions.
|
|
|
|
|
|
|
|
@see PartitionTable, Partition
|
|
|
|
*/
|
|
|
|
class LIBKPMCORE_EXPORT VolumeManagerDevice : public Device
|
|
|
|
{
|
|
|
|
Q_DISABLE_COPY(VolumeManagerDevice)
|
|
|
|
|
2016-08-07 21:30:47 +01:00
|
|
|
public:
|
2016-08-10 03:13:53 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2016-06-08 16:50:40 +01:00
|
|
|
VolumeManagerDevice(const QString& name, const QString& devicenode, const qint32 logicalSize, const qint64 totalLogical, const QString& iconname = QString(), Device::Type type = Device::Unknown_Device);
|
2016-08-10 03:13:53 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
virtual const QStringList deviceNodes() const = 0; /** Return list of physical device or partitions that makes up volumeManagerDevice. */
|
|
|
|
virtual const QStringList partitionNodes() const = 0; /** Return list of partitions on the device. */
|
|
|
|
virtual qint64 partitionSize(QString& partitionPath) const = 0; /** Return size of provided partition in bytes. */
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2016-08-07 21:30:47 +01:00
|
|
|
virtual void initPartitions() = 0;
|
2016-08-10 03:13:53 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2016-06-18 20:54:52 +01:00
|
|
|
virtual qint64 mappedSector(const QString& devNode, qint64 sector) const = 0;
|
2016-06-08 16:50:40 +01:00
|
|
|
|
|
|
|
public:
|
2016-08-10 03:13:53 +01:00
|
|
|
|
|
|
|
/** string deviceNodes together into comma-sperated list
|
|
|
|
*
|
|
|
|
* */
|
2016-06-12 14:09:46 +01:00
|
|
|
virtual QString prettyDeviceNodeList() const;
|
|
|
|
|
2016-08-10 03:13:53 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2016-08-07 21:30:47 +01:00
|
|
|
void setTotalLogical(qint64 num) {
|
|
|
|
Q_ASSERT(num > 0);
|
|
|
|
m_TotalLogical = num;
|
|
|
|
}
|
2016-06-08 16:50:40 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|