John Edward Broadbent | 7f2ab64 | 2021-11-11 21:00:38 -0800 | [diff] [blame] | 1 | #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 | |
John Edward Broadbent | d3bfa7b | 2022-01-13 17:41:32 -0800 | [diff] [blame] | 11 | namespace estoraged |
| 12 | { |
John Edward Broadbent | 7f2ab64 | 2021-11-11 21:00:38 -0800 | [diff] [blame] | 13 | using stdplus::fd::ManagedFd; |
| 14 | |
| 15 | class Pattern : public Erase |
| 16 | { |
| 17 | public: |
| 18 | /** @brief Creates a pattern erase object. |
| 19 | * |
| 20 | * @param[in] inDevPath - the linux device path for the block device. |
| 21 | */ |
| 22 | Pattern(std::string_view inDevPath) : Erase(inDevPath) |
| 23 | {} |
| 24 | |
| 25 | /** @brief writes an uncompressible random pattern to the drive |
| 26 | * and throws errors accordingly. |
| 27 | * |
| 28 | * @param[in] bytes - Size of the block device |
John Edward Broadbent | 7f2ab64 | 2021-11-11 21:00:38 -0800 | [diff] [blame] | 29 | */ |
John Edward Broadbent | 6978676 | 2022-01-21 14:16:23 -0800 | [diff] [blame] | 30 | void writePattern(uint64_t driveSize); |
John Edward Broadbent | 7f2ab64 | 2021-11-11 21:00:38 -0800 | [diff] [blame] | 31 | |
| 32 | /** @brief verifies the uncompressible random pattern is on the drive |
| 33 | * and throws errors accordingly. |
| 34 | * |
| 35 | * @param[in] bytes - Size of the block device |
John Edward Broadbent | 7f2ab64 | 2021-11-11 21:00:38 -0800 | [diff] [blame] | 36 | */ |
John Edward Broadbent | 6978676 | 2022-01-21 14:16:23 -0800 | [diff] [blame] | 37 | void verifyPattern(uint64_t driveSize); |
John Edward Broadbent | 7f2ab64 | 2021-11-11 21:00:38 -0800 | [diff] [blame] | 38 | }; |
John Edward Broadbent | d3bfa7b | 2022-01-13 17:41:32 -0800 | [diff] [blame] | 39 | |
| 40 | } // namespace estoraged |