Merge branch '4.0'
This commit is contained in:
commit
ba48851d34
|
@ -260,7 +260,7 @@ void SmartAttributeParsedData::verifySectors()
|
||||||
if (prettyUnit() != SmartAttributeUnit::Sectors)
|
if (prettyUnit() != SmartAttributeUnit::Sectors)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
quint64 maxSectors = disk()->size() / 512ULL;
|
quint64 maxSectors = disk()->sectors();
|
||||||
|
|
||||||
if (prettyValue() == 0xFFFFFFFFULL || prettyValue() == 0xFFFFFFFFFFFFULL || (maxSectors > 0
|
if (prettyValue() == 0xFFFFFFFFULL || prettyValue() == 0xFFFFFFFFFFFFULL || (maxSectors > 0
|
||||||
&& prettyValue() > maxSectors))
|
&& prettyValue() > maxSectors))
|
||||||
|
|
|
@ -27,7 +27,7 @@ SmartDiskInformation::SmartDiskInformation() :
|
||||||
m_ModelName(QString()),
|
m_ModelName(QString()),
|
||||||
m_FirmwareVersion(QString()),
|
m_FirmwareVersion(QString()),
|
||||||
m_SerialNumber(QString()),
|
m_SerialNumber(QString()),
|
||||||
m_Size(0),
|
m_Sectors(0),
|
||||||
m_Temperature(0),
|
m_Temperature(0),
|
||||||
m_BadSectors(0),
|
m_BadSectors(0),
|
||||||
m_PoweredOn(0),
|
m_PoweredOn(0),
|
||||||
|
@ -64,7 +64,7 @@ void SmartDiskInformation::updateOverall()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 sector_threshold = u64log2(size() / 512) * 1024;
|
quint64 sector_threshold = u64log2(sectors()) * 1024;
|
||||||
|
|
||||||
if (badSectors() >= sector_threshold) {
|
if (badSectors() >= sector_threshold) {
|
||||||
m_Overall = SmartStatus::Overall::BadSectorsMany;
|
m_Overall = SmartStatus::Overall::BadSectorsMany;
|
||||||
|
|
|
@ -66,9 +66,9 @@ public:
|
||||||
return m_SerialNumber; /**< @return the disk serial number */
|
return m_SerialNumber; /**< @return the disk serial number */
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 size() const
|
quint64 sectors() const
|
||||||
{
|
{
|
||||||
return m_Size; /**< @return disk size */
|
return m_Sectors; /**< @return disk size */
|
||||||
}
|
}
|
||||||
|
|
||||||
bool smartStatus() const
|
bool smartStatus() const
|
||||||
|
@ -127,9 +127,9 @@ public:
|
||||||
m_SerialNumber = serial;
|
m_SerialNumber = serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSize(quint64 size)
|
void setSectors(quint64 numSectors)
|
||||||
{
|
{
|
||||||
m_Size = size;
|
m_Sectors = numSectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPowerCycles(quint64 powerCycleCt)
|
void setPowerCycles(quint64 powerCycleCt)
|
||||||
|
@ -159,7 +159,7 @@ private:
|
||||||
QString m_ModelName;
|
QString m_ModelName;
|
||||||
QString m_FirmwareVersion;
|
QString m_FirmwareVersion;
|
||||||
QString m_SerialNumber;
|
QString m_SerialNumber;
|
||||||
quint64 m_Size;
|
quint64 m_Sectors;
|
||||||
quint64 m_Temperature;
|
quint64 m_Temperature;
|
||||||
quint64 m_BadSectors;
|
quint64 m_BadSectors;
|
||||||
quint64 m_PoweredOn;
|
quint64 m_PoweredOn;
|
||||||
|
|
|
@ -64,6 +64,7 @@ bool SmartParser::init()
|
||||||
QString status = QStringLiteral("status");
|
QString status = QStringLiteral("status");
|
||||||
QString value = QStringLiteral("value");
|
QString value = QStringLiteral("value");
|
||||||
QString user_capacity = QStringLiteral("user_capacity");
|
QString user_capacity = QStringLiteral("user_capacity");
|
||||||
|
QString blocks = QStringLiteral("blocks");
|
||||||
|
|
||||||
if (!smartJson.contains(device)) {
|
if (!smartJson.contains(device)) {
|
||||||
qDebug() << "smart disk open failed for " << devicePath() << ": " << strerror(errno);
|
qDebug() << "smart disk open failed for " << devicePath() << ": " << strerror(errno);
|
||||||
|
@ -91,7 +92,10 @@ bool SmartParser::init()
|
||||||
m_DiskInformation->setModel(smartJson[model_name].toString());
|
m_DiskInformation->setModel(smartJson[model_name].toString());
|
||||||
m_DiskInformation->setFirmware(smartJson[firmware].toString());
|
m_DiskInformation->setFirmware(smartJson[firmware].toString());
|
||||||
m_DiskInformation->setSerial(smartJson[serial_number].toString());
|
m_DiskInformation->setSerial(smartJson[serial_number].toString());
|
||||||
m_DiskInformation->setSize(smartJson[user_capacity].toVariant().toULongLong());
|
|
||||||
|
const auto user_capacity_object = smartJson[user_capacity].toObject();
|
||||||
|
QString user_capacity_blocks = QStringLiteral("bytes");
|
||||||
|
m_DiskInformation->setSectors(user_capacity_object[user_capacity_blocks].toVariant().toULongLong());
|
||||||
|
|
||||||
QJsonObject selfTest = smartJson[self_test].toObject();
|
QJsonObject selfTest = smartJson[self_test].toObject();
|
||||||
QJsonObject selfTestStatus = selfTest[status].toObject();
|
QJsonObject selfTestStatus = selfTest[status].toObject();
|
||||||
|
|
|
@ -80,6 +80,7 @@ ActionReply ExternalCommandHelper::init(const QVariantMap& args)
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Reads the given number of bytes from the sourceDevice into the given buffer.
|
/** Reads the given number of bytes from the sourceDevice into the given buffer.
|
||||||
@param sourceDevice device or file to read from
|
@param sourceDevice device or file to read from
|
||||||
@param buffer buffer to store the bytes read in
|
@param buffer buffer to store the bytes read in
|
||||||
|
|
Loading…
Reference in New Issue