Add lifetime property for drives interface
This will set the lifetime property when the eStoraged object is
created. This change does not expect the lifetime to change.
Tested:
busctl introspect xyz.openbmc_project.eStoraged.mmcblk0 /xyz/openbmc_project/inventory/storage/mmcblk0
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
org.freedesktop.DBus.Introspectable interface - - -
.Introspect method - s -
org.freedesktop.DBus.Peer interface - - -
.GetMachineId method - s -
.Ping method - - -
org.freedesktop.DBus.Properties interface - - -
.Get method ss v -
.GetAll method s a{sv} -
.Set method ssv - -
.PropertiesChanged signal sa{sv}as - -
xyz.openbmc_project.Inventory.Item.Drive interface - - -
.Capacity property t (top secret) emits-change
.PredictedMediaLifeLeftPercent property y 100 emits-change
xyz.openbmc_project.Inventory.Item.Volume interface - - -
.ChangePassword method ayay - -
.Erase method s - -
.FormatLuks method ays - -
.Lock method - - -
.Unlock method ay - -
Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: Ifbbed7d81c55e3edbe519c2b1048b5d1731fbb0e
diff --git a/include/estoraged.hpp b/include/estoraged.hpp
index aa89bee..c160fb1 100644
--- a/include/estoraged.hpp
+++ b/include/estoraged.hpp
@@ -2,6 +2,7 @@
#include "cryptsetupInterface.hpp"
#include "filesystemInterface.hpp"
+#include "util.hpp"
#include <libcryptsetup.h>
@@ -36,6 +37,8 @@
* @param[in] server - sdbusplus asio object server
* @param[in] devPath - path to device file, e.g. /dev/mmcblk0
* @param[in] luksName - name for the LUKS container
+ * @param[in] size - size of the drive in bytes
+ * @param[in] lifeTime - percent of lifetime remaining for a drive
* @param[in] cryptInterface - (optional) pointer to CryptsetupInterface
* object
* @param[in] fsInterface - (optional) pointer to FilesystemInterface
@@ -43,7 +46,7 @@
*/
EStoraged(sdbusplus::asio::object_server& server,
const std::string& devPath, const std::string& luksName,
- uint64_t size,
+ uint64_t size, uint8_t lifeTime,
std::unique_ptr<CryptsetupInterface> cryptInterface =
std::make_unique<Cryptsetup>(),
std::unique_ptr<FilesystemInterface> fsInterface =