Add pattern write and verify to erase

The goals are to write a non-compressible and verifiable pattern to the
drive as a means to validate that the drive is working, and ensure all
blocks have been overwritten.

Tested:
$ systemctl stop emmc.service
$ ./eStoraged  -b /dev/mmcblk0&
$busctl call xyz.openbmc_project.eStoraged.mmcblk0 /xyz/openbmc_project/storage/mmcblk0 xyz.openbmc_project.Inventory.Item.Volume Erase s xyz.openbmc_project.Inventory.Item.Volume.EraseMethod.LogicalOverWrite --timeout=1200

$busctl call xyz.openbmc_project.eStoraged.mmcblk0 /xyz/openbmc_project/storage/mmcblk0 xyz.openbmc_project.Inventory.Item.Volume Erase s xyz.openbmc_project.Inventory.Item.Volume.EraseMethod.LogicalVerify --timeout=1200

$echo "jebr" > /dev/mmcblk0

$busctl call xyz.openbmc_project.eStoraged.mmcblk0 /xyz/openbmc_project/storage/mmcblk0 xyz.openbmc_project.Inventory.Item.Volume Erase s xyz.openbmc_project.Inventory.Item.Volume.EraseMethod.LogicalVerify --timeout=1200
Call failed: The operation failed internally.

Change-Id: Ibc1254279b1f46246eb37056ea6e4e1a57159bb9
Signed-off-by: John Edward Broadbent <jebr@google.com>
diff --git a/include/pattern.hpp b/include/pattern.hpp
new file mode 100644
index 0000000..8c5b7d1
--- /dev/null
+++ b/include/pattern.hpp
@@ -0,0 +1,38 @@
+#pragma once
+
+#include "erase.hpp"
+
+#include <stdplus/fd/create.hpp>
+#include <stdplus/fd/managed.hpp>
+
+#include <span>
+#include <string>
+
+using stdplus::fd::ManagedFd;
+
+class Pattern : public Erase
+{
+  public:
+    /** @brief Creates a pattern erase object.
+     *
+     *  @param[in] inDevPath - the linux device path for the block device.
+     */
+    Pattern(std::string_view inDevPath) : Erase(inDevPath)
+    {}
+
+    /** @brief writes an uncompressible random pattern to the drive
+     * and throws errors accordingly.
+     *
+     *  @param[in] bytes - Size of the block device
+     *  @param[in] managedFd - the file descriptor for the open drive
+     */
+    void writePattern(uint64_t driveSize, ManagedFd& fd);
+
+    /** @brief verifies the uncompressible random pattern is on the drive
+     * and throws errors accordingly.
+     *
+     *  @param[in] bytes - Size of the block device
+     *  @param[in] managedFd - the file descriptor for the open drive
+     */
+    void verifyPattern(uint64_t driveSize, ManagedFd& fd);
+};