Add Erase verifyGeometry

This confirms specified amount of the drive is accessible. The min and
max expected drive size are set as a build configuration, and compared
against the drive size (found by using the linux ioctl). Also adds
testing build files, testing options, and verifyGeometry test.

Tested: Ran eStoraged on a machine with an eMMC, using the following
$ ./eStoraged -b /dev/mmcblk0 &
$ busctl call  xyz.openbmc_project.eStoraged.mmcblk0 \
 /xyz/openbmc_project/storage/mmcblk0 \
 xyz.openbmc_project.eStoraged Erase ays 1 1 \
 xyz.openbmc_project.eStoraged.EraseMethod.VerifyGeometry

Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: Ie47f8666996a6085a115d1b86f2643bc278638c5
diff --git a/include/erase.hpp b/include/erase.hpp
new file mode 100644
index 0000000..699d430
--- /dev/null
+++ b/include/erase.hpp
@@ -0,0 +1,23 @@
+#include <string>
+
+/** @class Erase
+ *  @brief Erase object provides a base class for the specific erase types
+ */
+class Erase
+{
+  public:
+    /** @brief creates an erase object
+     *  @param inDevPath the linux path for the block device
+     */
+    Erase(std::string_view inDevPath) : devPath(inDevPath)
+    {}
+
+    /** @brief finds the size of the linux block device in bytes
+     *  @return size of a block device using the devPath
+     */
+    uint64_t findSizeOfBlockDevice();
+
+  protected:
+    /* The linux path for the block device */
+    std::string devPath;
+};
diff --git a/include/meson.build b/include/meson.build
index da1595b..b879ead 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -1,2 +1,13 @@
 
 eStoraged_headers = include_directories('.')
+
+conf_data = configuration_data()
+# If the number of drives increases we plan to switch to a config file design
+# in which, the max and min size are read and parsed for a config file at
+# verification time.
+conf_data.set('ERASE_MAX_GEOMETRY', get_option('erase_max_geometry'))
+conf_data.set('ERASE_MIN_GEOMETRY', get_option('erase_min_geometry'))
+
+configure_file(
+  output: 'estoraged_conf.hpp',
+  configuration: conf_data)
diff --git a/include/verifyDriveGeometry.hpp b/include/verifyDriveGeometry.hpp
new file mode 100644
index 0000000..3b16641
--- /dev/null
+++ b/include/verifyDriveGeometry.hpp
@@ -0,0 +1,23 @@
+#pragma once
+
+#include "erase.hpp"
+
+#include <string_view>
+
+class VerifyDriveGeometry : public Erase
+{
+  public:
+    /** @brief Creates a verifyDriveGeomentry erase object.
+     *
+     *  @param[in] inDevPath - the linux device path for the block device.
+     */
+    VerifyDriveGeometry(std::string_view inDevPath) : Erase(inDevPath)
+    {}
+
+    /** @brief Test if input is in between the max and min expected sizes,
+     * and throws errors accordingly.
+     *
+     *  @param[in] bytes - Size of the block device
+     */
+    void geometryOkay(uint64_t bytes);
+};