| 71 | } |
| 72 | |
| 73 | string piscsi_util::ProcessId(const string& id_spec, int& id, int& lun) |
| 74 | { |
| 75 | id = -1; |
| 76 | lun = -1; |
| 77 | |
| 78 | if (id_spec.empty()) { |
| 79 | return "Missing device ID"; |
| 80 | } |
| 81 | |
| 82 | const int id_max = ControllerManager::GetScsiIdMax(); |
| 83 | const int lun_max = ControllerManager::GetScsiLunMax(); |
| 84 | |
| 85 | if (const auto& components = Split(id_spec, COMPONENT_SEPARATOR, 2); !components.empty()) { |
| 86 | if (components.size() == 1) { |
| 87 | if (!GetAsUnsignedInt(components[0], id) || id >= id_max) { |
| 88 | id = -1; |
| 89 | |
| 90 | return "Invalid device ID (0-" + to_string(ControllerManager::GetScsiIdMax() - 1) + ")"; |
| 91 | } |
| 92 | |
| 93 | return ""; |
| 94 | } |
| 95 | |
| 96 | if (!GetAsUnsignedInt(components[0], id) || id >= id_max || !GetAsUnsignedInt(components[1], lun) || lun >= lun_max) { |
| 97 | id = -1; |
| 98 | lun = -1; |
| 99 | |
| 100 | return "Invalid LUN (0-" + to_string(lun_max - 1) + ")"; |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | return ""; |
| 105 | } |
| 106 | |
| 107 | string piscsi_util::Banner(string_view app) |
| 108 | { |
nothing calls this directly
no outgoing calls
no test coverage detected