Partition

Search for usage in LXR

#include <partition.h>

Inheritance diagram for Partition:

Public Types

enum  State {
  None, New, Copy, Restore,
  StateNone = None, StateNew = New, StateCopy = Copy, StateRestore = Restore
}
 
- Public Types inherited from PartitionNode
typedef QList< Partition * > Partitions
 

Public Member Functions

 Partition (PartitionNode *parent, const Device &device, const PartitionRole &role, FileSystem *fs, qint64 sectorStart, qint64 sectorEnd, QString partitionPath, PartitionTable::Flags availableFlags=PartitionTable::Flag::None, const QString &mountPoint=QString(), bool mounted=false, PartitionTable::Flags activeFlags=PartitionTable::Flag::None, State state=State::None)
 
 Partition (const Partition &other, PartitionNode *parent=nullptr)
 
 ~Partition () override
 
PartitionTable::Flags activeFlags () const
 
void adjustLogicalNumbers (qint32 deletedNumber, qint32 insertedNumber) const
 
void append (Partition *p) override
 
quint64 attributes () const
 
qint64 available () const
 
PartitionTable::Flags availableFlags () const
 
bool canMount () const
 
bool canUnmount () const
 
qint64 capacity () const
 
void checkChildrenMounted ()
 
Partitionschildren () override
 
const Partitionschildren () const override
 
void deleteFileSystem ()
 
QString deviceNode () const
 
const QStringdevicePath () const
 
FileSystemfileSystem ()
 
const FileSystemfileSystem () const
 
qint64 firstByte () const
 
qint64 firstSector () const
 
bool hasChildren () const
 
bool isMounted () const
 
bool isRoot () const override
 
const QStringlabel () const
 
qint64 lastByte () const
 
qint64 lastSector () const
 
qint64 length () const
 
qint64 maxFirstSector () const
 
qint64 maximumSectors () const
 
qint64 minimumSectors () const
 
qint64 minLastSector () const
 
bool mount (Report &report)
 
const QStringmountPoint () const
 
void move (qint64 newStartSector)
 
qint32 number () const
 
bool operator!= (const Partition &other) const
 
Partitionoperator= (const Partition &)
 
bool operator== (const Partition &other) const
 
PartitionNodeparent () override
 
const PartitionNodeparent () const override
 
const QStringpartitionPath () const
 
const PartitionTablepartitionTable () const
 
const PartitionRoleroles () const
 
qint64 sectorSize () const
 
qint64 sectorsUsed () const
 
void setAttributes (quint64 f)
 
void setDevicePath (const QString &s)
 
void setFileSystem (FileSystem *fs)
 
void setFirstSector (qint64 s)
 
void setFlag (PartitionTable::Flag f)
 
void setFlags (PartitionTable::Flags f)
 
void setLabel (const QString &s)
 
void setLastSector (qint64 s)
 
void setMounted (bool b)
 
void setMountPoint (const QString &s)
 
void setParent (PartitionNode *p)
 
void setPartitionPath (const QString &s)
 
void setRoles (const PartitionRole &r)
 
void setSectorSize (qint32 s)
 
void setState (State s)
 
void setType (const QString &s)
 
void setUUID (const QString &s)
 
State state () const
 
const QStringtype () const
 
bool unmount (Report &report)
 
void unsetFlag (PartitionTable::Flag f)
 
qint64 used () const
 
const QStringuuid () const
 
- Public Member Functions inherited from PartitionNode
virtual PartitionfindPartitionBySector (qint64 s, const PartitionRole &role)
 
virtual const PartitionfindPartitionBySector (qint64 s, const PartitionRole &role) const
 
virtual qint32 highestMountedChild () const
 
virtual bool insert (Partition *partNew)
 
virtual bool isChildMounted () const
 
virtual Partitionpredecessor (Partition &p)
 
virtual const Partitionpredecessor (const Partition &p) const
 
virtual bool remove (Partition *p)
 
virtual void reparent (Partition &p)
 
virtual Partitionsuccessor (Partition &p)
 
virtual const Partitionsuccessor (const Partition &p) const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from PartitionNode
virtual void clearChildren ()
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

A partition or some unallocated space on a Device.

Represent partitions in a PartitionTable on a Device. Partitions can be unallocated, thus not all instances really are partitions in the way the user would see them.

Extended partitions have child objects that represent the logicals inside them.

See also
PartitionTable, Device, FileSystem
Author
Volker Lanz [email protected][email protected]dra.[email protected]de

Definition at line 66 of file partition.h.

Member Enumeration Documentation

A Partition state – where did it come from?

Enumerator
None 

exists on disk

New 

from a NewOperation

Copy 

from a CopyOperation

Restore 

from a RestoreOperation

Definition at line 71 of file partition.h.

Constructor & Destructor Documentation

Partition::Partition ( PartitionNode parent,
const Device device,
const PartitionRole role,
FileSystem fs,
qint64  sectorStart,
qint64  sectorEnd,
QString  partitionPath,
PartitionTable::Flags  availableFlags = PartitionTable::Flag::None,
const QString mountPoint = QString(),
bool  mounted = false,
PartitionTable::Flags  activeFlags = PartitionTable::Flag::None,
State  state = State::None 
)

Creates a new Partition object.

Parameters
parentthe Partition's parent. May be another Partition (for logicals) or a PartitionTable. Must not be nullptr.
devicethe Device this Partition is on.
rolethe Partition's role(s)
fspointer to the Partition's FileSystem object. The Partition object will take ownership of this.
sectorStartthe first sector of the Partition on its Device
sectorEndthe last sector of the Partition on its Device
partitionPaththe Partition's path, e.g. /dev/sda4 or /dev/mmcblk0p1
availableFlagsthe flags available for this Partition
mountPointmount point for this Partition
mountedtrue if the Partition is mounted
activeFlagsactive flags for this Partition
statethe Partition's state

Definition at line 45 of file partition.cpp.

Partition::~Partition ( )
override

Destroys a Partition, destroying its children and its FileSystem.

Definition at line 66 of file partition.cpp.

Partition::Partition ( const Partition other,
PartitionNode parent = nullptr 
)
Parameters
otherPartition to copy

Definition at line 84 of file partition.cpp.

Member Function Documentation

PartitionTable::Flags Partition::activeFlags ( ) const
inline

<

Returns
the flags currently set for this Partition

Definition at line 175 of file partition.h.

void Partition::adjustLogicalNumbers ( qint32  deletedNumber,
qint32  insertedNumber 
) const

Adjusts the numbers of logical Partitions for an extended Partition.

This is required if a logical Partition is deleted or inserted because logicals must be numberd from 5 onwards without a gap. So if the user deletes Partition number 7 and there is a number 8, 8 becomes the "new" 7. And since this happens somewhere in the middle of a DeleteOperation, we have to adjust to that so the next Job still finds the Partition it wants to deal with.

Parameters
deletedNumberthe number of a deleted logical or -1 if none has been deleted
insertedNumberthe number of an inserted logical or -1 if none has been inserted

Definition at line 215 of file partition.cpp.

quint64 Partition::attributes ( ) const
inline

<

Returns
the GPT Partition attributes

Definition at line 129 of file partition.h.

qint64 Partition::available ( ) const
inline

<

Returns
the number of free sectors in the Partition's FileSystem

Definition at line 157 of file partition.h.

PartitionTable::Flags Partition::availableFlags ( ) const
inline

<

Returns
the flags available for this Partition

Definition at line 178 of file partition.h.

bool Partition::canMount ( ) const
Returns
true if this Partition can be mounted

Definition at line 280 of file partition.cpp.

bool Partition::canUnmount ( ) const
Returns
true if this Partition can be unmounted

Definition at line 295 of file partition.cpp.

qint64 Partition::capacity ( ) const
inline

<

Returns
the capacity of the Partition in bytes

Definition at line 151 of file partition.h.

void Partition::checkChildrenMounted ( )

Sets an extended Partition to mounted if any of its children are mounted.

Definition at line 274 of file partition.cpp.

Partitions& Partition::children ( )
inlineoverridevirtual

<

Returns
the Partition's children. empty for non-extended.

Implements PartitionNode.

Definition at line 108 of file partition.h.

const Partitions& Partition::children ( ) const
inlineoverridevirtual

<

Returns
the Partition's children. empty for non-extended.

Implements PartitionNode.

Definition at line 111 of file partition.h.

QString Partition::deviceNode ( ) const
Returns
a short descriptive text or, in case the Partition has StateNone, its device node.

Definition at line 156 of file partition.cpp.

const QString& Partition::devicePath ( ) const
inline

<

Returns
the Partition's device path, e.g. /dev/sdd

Definition at line 114 of file partition.h.

FileSystem& Partition::fileSystem ( )
inline

<

Returns
the Partition's FileSystem

Definition at line 184 of file partition.h.

const FileSystem& Partition::fileSystem ( ) const
inline

<

Returns
the Partition's FileSystem

Definition at line 187 of file partition.h.

qint64 Partition::firstByte ( ) const
inline

<

Returns
the Partition's first byte on the Device

Definition at line 138 of file partition.h.

qint64 Partition::firstSector ( ) const
inline

<

Returns
the Partition's first sector on the Device

Definition at line 132 of file partition.h.

bool Partition::hasChildren ( ) const
Returns
true if the Partition has children

Definition at line 255 of file partition.cpp.

bool Partition::isMounted ( ) const
inline

<

Returns
true if Partition is mounted

Definition at line 181 of file partition.h.

bool Partition::isRoot ( ) const
inlineoverridevirtual

<

Returns
always false for Partition

Implements PartitionNode.

Definition at line 95 of file partition.h.

const QString& Partition::label ( ) const
inline

<

Returns
the GPT Partition label

Definition at line 120 of file partition.h.

qint64 Partition::lastByte ( ) const
inline

<

Returns
the Partition's last byte on the Device

Definition at line 141 of file partition.h.

qint64 Partition::lastSector ( ) const
inline

<

Returns
the Partition's last sector on the Device

Definition at line 135 of file partition.h.

qint64 Partition::length ( ) const
inline

<

Returns
the length of the Partition

Definition at line 148 of file partition.h.

qint64 Partition::maxFirstSector ( ) const
Returns
the highest sector number an extended Partition can begin at

Definition at line 231 of file partition.cpp.

qint64 Partition::maximumSectors ( ) const
Returns
the maximum number of sectors this Partition may be long

Definition at line 200 of file partition.cpp.

qint64 Partition::minimumSectors ( ) const
Returns
the minimum number of sectors this Partition must be long

Definition at line 192 of file partition.cpp.

qint64 Partition::minLastSector ( ) const
Returns
the lowest sector number an extended Partition can end at

Definition at line 243 of file partition.cpp.

bool Partition::mount ( Report report)

Tries to mount a Partition.

Returns
true on success

Definition at line 309 of file partition.cpp.

const QString& Partition::mountPoint ( ) const
inline

<

Returns
the Partition's mount point

Definition at line 171 of file partition.h.

qint32 Partition::number ( ) const
inline

<

Returns
the Partition's device number, e.g. 7 for /dev/sdd7

Definition at line 91 of file partition.h.

Partition & Partition::operator= ( const Partition other)
Parameters
otherPartition to assign from

Definition at line 113 of file partition.cpp.

PartitionNode* Partition::parent ( )
inlineoverridevirtual

<

Returns
the Partition's parent PartitionNode

Implements PartitionNode.

Definition at line 101 of file partition.h.

const PartitionNode* Partition::parent ( ) const
inlineoverridevirtual

<

Returns
the Partition's parent PartitionNode

Implements PartitionNode.

Definition at line 104 of file partition.h.

const QString& Partition::partitionPath ( ) const
inline

<

Returns
the Partition's path, e.g. /dev/sdd1

Definition at line 117 of file partition.h.

const PartitionTable * Partition::partitionTable ( ) const
Returns
returns the Partition Table which contains this Partition

Definition at line 265 of file partition.cpp.

const PartitionRole& Partition::roles ( ) const
inline

<

Returns
the Partition's role(s)

Definition at line 167 of file partition.h.

qint64 Partition::sectorSize ( ) const
inline

<

Returns
the sector size on the Partition's Device

Definition at line 145 of file partition.h.

qint64 Partition::sectorsUsed ( ) const
Returns
the sectors used in the Partition's FileSystem or, in case of an extended partition, the sum of used sectors of the Partition's children

Definition at line 174 of file partition.cpp.

void Partition::setAttributes ( quint64  f)
inline

<

Parameters
fthe new attributes

Definition at line 220 of file partition.h.

void Partition::setLabel ( const QString s)
inline

<

Parameters
sthe new label

Definition at line 211 of file partition.h.

void Partition::setType ( const QString s)
inline

<

Parameters
sthe new type

Definition at line 214 of file partition.h.

void Partition::setUUID ( const QString s)
inline

<

Parameters
sthe new UUID

Definition at line 217 of file partition.h.

State Partition::state ( ) const
inline

<

Returns
the Partition's state

Definition at line 190 of file partition.h.

const QString& Partition::type ( ) const
inline

<

Returns
the GPT Partition type

Definition at line 123 of file partition.h.

bool Partition::unmount ( Report report)

Tries to unmount a Partition.

Returns
true on success

Definition at line 328 of file partition.cpp.

qint64 Partition::used ( ) const
inline

<

Returns
the number of used sectors in the Partition's FileSystem

Definition at line 154 of file partition.h.

const QString& Partition::uuid ( ) const
inline

<

Returns
the GPT Partition UUID

Definition at line 126 of file partition.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jan 22 2022 23:11:11 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.