blob: 8e79d1df1fcb7a42ce8c2b3a38ba1a679251daba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#pragma once
#include <sdbusplus/server.hpp>
#include "activation.hpp"
namespace openpower
{
namespace software
{
namespace updater
{
/** @class ItemUpdater
* @brief Manages the activation of the version items.
*/
class ItemUpdater
{
public:
ItemUpdater() = delete;
~ItemUpdater() = default;
ItemUpdater(const ItemUpdater&) = delete;
ItemUpdater& operator=(const ItemUpdater&) = delete;
ItemUpdater(ItemUpdater&&) = delete;
ItemUpdater& operator=(ItemUpdater&&) = delete;
/** @brief Constructs ItemUpdater
*
* @param[in] bus - The Dbus bus object
*/
ItemUpdater(sdbusplus::bus::bus& bus) :
busItem(bus),
versionMatch(
bus,
"type='signal',"
"member='InterfacesAdded',"
"path='/xyz/openbmc_project/software',"
"interface='org.freedesktop.DBus.ObjectManager'",
createActivation,
this)
{
}
private:
/** @brief Callback function for Software.Version match.
* @details Creates an Activation dbus object.
*
* @param[in] msg - Data associated with subscribed signal
* @param[in] userData - Pointer to this object instance
* @param[out] retError - Required param
*/
static int createActivation(sd_bus_message* msg,
void* userData,
sd_bus_error* retError);
/**
* @brief Get the extended version from the specified file.
*
* @param[in] manifestFilePath - File to read.
*
* @return The extended version.
*/
static std::string getExtendedVersion(const std::string&
manifestFilePath);
/**
* @brief Validates the presence of SquashFS iamge in the image dir.
*
* @param[in] versionId - The software version ID.
* @param[out] result - 0 --> if validation was successful
* - -1--> Otherwise
*/
static int validateSquashFSImage(const std::string& versionId);
/** @brief Persistent sdbusplus DBus bus connection. */
sdbusplus::bus::bus& busItem;
/** @brief Persistent map of Activation dbus objects and their
* version id */
std::map<std::string, std::unique_ptr<Activation>> activations;
/** @brief sdbusplus signal match for Software.Version */
sdbusplus::server::match::match versionMatch;
};
} // namespace updater
} // namespace software
} // namespace openpower
|