blob: 691cb16207bf7c0b1fc68ed2172d1164ee0f9a9e [file] [log] [blame]
#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::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::findSizeOfBlockDevice(devPath));
}
void verifyPattern(uint64_t driveSize);
};
} // namespace estoraged