File indexing completed on 2024-03-24 05:36:23

0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0002 // SPDX-FileCopyrightText: 2020-2021 Harald Sitter <sitter@kde.org>
0003 
0004 #pragma once
0005 
0006 #include <QFlag>
0007 #include <QObject>
0008 
0009 namespace SMART
0010 {
0011 Q_NAMESPACE
0012 /** smartctl manpage (exit codes are flags)
0013   Bit 0: Command line did not parse.
0014   Bit 1: Device open failed, device did not return an IDENTIFY DEVICE structure,
0015          or device is in a  low-power  mode  (see  '-n'  option above).
0016   Bit 2: Some  SMART  or other ATA command to the disk failed, or there was a
0017          checksum error in a SMART data structure (see '-b' option above).
0018   Bit 3: SMART status check returned "DISK FAILING".
0019   Bit 4: We found prefail Attributes <= threshold.
0020   Bit 5: SMART status check returned "DISK OK" but we found that some (usage or
0021          prefail) Attributes have been <= threshold at some time in the past.
0022   Bit 6: The device error log contains records of errors.
0023   Bit 7: The  device  self-test  log  contains records of errors.
0024          [ATA only] Failed self-tests outdated by a newer successful extended
0025          self-test are ignored.
0026 */
0027 enum class Failure {
0028     None = 0x0,
0029     CmdLineParse = 0x1,
0030     DeviceOpen = 0x2,
0031     InternalCommand = 0x4,
0032     Disk = 0x8,
0033     Prefail = 0x10,
0034     PastPrefail = 0x20,
0035     ErrorsRecorded = 0x40,
0036     SelfTestErrors = 0x80,
0037     // The entire thing doesn't exceed 8 bits because it's a posix exit code.
0038 };
0039 Q_ENUM_NS(Failure)
0040 Q_DECLARE_FLAGS(Failures, Failure)
0041 }
0042 
0043 Q_DECLARE_OPERATORS_FOR_FLAGS(SMART::Failures)