blob: b64eff7fe46ca42832f520133f83188f4aea3814 [file] [log] [blame]
John Edward Broadbent7f2ab642021-11-11 21:00:38 -08001#pragma once
2
3#include "erase.hpp"
4
5#include <stdplus/fd/create.hpp>
6#include <stdplus/fd/managed.hpp>
7
8#include <span>
9#include <string>
10
11using stdplus::fd::ManagedFd;
12
13class Pattern : public Erase
14{
15 public:
16 /** @brief Creates a pattern erase object.
17 *
18 * @param[in] inDevPath - the linux device path for the block device.
19 */
20 Pattern(std::string_view inDevPath) : Erase(inDevPath)
21 {}
22
23 /** @brief writes an uncompressible random pattern to the drive
24 * and throws errors accordingly.
25 *
26 * @param[in] bytes - Size of the block device
John Edward Broadbent7f2ab642021-11-11 21:00:38 -080027 */
John Edward Broadbent69786762022-01-21 14:16:23 -080028 void writePattern(uint64_t driveSize);
John Edward Broadbent7f2ab642021-11-11 21:00:38 -080029
30 /** @brief verifies the uncompressible random pattern is on the drive
31 * and throws errors accordingly.
32 *
33 * @param[in] bytes - Size of the block device
John Edward Broadbent7f2ab642021-11-11 21:00:38 -080034 */
John Edward Broadbent69786762022-01-21 14:16:23 -080035 void verifyPattern(uint64_t driveSize);
John Edward Broadbent7f2ab642021-11-11 21:00:38 -080036};