Commit Graph

16 Commits

Author SHA1 Message Date
Yaroslav Sidlovsky 8746ef72fd Fix smartctl exit status success check
According to the smartctl man page:
```
EXIT STATUS
The  exit  statuses of smartctl are defined by a bitmask.  If all is well with the disk, the exit status (return value) of smartctl is 0 (all bits turned off).  If a problem occurs, or an error, potential error, or fault is detected, then a non-zero status is
returned.  In this case, the eight different bits in the exit status have the following meanings for ATA disks; some of these values may also be returned for SCSI disks.

Bit 0: Command line did not parse.

Bit 1: Device open failed, device did not return an IDENTIFY DEVICE structure, or device is in a low-power mode (see '-n' option above).

Bit 2: Some SMART or other ATA command to the disk failed, or there was a checksum error in a SMART data structure (see '-b' option above).

Bit 3: SMART status check returned "DISK FAILING".

Bit 4: We found prefail Attributes <= threshold.

Bit 5: SMART status check returned "DISK OK" but we found that some (usage or prefail) Attributes have been <= threshold at some time in the past.

Bit 6: The device error log contains records of errors.

Bit 7: The device self-test log contains records of errors.  [ATA only] Failed self-tests outdated by a newer successful extended self-test are ignored.
```

BUG: 429028
2021-03-17 16:03:32 +03:00
Andrius Štikonas 19f78ef76a Port away from qAsConst. 2020-10-24 22:01:45 +01:00
Andrius Štikonas d68ffeadef REUSE: SPDX style license headers for src/util. 2020-10-01 00:33:19 +01:00
Andrius Štikonas 11bb5799ec REUSE: SPDX license headers for backend and core folders. 2020-09-20 20:33:16 +01:00
Yuri Chornoivan 1a7b673792 Fix minor issues found by EBN 2019-11-22 15:45:12 +02:00
Andrius Štikonas 6a3b1e02b6 smart: obtain disk size in blocks.
Also drop pre 7.0 support as any earlier version was not supported.
2019-06-05 18:32:11 +01:00
Valerii Malov 9565ef61ab Add support for smartmontools 7.0 user_capacity json output
Summary:
smartmontools 7.0 reports user capacity as an object that contains bytes and blocks value, instead of being an int that just contains bytes
This should fix incorrect calculation of bad blocks threshold and incorrect display of "Overall" status

Test Plan:
run partitionmanager on a system that has smartmontools 7, open smart status
overall status should be reported correctly

Reviewers: stikonas

Reviewed By: stikonas

Differential Revision: https://phabricator.kde.org/D21311
2019-05-23 17:43:44 +03:00
Andrius Štikonas a9a637454a Fix a memory leak in SmartParser.
CC: caiojcarvalho@gmail.com
2018-04-09 16:07:44 +01:00
Andrius Štikonas 492e3beb18 Reuse SmartStatus::SelfTestStatus enum. 2018-04-09 15:37:46 +01:00
Andrius Štikonas 838150d439 Do not use blkid cache. 2018-01-31 16:53:34 +00:00
Andrius Štikonas c50006ed22 Fix #include issues in smart code.
CC: caiojcarvalho@gmail.com
2018-01-31 16:12:11 +00:00
Caio Carvalho 0190d32cf6 Including doxygen comments to the new SMART support classes 2018-01-11 17:38:53 -03:00
Andrius Štikonas a135c86ba1 Use QStringLiteral instead of QString::fromLocal8Bit 2018-01-11 14:17:55 +01:00
Andrius Štikonas ed7c5b1c77 Use long command line option for smartctl. 2018-01-11 12:00:52 +01:00
Caio Carvalho d71731141c - Changed m_Quirk variable in SmartAttributeParsedData to SmartQuirk value instead of reference
- Changed smartctl call to use ExternalCommand class instead of QProcess
- Changed Q_FOREACH to C++11 ranged based for
- Changed quint64 json parsing
2018-01-09 01:35:59 -03:00
Caio Carvalho 8177fb9738 Adding smart JSON output support 2018-01-08 17:59:48 -03:00