Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 1 | #include "manager.hpp" |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 2 | |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 3 | #include "utils.hpp" |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 4 | |
Lei YU | 86d8041 | 2017-07-12 13:12:12 +0800 | [diff] [blame] | 5 | #include <phosphor-logging/elog-errors.hpp> |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 6 | #include <phosphor-logging/elog.hpp> |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 7 | #include <phosphor-logging/log.hpp> |
Lei YU | 86d8041 | 2017-07-12 13:12:12 +0800 | [diff] [blame] | 8 | #include <xyz/openbmc_project/Common/error.hpp> |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 9 | #include <xyz/openbmc_project/State/Host/server.hpp> |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 10 | |
| 11 | namespace rules = sdbusplus::bus::match::rules; |
| 12 | |
| 13 | namespace // anonymous |
| 14 | { |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 15 | constexpr auto HOST_CURRENT_STATE = "CurrentHostState"; |
Lei YU | a741713 | 2017-02-23 15:24:05 +0800 | [diff] [blame] | 16 | |
| 17 | constexpr auto SYSTEMD_TIME_SERVICE = "org.freedesktop.timedate1"; |
| 18 | constexpr auto SYSTEMD_TIME_PATH = "/org/freedesktop/timedate1"; |
Lei YU | dd8e9e4 | 2017-04-19 17:46:58 +0800 | [diff] [blame] | 19 | constexpr auto SYSTEMD_TIME_INTERFACE = "org.freedesktop.timedate1"; |
Lei YU | a741713 | 2017-02-23 15:24:05 +0800 | [diff] [blame] | 20 | constexpr auto METHOD_SET_NTP = "SetNTP"; |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 21 | } // namespace |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 22 | |
| 23 | namespace phosphor |
| 24 | { |
| 25 | namespace time |
| 26 | { |
| 27 | |
| 28 | using namespace phosphor::logging; |
| 29 | |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 30 | const std::set<std::string> Manager::managedProperties = {PROPERTY_TIME_MODE, |
| 31 | PROPERTY_TIME_OWNER}; |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 32 | |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 33 | Manager::Manager(sdbusplus::bus::bus& bus) : bus(bus) |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 34 | { |
Lei YU | 710d49b | 2017-08-01 17:10:17 +0800 | [diff] [blame] | 35 | using namespace sdbusplus::bus::match::rules; |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 36 | hostStateChangeMatch = |
| 37 | std::make_unique<decltype(hostStateChangeMatch)::element_type>( |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 38 | bus, propertiesChanged(settings.hostState, settings::hostStateIntf), |
| 39 | std::bind(std::mem_fn(&Manager::onHostStateChanged), this, |
| 40 | std::placeholders::_1)); |
Lei YU | 710d49b | 2017-08-01 17:10:17 +0800 | [diff] [blame] | 41 | settingsMatches.emplace_back( |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 42 | bus, propertiesChanged(settings.timeOwner, settings::timeOwnerIntf), |
| 43 | std::bind(std::mem_fn(&Manager::onSettingsChanged), this, |
| 44 | std::placeholders::_1)); |
Lei YU | 710d49b | 2017-08-01 17:10:17 +0800 | [diff] [blame] | 45 | settingsMatches.emplace_back( |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 46 | bus, propertiesChanged(settings.timeSyncMethod, settings::timeSyncIntf), |
| 47 | std::bind(std::mem_fn(&Manager::onSettingsChanged), this, |
| 48 | std::placeholders::_1)); |
Lei YU | 710d49b | 2017-08-01 17:10:17 +0800 | [diff] [blame] | 49 | |
Lei YU | c6fe869 | 2017-02-23 15:12:07 +0800 | [diff] [blame] | 50 | checkHostOn(); |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 51 | |
| 52 | // Restore settings from persistent storage |
| 53 | restoreSettings(); |
| 54 | |
| 55 | // Check the settings daemon to process the new settings |
Lei YU | 710d49b | 2017-08-01 17:10:17 +0800 | [diff] [blame] | 56 | auto mode = getSetting(settings.timeSyncMethod.c_str(), |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 57 | settings::timeSyncIntf, PROPERTY_TIME_MODE); |
| 58 | auto owner = getSetting(settings.timeOwner.c_str(), settings::timeOwnerIntf, |
Lei YU | 710d49b | 2017-08-01 17:10:17 +0800 | [diff] [blame] | 59 | PROPERTY_TIME_OWNER); |
| 60 | |
| 61 | onPropertyChanged(PROPERTY_TIME_MODE, mode); |
| 62 | onPropertyChanged(PROPERTY_TIME_OWNER, owner); |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | void Manager::addListener(PropertyChangeListner* listener) |
| 66 | { |
| 67 | // Notify listener about the initial value |
| 68 | listener->onModeChanged(timeMode); |
| 69 | listener->onOwnerChanged(timeOwner); |
| 70 | |
| 71 | listeners.insert(listener); |
| 72 | } |
| 73 | |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 74 | void Manager::restoreSettings() |
| 75 | { |
| 76 | auto mode = utils::readData<std::string>(modeFile); |
| 77 | if (!mode.empty()) |
| 78 | { |
Lei YU | ddd5442 | 2017-04-18 16:38:44 +0800 | [diff] [blame] | 79 | timeMode = utils::strToMode(mode); |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 80 | } |
| 81 | auto owner = utils::readData<std::string>(ownerFile); |
| 82 | if (!owner.empty()) |
| 83 | { |
Lei YU | ddd5442 | 2017-04-18 16:38:44 +0800 | [diff] [blame] | 84 | timeOwner = utils::strToOwner(owner); |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 85 | } |
| 86 | } |
| 87 | |
Lei YU | c6fe869 | 2017-02-23 15:12:07 +0800 | [diff] [blame] | 88 | void Manager::checkHostOn() |
| 89 | { |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 90 | using Host = sdbusplus::xyz::openbmc_project::State::server::Host; |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 91 | auto hostService = utils::getService(bus, settings.hostState.c_str(), |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 92 | settings::hostStateIntf); |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 93 | auto stateStr = utils::getProperty<std::string>( |
| 94 | bus, hostService.c_str(), settings.hostState.c_str(), |
| 95 | settings::hostStateIntf, HOST_CURRENT_STATE); |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 96 | auto state = Host::convertHostStateFromString(stateStr); |
| 97 | hostOn = (state == Host::HostState::Running); |
Lei YU | a741713 | 2017-02-23 15:24:05 +0800 | [diff] [blame] | 98 | } |
Lei YU | c6fe869 | 2017-02-23 15:12:07 +0800 | [diff] [blame] | 99 | |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 100 | void Manager::onPropertyChanged(const std::string& key, |
| 101 | const std::string& value) |
| 102 | { |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 103 | if (hostOn) |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 104 | { |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 105 | // If host is on, set the values as requested time mode/owner. |
Gunnar Mills | 7f25c53 | 2017-10-25 20:45:28 -0500 | [diff] [blame] | 106 | // And when host becomes off, notify the listeners. |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 107 | setPropertyAsRequested(key, value); |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 108 | } |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 109 | else |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 110 | { |
Gunnar Mills | 7f25c53 | 2017-10-25 20:45:28 -0500 | [diff] [blame] | 111 | // If host is off, notify listeners |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 112 | if (key == PROPERTY_TIME_MODE) |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 113 | { |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 114 | setCurrentTimeMode(value); |
Lei YU | a5003ce | 2017-02-24 15:35:25 +0800 | [diff] [blame] | 115 | onTimeModeChanged(value); |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 116 | } |
| 117 | else if (key == PROPERTY_TIME_OWNER) |
| 118 | { |
| 119 | setCurrentTimeOwner(value); |
Lei YU | a5003ce | 2017-02-24 15:35:25 +0800 | [diff] [blame] | 120 | onTimeOwnerChanged(); |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
Lei YU | 710d49b | 2017-08-01 17:10:17 +0800 | [diff] [blame] | 125 | int Manager::onSettingsChanged(sdbusplus::message::message& msg) |
| 126 | { |
| 127 | using Interface = std::string; |
| 128 | using Property = std::string; |
| 129 | using Value = std::string; |
| 130 | using Properties = std::map<Property, sdbusplus::message::variant<Value>>; |
| 131 | |
| 132 | Interface interface; |
| 133 | Properties properties; |
| 134 | |
| 135 | msg.read(interface, properties); |
| 136 | |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 137 | for (const auto& p : properties) |
Lei YU | 710d49b | 2017-08-01 17:10:17 +0800 | [diff] [blame] | 138 | { |
| 139 | onPropertyChanged(p.first, p.second.get<std::string>()); |
| 140 | } |
| 141 | |
| 142 | return 0; |
| 143 | } |
| 144 | |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 145 | void Manager::setPropertyAsRequested(const std::string& key, |
| 146 | const std::string& value) |
| 147 | { |
| 148 | if (key == PROPERTY_TIME_MODE) |
| 149 | { |
| 150 | setRequestedMode(value); |
| 151 | } |
| 152 | else if (key == PROPERTY_TIME_OWNER) |
| 153 | { |
| 154 | setRequestedOwner(value); |
| 155 | } |
| 156 | else |
| 157 | { |
| 158 | // The key shall be already the supported one |
Lei YU | 86d8041 | 2017-07-12 13:12:12 +0800 | [diff] [blame] | 159 | using InvalidArgumentError = |
| 160 | sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument; |
| 161 | using namespace xyz::openbmc_project::Common; |
| 162 | elog<InvalidArgumentError>( |
| 163 | InvalidArgument::ARGUMENT_NAME(key.c_str()), |
| 164 | InvalidArgument::ARGUMENT_VALUE(value.c_str())); |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 165 | } |
| 166 | } |
| 167 | |
| 168 | void Manager::setRequestedMode(const std::string& mode) |
| 169 | { |
| 170 | requestedMode = mode; |
| 171 | } |
| 172 | |
| 173 | void Manager::setRequestedOwner(const std::string& owner) |
| 174 | { |
| 175 | requestedOwner = owner; |
| 176 | } |
| 177 | |
Lei YU | a741713 | 2017-02-23 15:24:05 +0800 | [diff] [blame] | 178 | void Manager::updateNtpSetting(const std::string& value) |
| 179 | { |
Lei YU | 710d49b | 2017-08-01 17:10:17 +0800 | [diff] [blame] | 180 | bool isNtp = |
| 181 | (value == "xyz.openbmc_project.Time.Synchronization.Method.NTP"); |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 182 | auto method = bus.new_method_call(SYSTEMD_TIME_SERVICE, SYSTEMD_TIME_PATH, |
| 183 | SYSTEMD_TIME_INTERFACE, METHOD_SET_NTP); |
Lei YU | a741713 | 2017-02-23 15:24:05 +0800 | [diff] [blame] | 184 | method.append(isNtp, false); // isNtp: 'true/false' means Enable/Disable |
| 185 | // 'false' meaning no policy-kit |
| 186 | |
Lei YU | 89efe6e | 2018-07-24 10:38:01 +0800 | [diff] [blame] | 187 | try |
Lei YU | a741713 | 2017-02-23 15:24:05 +0800 | [diff] [blame] | 188 | { |
Lei YU | 89efe6e | 2018-07-24 10:38:01 +0800 | [diff] [blame] | 189 | bus.call_noreply(method); |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 190 | log<level::INFO>("Updated NTP setting", entry("ENABLED=%d", isNtp)); |
Lei YU | a741713 | 2017-02-23 15:24:05 +0800 | [diff] [blame] | 191 | } |
Lei YU | 89efe6e | 2018-07-24 10:38:01 +0800 | [diff] [blame] | 192 | catch (const sdbusplus::exception::SdBusError& ex) |
Lei YU | a741713 | 2017-02-23 15:24:05 +0800 | [diff] [blame] | 193 | { |
Lei YU | 89efe6e | 2018-07-24 10:38:01 +0800 | [diff] [blame] | 194 | log<level::ERR>("Failed to update NTP setting", |
| 195 | entry("ERR=%s", ex.what())); |
Lei YU | a741713 | 2017-02-23 15:24:05 +0800 | [diff] [blame] | 196 | } |
| 197 | } |
| 198 | |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 199 | void Manager::onHostStateChanged(sdbusplus::message::message& msg) |
Lei YU | c6fe869 | 2017-02-23 15:12:07 +0800 | [diff] [blame] | 200 | { |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 201 | using Interface = std::string; |
| 202 | using Property = std::string; |
| 203 | using Value = std::string; |
| 204 | using Properties = std::map<Property, sdbusplus::message::variant<Value>>; |
| 205 | using Host = sdbusplus::xyz::openbmc_project::State::server::Host; |
| 206 | |
| 207 | Interface interface; |
| 208 | Properties properties; |
| 209 | |
| 210 | msg.read(interface, properties); |
| 211 | |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 212 | for (const auto& p : properties) |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 213 | { |
| 214 | if (p.first == HOST_CURRENT_STATE) |
| 215 | { |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 216 | auto state = |
| 217 | Host::convertHostStateFromString(p.second.get<std::string>()); |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 218 | onHostState(state == Host::HostState::Running); |
| 219 | break; |
| 220 | } |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | void Manager::onHostState(bool on) |
| 225 | { |
| 226 | hostOn = on; |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 227 | if (hostOn) |
| 228 | { |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 229 | log<level::INFO>("Changing time settings is *deferred* now"); |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 230 | return; |
| 231 | } |
Lei YU | debe1d8 | 2017-10-13 13:21:37 +0800 | [diff] [blame] | 232 | log<level::INFO>("Changing time settings allowed now"); |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 233 | if (!requestedMode.empty()) |
| 234 | { |
Lei YU | a5003ce | 2017-02-24 15:35:25 +0800 | [diff] [blame] | 235 | if (setCurrentTimeMode(requestedMode)) |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 236 | { |
Lei YU | a5003ce | 2017-02-24 15:35:25 +0800 | [diff] [blame] | 237 | onTimeModeChanged(requestedMode); |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 238 | } |
| 239 | setRequestedMode({}); // Clear requested mode |
| 240 | } |
| 241 | if (!requestedOwner.empty()) |
| 242 | { |
Lei YU | a5003ce | 2017-02-24 15:35:25 +0800 | [diff] [blame] | 243 | if (setCurrentTimeOwner(requestedOwner)) |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 244 | { |
Lei YU | a5003ce | 2017-02-24 15:35:25 +0800 | [diff] [blame] | 245 | onTimeOwnerChanged(); |
Lei YU | 7f4fca5 | 2017-02-23 15:15:51 +0800 | [diff] [blame] | 246 | } |
| 247 | setRequestedOwner({}); // Clear requested owner |
| 248 | } |
Lei YU | c6fe869 | 2017-02-23 15:12:07 +0800 | [diff] [blame] | 249 | } |
| 250 | |
Lei YU | a5003ce | 2017-02-24 15:35:25 +0800 | [diff] [blame] | 251 | bool Manager::setCurrentTimeMode(const std::string& mode) |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 252 | { |
Lei YU | ddd5442 | 2017-04-18 16:38:44 +0800 | [diff] [blame] | 253 | auto newMode = utils::strToMode(mode); |
Lei YU | a5003ce | 2017-02-24 15:35:25 +0800 | [diff] [blame] | 254 | if (newMode != timeMode) |
| 255 | { |
| 256 | log<level::INFO>("Time mode is changed", |
| 257 | entry("MODE=%s", mode.c_str())); |
| 258 | timeMode = newMode; |
| 259 | utils::writeData(modeFile, mode); |
| 260 | return true; |
| 261 | } |
| 262 | else |
| 263 | { |
| 264 | return false; |
| 265 | } |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 266 | } |
| 267 | |
Lei YU | a5003ce | 2017-02-24 15:35:25 +0800 | [diff] [blame] | 268 | bool Manager::setCurrentTimeOwner(const std::string& owner) |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 269 | { |
Lei YU | ddd5442 | 2017-04-18 16:38:44 +0800 | [diff] [blame] | 270 | auto newOwner = utils::strToOwner(owner); |
Lei YU | a5003ce | 2017-02-24 15:35:25 +0800 | [diff] [blame] | 271 | if (newOwner != timeOwner) |
| 272 | { |
| 273 | log<level::INFO>("Time owner is changed", |
| 274 | entry("OWNER=%s", owner.c_str())); |
| 275 | timeOwner = newOwner; |
| 276 | utils::writeData(ownerFile, owner); |
| 277 | return true; |
| 278 | } |
| 279 | else |
| 280 | { |
| 281 | return false; |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | void Manager::onTimeModeChanged(const std::string& mode) |
| 286 | { |
| 287 | for (const auto listener : listeners) |
| 288 | { |
| 289 | listener->onModeChanged(timeMode); |
| 290 | } |
| 291 | // When time_mode is updated, update the NTP setting |
| 292 | updateNtpSetting(mode); |
| 293 | } |
| 294 | |
| 295 | void Manager::onTimeOwnerChanged() |
| 296 | { |
| 297 | for (const auto& listener : listeners) |
| 298 | { |
| 299 | listener->onOwnerChanged(timeOwner); |
| 300 | } |
Lei YU | 415b964 | 2017-02-09 11:37:26 +0800 | [diff] [blame] | 301 | } |
| 302 | |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 303 | std::string Manager::getSetting(const char* path, const char* interface, |
Lei YU | 710d49b | 2017-08-01 17:10:17 +0800 | [diff] [blame] | 304 | const char* setting) const |
| 305 | { |
| 306 | std::string settingManager = utils::getService(bus, path, interface); |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 307 | return utils::getProperty<std::string>(bus, settingManager.c_str(), path, |
| 308 | interface, setting); |
Lei YU | 710d49b | 2017-08-01 17:10:17 +0800 | [diff] [blame] | 309 | } |
| 310 | |
Gunnar Mills | ab4cc6a | 2018-09-14 14:42:39 -0500 | [diff] [blame^] | 311 | } // namespace time |
| 312 | } // namespace phosphor |