| #pragma once |
| |
| #include "erase.hpp" |
| #include "util.hpp" |
| |
| #include <stdplus/fd/create.hpp> |
| #include <stdplus/fd/managed.hpp> |
| |
| #include <span> |
| #include <string> |
| |
| namespace estoraged |
| { |
| 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 |
| */ |
| void writePattern() |
| { |
| writePattern(util::Util::findSizeOfBlockDevice(devPath)); |
| } |
| |
| void writePattern(uint64_t driveSize); |
| |
| /** @brief verifies the uncompressible random pattern is on the drive |
| * and throws errors accordingly. |
| * |
| * @param[in] bytes - Size of the block device |
| */ |
| |
| void verifyPattern() |
| { |
| verifyPattern(util::Util::findSizeOfBlockDevice(devPath)); |
| } |
| void verifyPattern(uint64_t driveSize); |
| }; |
| |
| } // namespace estoraged |