estoraged.cpp (19825057f05902e74df392b54d959551d3dcd914) estoraged.cpp (ff1b64f0e891de0d3cab831f6b90b52bb61de4b1)
1
2#include "estoraged.hpp"
3
4#include "cryptErase.hpp"
5#include "cryptsetupInterface.hpp"
6#include "pattern.hpp"
7#include "sanitize.hpp"
8#include "verifyDriveGeometry.hpp"

--- 44 unchanged lines hidden (view full) ---

53 deviceName;
54
55 /* Add Volume interface. */
56 volumeInterface = objectServer.add_interface(
57 objectPath, "xyz.openbmc_project.Inventory.Item.Volume");
58 volumeInterface->register_method(
59 "FormatLuks", [this](const std::vector<uint8_t>& password,
60 Volume::FilesystemType type) {
1
2#include "estoraged.hpp"
3
4#include "cryptErase.hpp"
5#include "cryptsetupInterface.hpp"
6#include "pattern.hpp"
7#include "sanitize.hpp"
8#include "verifyDriveGeometry.hpp"

--- 44 unchanged lines hidden (view full) ---

53 deviceName;
54
55 /* Add Volume interface. */
56 volumeInterface = objectServer.add_interface(
57 objectPath, "xyz.openbmc_project.Inventory.Item.Volume");
58 volumeInterface->register_method(
59 "FormatLuks", [this](const std::vector<uint8_t>& password,
60 Volume::FilesystemType type) {
61 this->formatLuks(password, type);
62 });
63 volumeInterface->register_method("Erase",
64 [this](Volume::EraseMethod eraseType) {
65 this->erase(eraseType);
61 this->formatLuks(password, type);
66 });
62 });
63 volumeInterface->register_method(
64 "Erase",
65 [this](Volume::EraseMethod eraseType) { this->erase(eraseType); });
67 volumeInterface->register_method("Lock", [this]() { this->lock(); });
66 volumeInterface->register_method("Lock", [this]() { this->lock(); });
68 volumeInterface->register_method("Unlock",
69 [this](std::vector<uint8_t>& password) {
70 this->unlock(password);
71 });
72 volumeInterface->register_method(
67 volumeInterface->register_method(
68 "Unlock",
69 [this](std::vector<uint8_t>& password) { this->unlock(password); });
70 volumeInterface->register_method(
73 "ChangePassword", [this](const std::vector<uint8_t>& oldPassword,
74 const std::vector<uint8_t>& newPassword) {
71 "ChangePassword", [this](const std::vector<uint8_t>& oldPassword,
72 const std::vector<uint8_t>& newPassword) {
75 this->changePassword(oldPassword, newPassword);
76 });
73 this->changePassword(oldPassword, newPassword);
74 });
77 volumeInterface->register_property_r(
78 "Locked", lockedProperty, sdbusplus::vtable::property_::emits_change,
79 [this](bool& value) {
80 value = this->isLocked();
81 return value;
75 volumeInterface->register_property_r(
76 "Locked", lockedProperty, sdbusplus::vtable::property_::emits_change,
77 [this](bool& value) {
78 value = this->isLocked();
79 return value;
82 });
80 });
83
84 /* Add Drive interface. */
85 driveInterface = objectServer.add_interface(
86 objectPath, "xyz.openbmc_project.Inventory.Item.Drive");
87 driveInterface->register_property("Capacity", size);
88 driveInterface->register_property("PredictedMediaLifeLeftPercent",
89 lifeTime);
90 /* This registers the Locked property for the Drives interface.
91 * Now it is the same as the volume Locked property */
92 driveInterface->register_property_r(
93 "Locked", lockedProperty, sdbusplus::vtable::property_::emits_change,
94 [this](bool& value) {
95 value = this->isLocked();
96 return value;
81
82 /* Add Drive interface. */
83 driveInterface = objectServer.add_interface(
84 objectPath, "xyz.openbmc_project.Inventory.Item.Drive");
85 driveInterface->register_property("Capacity", size);
86 driveInterface->register_property("PredictedMediaLifeLeftPercent",
87 lifeTime);
88 /* This registers the Locked property for the Drives interface.
89 * Now it is the same as the volume Locked property */
90 driveInterface->register_property_r(
91 "Locked", lockedProperty, sdbusplus::vtable::property_::emits_change,
92 [this](bool& value) {
93 value = this->isLocked();
94 return value;
97 });
95 });
98
99 driveInterface->register_property_r(
100 "EncryptionStatus", encryptionStatus,
101 sdbusplus::vtable::property_::emits_change,
102 [this](Drive::DriveEncryptionState& value) {
103 value = this->findEncryptionStatus();
104 return value;
96
97 driveInterface->register_property_r(
98 "EncryptionStatus", encryptionStatus,
99 sdbusplus::vtable::property_::emits_change,
100 [this](Drive::DriveEncryptionState& value) {
101 value = this->findEncryptionStatus();
102 return value;
105 });
103 });
106
107 embeddedLocationInterface = objectServer.add_interface(
108 objectPath, "xyz.openbmc_project.Inventory.Connector.Embedded");
109
110 if (!locationCode.empty())
111 {
112 locationCodeInterface = objectServer.add_interface(
113 objectPath, "xyz.openbmc_project.Inventory.Decorator.LocationCode");

--- 403 unchanged lines hidden ---
104
105 embeddedLocationInterface = objectServer.add_interface(
106 objectPath, "xyz.openbmc_project.Inventory.Connector.Embedded");
107
108 if (!locationCode.empty())
109 {
110 locationCodeInterface = objectServer.add_interface(
111 objectPath, "xyz.openbmc_project.Inventory.Decorator.LocationCode");

--- 403 unchanged lines hidden ---