diff options
author | Eddie James <eajames@us.ibm.com> | 2019-03-19 20:58:53 +0000 |
---|---|---|
committer | Eddie James <eajames@linux.ibm.com> | 2019-04-09 10:51:20 -0500 |
commit | 774f9af9a2d861f49c878d9eeca9830bef44127b (patch) | |
tree | 6b77eb6565e1f937403dda58296aa0d1493bbdf8 /occ_errors.hpp | |
parent | 577a935e0261e7a316ec7f6ad76b72328d30d2ee (diff) | |
download | openpower-occ-control-774f9af9a2d861f49c878d9eeca9830bef44127b.tar.gz openpower-occ-control-774f9af9a2d861f49c878d9eeca9830bef44127b.zip |
Fix error attribute naming for Linux 5.0
There was a slight change to one of the error attributes as part of the
OCC driver upstreaming process. This commit also adds unit tests for the
error attributes. This required some refactoring to support the unit
tests.
Resolves openbmc/openbmc#3505
Signed-off-by: Eddie James <eajames@us.ibm.com>
Change-Id: I665b46e44b18befc8a728f7246bcda82f1f1a71c
Diffstat (limited to 'occ_errors.hpp')
-rw-r--r-- | occ_errors.hpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/occ_errors.hpp b/occ_errors.hpp index ebacc8a..f623704 100644 --- a/occ_errors.hpp +++ b/occ_errors.hpp @@ -36,7 +36,7 @@ class Error Error(EventPtr& event, const fs::path& file, std::function<void(bool)> callBack = nullptr) : event(event), - file(fs::path(DEV_PATH) / file), callBack(callBack) + file(file), callBack(callBack) { // Nothing to do here. } @@ -49,12 +49,23 @@ class Error } } - /** @brief Starts to monitor for error conditions */ - void addWatch(); + /** @brief Starts to monitor for error conditions + * + * @param[in] poll - Indicates whether or not the error file should + * actually be polled for changes. Disabling polling is + * necessary for error files that don't support the poll + * file operation. + */ + void addWatch(bool poll = true); /** @brief Removes error watch */ void removeWatch(); + inline void setFile(const fs::path& f) + { + file = f; + } + private: /** @brief sd_event wrapped in unique_ptr */ EventPtr& event; @@ -95,7 +106,7 @@ class Error int fd = -1; /** Error file */ - const fs::path file; + fs::path file; /** @brief Optional function to call on error scenario */ std::function<void(bool)> callBack; |