sysfs.cpp (2f370c4e351adb90dc218d719b962cb841a399eb) | sysfs.cpp (1e6324fa4fc233c3f2913b3d5278aa06e45ff42f) |
---|---|
1/** 2 * Copyright © 2016 IBM Corporation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 --- 13 unchanged lines hidden (view full) --- 22#include <xyz/openbmc_project/Sensor/Device/error.hpp> 23#include "sysfs.hpp" 24#include "util.hpp" 25#include <fstream> 26 27using namespace phosphor::logging; 28namespace fs = std::experimental::filesystem; 29 | 1/** 2 * Copyright © 2016 IBM Corporation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 --- 13 unchanged lines hidden (view full) --- 22#include <xyz/openbmc_project/Sensor/Device/error.hpp> 23#include "sysfs.hpp" 24#include "util.hpp" 25#include <fstream> 26 27using namespace phosphor::logging; 28namespace fs = std::experimental::filesystem; 29 |
30namespace sysfs { 31 |
|
30static constexpr auto ofRoot = "/sys/firmware/devicetree/base"; 31 32/** 33 * @brief Return the path to the phandle file matching value in io-channels. 34 * 35 * This function will take two passed in paths. 36 * One path is used to find the io-channels file. 37 * The other path is used to find the phandle file. --- 150 unchanged lines hidden (view full) --- 188 // errors if the object disappears when it should not. 189 if (rc == ENOENT) 190 { 191 exit(0); 192 } 193 instancePath /= "device"; 194 auto callOutPath = findCalloutPath(fs::canonical(instancePath)); 195 using namespace sdbusplus::xyz::openbmc_project::Sensor::Device::Error; | 32static constexpr auto ofRoot = "/sys/firmware/devicetree/base"; 33 34/** 35 * @brief Return the path to the phandle file matching value in io-channels. 36 * 37 * This function will take two passed in paths. 38 * One path is used to find the io-channels file. 39 * The other path is used to find the phandle file. --- 150 unchanged lines hidden (view full) --- 190 // errors if the object disappears when it should not. 191 if (rc == ENOENT) 192 { 193 exit(0); 194 } 195 instancePath /= "device"; 196 auto callOutPath = findCalloutPath(fs::canonical(instancePath)); 197 using namespace sdbusplus::xyz::openbmc_project::Sensor::Device::Error; |
196 report<ReadFailure>( | 198 199 // this throws a ReadFailure. 200 elog<ReadFailure>( |
197 xyz::openbmc_project::Sensor::Device:: 198 ReadFailure::CALLOUT_ERRNO(rc), 199 xyz::openbmc_project::Sensor::Device:: 200 ReadFailure::CALLOUT_DEVICE_PATH( 201 fs::canonical(callOutPath).c_str())); | 201 xyz::openbmc_project::Sensor::Device:: 202 ReadFailure::CALLOUT_ERRNO(rc), 203 xyz::openbmc_project::Sensor::Device:: 204 ReadFailure::CALLOUT_DEVICE_PATH( 205 fs::canonical(callOutPath).c_str())); |
202 203 exit(EXIT_FAILURE); | |
204 } 205 206 return value; 207} 208 209uint64_t writeSysfsWithCallout(const uint64_t& value, 210 const std::string& root, 211 const std::string& instance, --- 34 unchanged lines hidden (view full) --- 246 fs::canonical(callOutPath).c_str())); 247 248 exit(EXIT_FAILURE); 249 } 250 251 return value; 252} 253 | 206 } 207 208 return value; 209} 210 211uint64_t writeSysfsWithCallout(const uint64_t& value, 212 const std::string& root, 213 const std::string& instance, --- 34 unchanged lines hidden (view full) --- 248 fs::canonical(callOutPath).c_str())); 249 250 exit(EXIT_FAILURE); 251 } 252 253 return value; 254} 255 |
256} |
|
254// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 | 257// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 |