1 // SPDX-License-Identifier: Apache-2.0 2 // SPDX-FileCopyrightText: Copyright OpenBMC Authors 3 #pragma once 4 #include <nlohmann/json.hpp> 5 6 namespace volume 7 { 8 // clang-format off 9 10 enum class InitializeType{ 11 Invalid, 12 Fast, 13 Slow, 14 }; 15 16 enum class InitializeMethod{ 17 Invalid, 18 Skip, 19 Background, 20 Foreground, 21 }; 22 23 enum class RAIDType{ 24 Invalid, 25 RAID0, 26 RAID1, 27 RAID3, 28 RAID4, 29 RAID5, 30 RAID6, 31 RAID10, 32 RAID01, 33 RAID6TP, 34 RAID1E, 35 RAID50, 36 RAID60, 37 RAID00, 38 RAID10E, 39 RAID1Triple, 40 RAID10Triple, 41 None, 42 }; 43 44 enum class VolumeType{ 45 Invalid, 46 RawDevice, 47 NonRedundant, 48 Mirrored, 49 StripedWithParity, 50 SpannedMirrors, 51 SpannedStripesWithParity, 52 }; 53 54 enum class EncryptionTypes{ 55 Invalid, 56 NativeDriveEncryption, 57 ControllerAssisted, 58 SoftwareAssisted, 59 }; 60 61 enum class WriteHoleProtectionPolicyType{ 62 Invalid, 63 Off, 64 Journaling, 65 DistributedLog, 66 Oem, 67 }; 68 69 enum class VolumeUsageType{ 70 Invalid, 71 Data, 72 SystemData, 73 CacheOnly, 74 SystemReserve, 75 ReplicationReserve, 76 }; 77 78 enum class ReadCachePolicyType{ 79 Invalid, 80 ReadAhead, 81 AdaptiveReadAhead, 82 Off, 83 }; 84 85 enum class WriteCachePolicyType{ 86 Invalid, 87 WriteThrough, 88 ProtectedWriteBack, 89 UnprotectedWriteBack, 90 Off, 91 }; 92 93 enum class WriteCacheStateType{ 94 Invalid, 95 Unprotected, 96 Protected, 97 Degraded, 98 }; 99 100 enum class LBAFormatType{ 101 Invalid, 102 LBAFormat0, 103 LBAFormat1, 104 LBAFormat2, 105 LBAFormat3, 106 LBAFormat4, 107 LBAFormat5, 108 LBAFormat6, 109 LBAFormat7, 110 LBAFormat8, 111 LBAFormat9, 112 LBAFormat10, 113 LBAFormat11, 114 LBAFormat12, 115 LBAFormat13, 116 LBAFormat14, 117 LBAFormat15, 118 }; 119 120 enum class NamespaceType{ 121 Invalid, 122 Block, 123 KeyValue, 124 ZNS, 125 Computational, 126 }; 127 128 enum class OperationType{ 129 Invalid, 130 Deduplicate, 131 CheckConsistency, 132 Initialize, 133 Replicate, 134 Delete, 135 ChangeRAIDType, 136 Rebuild, 137 Encrypt, 138 Decrypt, 139 Resize, 140 Compress, 141 Sanitize, 142 Format, 143 ChangeStripSize, 144 }; 145 146 enum class LBARelativePerformanceType{ 147 Invalid, 148 Best, 149 Better, 150 Good, 151 Degraded, 152 }; 153 154 NLOHMANN_JSON_SERIALIZE_ENUM(InitializeType, { 155 {InitializeType::Invalid, "Invalid"}, 156 {InitializeType::Fast, "Fast"}, 157 {InitializeType::Slow, "Slow"}, 158 }); 159 160 NLOHMANN_JSON_SERIALIZE_ENUM(InitializeMethod, { 161 {InitializeMethod::Invalid, "Invalid"}, 162 {InitializeMethod::Skip, "Skip"}, 163 {InitializeMethod::Background, "Background"}, 164 {InitializeMethod::Foreground, "Foreground"}, 165 }); 166 167 NLOHMANN_JSON_SERIALIZE_ENUM(RAIDType, { 168 {RAIDType::Invalid, "Invalid"}, 169 {RAIDType::RAID0, "RAID0"}, 170 {RAIDType::RAID1, "RAID1"}, 171 {RAIDType::RAID3, "RAID3"}, 172 {RAIDType::RAID4, "RAID4"}, 173 {RAIDType::RAID5, "RAID5"}, 174 {RAIDType::RAID6, "RAID6"}, 175 {RAIDType::RAID10, "RAID10"}, 176 {RAIDType::RAID01, "RAID01"}, 177 {RAIDType::RAID6TP, "RAID6TP"}, 178 {RAIDType::RAID1E, "RAID1E"}, 179 {RAIDType::RAID50, "RAID50"}, 180 {RAIDType::RAID60, "RAID60"}, 181 {RAIDType::RAID00, "RAID00"}, 182 {RAIDType::RAID10E, "RAID10E"}, 183 {RAIDType::RAID1Triple, "RAID1Triple"}, 184 {RAIDType::RAID10Triple, "RAID10Triple"}, 185 {RAIDType::None, "None"}, 186 }); 187 188 NLOHMANN_JSON_SERIALIZE_ENUM(VolumeType, { 189 {VolumeType::Invalid, "Invalid"}, 190 {VolumeType::RawDevice, "RawDevice"}, 191 {VolumeType::NonRedundant, "NonRedundant"}, 192 {VolumeType::Mirrored, "Mirrored"}, 193 {VolumeType::StripedWithParity, "StripedWithParity"}, 194 {VolumeType::SpannedMirrors, "SpannedMirrors"}, 195 {VolumeType::SpannedStripesWithParity, "SpannedStripesWithParity"}, 196 }); 197 198 NLOHMANN_JSON_SERIALIZE_ENUM(EncryptionTypes, { 199 {EncryptionTypes::Invalid, "Invalid"}, 200 {EncryptionTypes::NativeDriveEncryption, "NativeDriveEncryption"}, 201 {EncryptionTypes::ControllerAssisted, "ControllerAssisted"}, 202 {EncryptionTypes::SoftwareAssisted, "SoftwareAssisted"}, 203 }); 204 205 NLOHMANN_JSON_SERIALIZE_ENUM(WriteHoleProtectionPolicyType, { 206 {WriteHoleProtectionPolicyType::Invalid, "Invalid"}, 207 {WriteHoleProtectionPolicyType::Off, "Off"}, 208 {WriteHoleProtectionPolicyType::Journaling, "Journaling"}, 209 {WriteHoleProtectionPolicyType::DistributedLog, "DistributedLog"}, 210 {WriteHoleProtectionPolicyType::Oem, "Oem"}, 211 }); 212 213 NLOHMANN_JSON_SERIALIZE_ENUM(VolumeUsageType, { 214 {VolumeUsageType::Invalid, "Invalid"}, 215 {VolumeUsageType::Data, "Data"}, 216 {VolumeUsageType::SystemData, "SystemData"}, 217 {VolumeUsageType::CacheOnly, "CacheOnly"}, 218 {VolumeUsageType::SystemReserve, "SystemReserve"}, 219 {VolumeUsageType::ReplicationReserve, "ReplicationReserve"}, 220 }); 221 222 NLOHMANN_JSON_SERIALIZE_ENUM(ReadCachePolicyType, { 223 {ReadCachePolicyType::Invalid, "Invalid"}, 224 {ReadCachePolicyType::ReadAhead, "ReadAhead"}, 225 {ReadCachePolicyType::AdaptiveReadAhead, "AdaptiveReadAhead"}, 226 {ReadCachePolicyType::Off, "Off"}, 227 }); 228 229 NLOHMANN_JSON_SERIALIZE_ENUM(WriteCachePolicyType, { 230 {WriteCachePolicyType::Invalid, "Invalid"}, 231 {WriteCachePolicyType::WriteThrough, "WriteThrough"}, 232 {WriteCachePolicyType::ProtectedWriteBack, "ProtectedWriteBack"}, 233 {WriteCachePolicyType::UnprotectedWriteBack, "UnprotectedWriteBack"}, 234 {WriteCachePolicyType::Off, "Off"}, 235 }); 236 237 NLOHMANN_JSON_SERIALIZE_ENUM(WriteCacheStateType, { 238 {WriteCacheStateType::Invalid, "Invalid"}, 239 {WriteCacheStateType::Unprotected, "Unprotected"}, 240 {WriteCacheStateType::Protected, "Protected"}, 241 {WriteCacheStateType::Degraded, "Degraded"}, 242 }); 243 244 NLOHMANN_JSON_SERIALIZE_ENUM(LBAFormatType, { 245 {LBAFormatType::Invalid, "Invalid"}, 246 {LBAFormatType::LBAFormat0, "LBAFormat0"}, 247 {LBAFormatType::LBAFormat1, "LBAFormat1"}, 248 {LBAFormatType::LBAFormat2, "LBAFormat2"}, 249 {LBAFormatType::LBAFormat3, "LBAFormat3"}, 250 {LBAFormatType::LBAFormat4, "LBAFormat4"}, 251 {LBAFormatType::LBAFormat5, "LBAFormat5"}, 252 {LBAFormatType::LBAFormat6, "LBAFormat6"}, 253 {LBAFormatType::LBAFormat7, "LBAFormat7"}, 254 {LBAFormatType::LBAFormat8, "LBAFormat8"}, 255 {LBAFormatType::LBAFormat9, "LBAFormat9"}, 256 {LBAFormatType::LBAFormat10, "LBAFormat10"}, 257 {LBAFormatType::LBAFormat11, "LBAFormat11"}, 258 {LBAFormatType::LBAFormat12, "LBAFormat12"}, 259 {LBAFormatType::LBAFormat13, "LBAFormat13"}, 260 {LBAFormatType::LBAFormat14, "LBAFormat14"}, 261 {LBAFormatType::LBAFormat15, "LBAFormat15"}, 262 }); 263 264 NLOHMANN_JSON_SERIALIZE_ENUM(NamespaceType, { 265 {NamespaceType::Invalid, "Invalid"}, 266 {NamespaceType::Block, "Block"}, 267 {NamespaceType::KeyValue, "KeyValue"}, 268 {NamespaceType::ZNS, "ZNS"}, 269 {NamespaceType::Computational, "Computational"}, 270 }); 271 272 NLOHMANN_JSON_SERIALIZE_ENUM(OperationType, { 273 {OperationType::Invalid, "Invalid"}, 274 {OperationType::Deduplicate, "Deduplicate"}, 275 {OperationType::CheckConsistency, "CheckConsistency"}, 276 {OperationType::Initialize, "Initialize"}, 277 {OperationType::Replicate, "Replicate"}, 278 {OperationType::Delete, "Delete"}, 279 {OperationType::ChangeRAIDType, "ChangeRAIDType"}, 280 {OperationType::Rebuild, "Rebuild"}, 281 {OperationType::Encrypt, "Encrypt"}, 282 {OperationType::Decrypt, "Decrypt"}, 283 {OperationType::Resize, "Resize"}, 284 {OperationType::Compress, "Compress"}, 285 {OperationType::Sanitize, "Sanitize"}, 286 {OperationType::Format, "Format"}, 287 {OperationType::ChangeStripSize, "ChangeStripSize"}, 288 }); 289 290 NLOHMANN_JSON_SERIALIZE_ENUM(LBARelativePerformanceType, { 291 {LBARelativePerformanceType::Invalid, "Invalid"}, 292 {LBARelativePerformanceType::Best, "Best"}, 293 {LBARelativePerformanceType::Better, "Better"}, 294 {LBARelativePerformanceType::Good, "Good"}, 295 {LBARelativePerformanceType::Degraded, "Degraded"}, 296 }); 297 298 } 299 // clang-format on 300