Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 3 | #include "config.h" |
| 4 | |
Adriana Kobylak | ec4eec3 | 2019-11-13 14:28:35 -0600 | [diff] [blame] | 5 | #include "version.hpp" |
| 6 | |
Andrew Geissler | 9155b71 | 2020-05-16 13:04:44 -0500 | [diff] [blame] | 7 | #include <string> |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 8 | |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 9 | namespace phosphor |
| 10 | { |
| 11 | namespace software |
| 12 | { |
| 13 | namespace updater |
| 14 | { |
| 15 | |
Adriana Kobylak | ec4eec3 | 2019-11-13 14:28:35 -0600 | [diff] [blame] | 16 | using VersionPurpose = |
Patrick Williams | 1e9a5f1 | 2023-08-23 16:53:06 -0500 | [diff] [blame] | 17 | sdbusplus::server::xyz::openbmc_project::software::Version::VersionPurpose; |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 18 | |
Adriana Kobylak | 687e75e | 2019-11-07 11:23:25 -0600 | [diff] [blame] | 19 | /** @brief Serialization function - stores priority information to file |
Adriana Kobylak | 780220f | 2022-01-18 20:01:53 +0000 | [diff] [blame] | 20 | * @param[in] flashId - The flash id of the version for which to store |
| 21 | * information. |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 22 | * @param[in] priority - RedundancyPriority value for that version. |
| 23 | **/ |
Adriana Kobylak | 780220f | 2022-01-18 20:01:53 +0000 | [diff] [blame] | 24 | void storePriority(const std::string& flashId, uint8_t priority); |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 25 | |
Adriana Kobylak | ec4eec3 | 2019-11-13 14:28:35 -0600 | [diff] [blame] | 26 | /** @brief Serialization function - stores purpose information to file |
Adriana Kobylak | 780220f | 2022-01-18 20:01:53 +0000 | [diff] [blame] | 27 | * @param[in] flashId - The flash id of the version for which to store |
| 28 | * information. |
Adriana Kobylak | ec4eec3 | 2019-11-13 14:28:35 -0600 | [diff] [blame] | 29 | * @param[in] purpose - VersionPurpose value for that version. |
| 30 | **/ |
Adriana Kobylak | 780220f | 2022-01-18 20:01:53 +0000 | [diff] [blame] | 31 | void storePurpose(const std::string& flashId, VersionPurpose purpose); |
Adriana Kobylak | ec4eec3 | 2019-11-13 14:28:35 -0600 | [diff] [blame] | 32 | |
Adriana Kobylak | 687e75e | 2019-11-07 11:23:25 -0600 | [diff] [blame] | 33 | /** @brief Serialization function - restores priority information from file |
Adriana Kobylak | 780220f | 2022-01-18 20:01:53 +0000 | [diff] [blame] | 34 | * @param[in] flashId - The flash id of the version for which to retrieve |
| 35 | * information. |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 36 | * @param[in] priority - RedundancyPriority reference for that version. |
Saqib Khan | 1eef62d | 2017-08-10 15:29:34 -0500 | [diff] [blame] | 37 | * @return true if restore was successful, false if not |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 38 | **/ |
Adriana Kobylak | 780220f | 2022-01-18 20:01:53 +0000 | [diff] [blame] | 39 | bool restorePriority(const std::string& flashId, uint8_t& priority); |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 40 | |
Adriana Kobylak | ec4eec3 | 2019-11-13 14:28:35 -0600 | [diff] [blame] | 41 | /** @brief Serialization function - restores purpose information from file |
Adriana Kobylak | 780220f | 2022-01-18 20:01:53 +0000 | [diff] [blame] | 42 | * @param[in] flashId - The flash id of the version for which to retrieve |
| 43 | * information. |
Adriana Kobylak | ec4eec3 | 2019-11-13 14:28:35 -0600 | [diff] [blame] | 44 | * @param[in] purpose - VersionPurpose reference for that version. |
| 45 | * @return true if restore was successful, false if not |
| 46 | **/ |
Adriana Kobylak | 780220f | 2022-01-18 20:01:53 +0000 | [diff] [blame] | 47 | bool restorePurpose(const std::string& flashId, VersionPurpose& purpose); |
Adriana Kobylak | ec4eec3 | 2019-11-13 14:28:35 -0600 | [diff] [blame] | 48 | |
Adriana Kobylak | 687e75e | 2019-11-07 11:23:25 -0600 | [diff] [blame] | 49 | /** @brief Removes the serial directory for a given version. |
Adriana Kobylak | 780220f | 2022-01-18 20:01:53 +0000 | [diff] [blame] | 50 | * @param[in] flash Id - The flash id of the version for which to remove a |
| 51 | * file, if it exists. |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 52 | **/ |
Adriana Kobylak | 780220f | 2022-01-18 20:01:53 +0000 | [diff] [blame] | 53 | void removePersistDataDirectory(const std::string& flashId); |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 54 | |
Gunnar Mills | fa34e02 | 2018-09-04 10:05:45 -0500 | [diff] [blame] | 55 | } // namespace updater |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 56 | } // namespace software |
Gunnar Mills | fa34e02 | 2018-09-04 10:05:45 -0500 | [diff] [blame] | 57 | } // namespace phosphor |