1 /*
2     SPDX-FileCopyrightText: 2016 Chantara Tith <tith.chantara@gmail.com>
3     SPDX-FileCopyrightText: 2016-2018 Andrius Štikonas <andrius@stikonas.eu>
4     SPDX-FileCopyrightText: 2019 Yuri Chornoivan <yurchor@ukr.net>
5 
6     SPDX-License-Identifier: GPL-3.0-or-later
7 */
8 
9 #include "core/volumemanagerdevice.h"
10 #include "core/volumemanagerdevice_p.h"
11 #include "core/device_p.h"
12 #include "core/lvmdevice.h"
13 #include "core/raid/softwareraid.h"
14 
15 /** Constructs an abstract Volume Manager Device with an empty PartitionTable.
16  *
17  * @param name the Device's name
18  * @param deviceNode the Device's node
19  * @param logicalExtentSize the logical extent size that device uses
20 */
VolumeManagerDevice(std::shared_ptr<VolumeManagerDevicePrivate> d,const QString & name,const QString & deviceNode,const qint64 logicalExtentSize,const qint64 totalLogical,const QString & iconName,Device::Type type)21 VolumeManagerDevice::VolumeManagerDevice(std::shared_ptr<VolumeManagerDevicePrivate> d,
22                                          const QString& name,
23                                          const QString& deviceNode,
24                                          const qint64 logicalExtentSize,
25                                          const qint64 totalLogical,
26                                          const QString& iconName,
27                                          Device::Type type)
28     : Device(std::static_pointer_cast<DevicePrivate>(d), name, deviceNode, logicalExtentSize, totalLogical, iconName, type)
29 {
30 }
31 
scanDevices(QList<Device * > & devices)32 void VolumeManagerDevice::scanDevices(QList<Device*>& devices)
33 {
34     SoftwareRAID::scanSoftwareRAID(devices);
35     LvmDevice::scanSystemLVM(devices); // LVM scanner needs all other devices, so should be last
36 }
37 
prettyDeviceNodeList() const38 QString VolumeManagerDevice::prettyDeviceNodeList() const
39 {
40     return deviceNodes().join(QStringLiteral(", "));
41 }
42 
setTotalLogical(qint64 n)43 void VolumeManagerDevice::setTotalLogical(qint64 n)
44 {
45     Q_ASSERT(n > 0);
46     d->m_TotalLogical = n;
47 }
48