Get eraseMaxGeometry and eraseMinGeometry from dbus

Also, make findDevice return output parameters based on RVO.

With the change like in EntityManager JSON:
```
{
    "Name": "example_emmc",
    "Type": "EmmcDevice",
    "LocationCode": "location"
    "EraseMaxGeometry": 10000000000,
    "EraseMinGeometry": 5000000000,
}
```
and geometry values will be set to estoraged.

Tested:
- unit test pass:
```
5/7 util_test                        OK              0.05s
```

Change-Id: Ia8499af2168c7e740558978273fc80456eb29282
Signed-off-by: Tom Tung <shes050117@gmail.com>
diff --git a/src/util.cpp b/src/util.cpp
index 2f32c02..d32d59c 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -1,5 +1,6 @@
 #include "util.hpp"
 
+#include "estoraged_conf.hpp"
 #include "getConfig.hpp"
 
 #include <linux/fs.h>
@@ -13,6 +14,7 @@
 #include <filesystem>
 #include <fstream>
 #include <iostream>
+#include <optional>
 #include <string>
 
 namespace estoraged
@@ -142,10 +144,8 @@
     return serialNumber;
 }
 
-bool findDevice(const StorageData& data, const std::filesystem::path& searchDir,
-                std::filesystem::path& deviceFile,
-                std::filesystem::path& sysfsDir, std::string& luksName,
-                std::string& locationCode)
+std::optional<DeviceInfo> findDevice(const StorageData& data,
+                                     const std::filesystem::path& searchDir)
 {
     /* Check what type of storage device this is. */
     estoraged::BasicVariantType typeVariant;
@@ -158,10 +158,11 @@
     {
         lg2::error("Could not read device type", "REDFISH_MESSAGE_ID",
                    std::string("OpenBMC.0.1.FindDeviceFail"));
-        return false;
+        return std::nullopt;
     }
 
     /* Check if location code/ silkscreen name is provided for the drive. */
+    std::string locationCode;
     auto findLocationCode = data.find("LocationCode");
     if (findLocationCode != data.end())
     {
@@ -173,6 +174,34 @@
         }
     }
 
+    /* Check if EraseMaxGeometry is provided. */
+    uint64_t eraseMaxGeometry = ERASE_MAX_GEOMETRY;
+    auto findEraseMaxGeometry = data.find("EraseMaxGeometry");
+    if (findEraseMaxGeometry != data.end())
+    {
+        const auto* eraseMaxGeometryPtr =
+            std::get_if<uint64_t>(&findEraseMaxGeometry->second);
+        if (eraseMaxGeometryPtr != nullptr)
+        {
+            lg2::info("eStorageD new eraseMaxGeometry found on system");
+            eraseMaxGeometry = *eraseMaxGeometryPtr;
+        }
+    }
+
+    /* Check if EraseMinGeometry is provided. */
+    uint64_t eraseMinGeometry = ERASE_MIN_GEOMETRY;
+    auto findEraseMinGeometry = data.find("EraseMinGeometry");
+    if (findEraseMinGeometry != data.end())
+    {
+        const auto* eraseMinGeometryPtr =
+            std::get_if<uint64_t>(&findEraseMinGeometry->second);
+        if (eraseMinGeometryPtr != nullptr)
+        {
+            lg2::info("eStorageD new eraseMinGeometry found on system");
+            eraseMinGeometry = *eraseMinGeometryPtr;
+        }
+    }
+
     /*
      * Currently, we only support eMMC, so report an error for any other device
      * types.
@@ -183,7 +212,7 @@
         lg2::error("Unsupported device type {TYPE}", "TYPE", type,
                    "REDFISH_MESSAGE_ID",
                    std::string("OpenBMC.0.1.FindDeviceFail"));
-        return false;
+        return std::nullopt;
     }
 
     /* Look for the eMMC in the specified searchDir directory. */
@@ -211,14 +240,16 @@
                 /* Found it. Get the sysfs directory and device file. */
                 std::filesystem::path deviceName(dirEntry.path().filename());
 
-                sysfsDir = dirEntry.path();
+                std::filesystem::path sysfsDir = dirEntry.path();
                 sysfsDir /= "device";
 
-                deviceFile = "/dev";
+                std::filesystem::path deviceFile = "/dev";
                 deviceFile /= deviceName;
 
-                luksName = "luks-" + deviceName.string();
-                return true;
+                std::string luksName = "luks-" + deviceName.string();
+                return DeviceInfo{deviceFile,       sysfsDir,
+                                  luksName,         locationCode,
+                                  eraseMaxGeometry, eraseMinGeometry};
             }
         }
         catch (...)
@@ -234,7 +265,7 @@
     }
 
     /* Device wasn't found. */
-    return false;
+    return std::nullopt;
 }
 
 } // namespace util