blob: f447e738f8408927e5800f12a47d481697bd730a [file] [log] [blame]
Saqib Khan5d532672017-08-09 10:44:50 -05001#pragma once
2
Saqib Khan5d532672017-08-09 10:44:50 -05003#include "config.h"
4
Adriana Kobylakec4eec32019-11-13 14:28:35 -06005#include "version.hpp"
6
Andrew Geissler9155b712020-05-16 13:04:44 -05007#include <string>
Gunnar Millsb0ce9962018-09-07 13:39:10 -05008
Saqib Khan5d532672017-08-09 10:44:50 -05009namespace phosphor
10{
11namespace software
12{
13namespace updater
14{
15
Adriana Kobylakec4eec32019-11-13 14:28:35 -060016using VersionPurpose =
17 sdbusplus::xyz::openbmc_project::Software::server::Version::VersionPurpose;
Saqib Khan5d532672017-08-09 10:44:50 -050018
Adriana Kobylak687e75e2019-11-07 11:23:25 -060019/** @brief Serialization function - stores priority information to file
Adriana Kobylak780220f2022-01-18 20:01:53 +000020 * @param[in] flashId - The flash id of the version for which to store
21 * information.
Saqib Khan5d532672017-08-09 10:44:50 -050022 * @param[in] priority - RedundancyPriority value for that version.
23 **/
Adriana Kobylak780220f2022-01-18 20:01:53 +000024void storePriority(const std::string& flashId, uint8_t priority);
Saqib Khan5d532672017-08-09 10:44:50 -050025
Adriana Kobylakec4eec32019-11-13 14:28:35 -060026/** @brief Serialization function - stores purpose information to file
Adriana Kobylak780220f2022-01-18 20:01:53 +000027 * @param[in] flashId - The flash id of the version for which to store
28 * information.
Adriana Kobylakec4eec32019-11-13 14:28:35 -060029 * @param[in] purpose - VersionPurpose value for that version.
30 **/
Adriana Kobylak780220f2022-01-18 20:01:53 +000031void storePurpose(const std::string& flashId, VersionPurpose purpose);
Adriana Kobylakec4eec32019-11-13 14:28:35 -060032
Adriana Kobylak687e75e2019-11-07 11:23:25 -060033/** @brief Serialization function - restores priority information from file
Adriana Kobylak780220f2022-01-18 20:01:53 +000034 * @param[in] flashId - The flash id of the version for which to retrieve
35 * information.
Saqib Khan5d532672017-08-09 10:44:50 -050036 * @param[in] priority - RedundancyPriority reference for that version.
Saqib Khan1eef62d2017-08-10 15:29:34 -050037 * @return true if restore was successful, false if not
Saqib Khan5d532672017-08-09 10:44:50 -050038 **/
Adriana Kobylak780220f2022-01-18 20:01:53 +000039bool restorePriority(const std::string& flashId, uint8_t& priority);
Saqib Khan5d532672017-08-09 10:44:50 -050040
Adriana Kobylakec4eec32019-11-13 14:28:35 -060041/** @brief Serialization function - restores purpose information from file
Adriana Kobylak780220f2022-01-18 20:01:53 +000042 * @param[in] flashId - The flash id of the version for which to retrieve
43 * information.
Adriana Kobylakec4eec32019-11-13 14:28:35 -060044 * @param[in] purpose - VersionPurpose reference for that version.
45 * @return true if restore was successful, false if not
46 **/
Adriana Kobylak780220f2022-01-18 20:01:53 +000047bool restorePurpose(const std::string& flashId, VersionPurpose& purpose);
Adriana Kobylakec4eec32019-11-13 14:28:35 -060048
Adriana Kobylak687e75e2019-11-07 11:23:25 -060049/** @brief Removes the serial directory for a given version.
Adriana Kobylak780220f2022-01-18 20:01:53 +000050 * @param[in] flash Id - The flash id of the version for which to remove a
51 * file, if it exists.
Saqib Khan5d532672017-08-09 10:44:50 -050052 **/
Adriana Kobylak780220f2022-01-18 20:01:53 +000053void removePersistDataDirectory(const std::string& flashId);
Saqib Khan5d532672017-08-09 10:44:50 -050054
Gunnar Millsfa34e022018-09-04 10:05:45 -050055} // namespace updater
Saqib Khan5d532672017-08-09 10:44:50 -050056} // namespace software
Gunnar Millsfa34e022018-09-04 10:05:45 -050057} // namespace phosphor