blob: 5d179572253e506e386b4af8c4bbd03ade21ccfc [file] [log] [blame]
John Edward Broadbente6ffe702021-10-14 14:03:11 -07001#pragma once
2
3#include "erase.hpp"
John Edward Broadbenta6e3b992022-03-17 14:33:15 -07004#include "util.hpp"
John Edward Broadbente6ffe702021-10-14 14:03:11 -07005
6#include <string_view>
7
John Edward Broadbentd3bfa7b2022-01-13 17:41:32 -08008namespace estoraged
9{
10
John Edward Broadbente6ffe702021-10-14 14:03:11 -070011class VerifyDriveGeometry : public Erase
12{
13 public:
14 /** @brief Creates a verifyDriveGeomentry erase object.
15 *
16 * @param[in] inDevPath - the linux device path for the block device.
17 */
Patrick Williams04c28fa2023-05-10 07:51:24 -050018 VerifyDriveGeometry(std::string_view inDevPath) : Erase(inDevPath) {}
John Edward Broadbente6ffe702021-10-14 14:03:11 -070019
20 /** @brief Test if input is in between the max and min expected sizes,
21 * and throws errors accordingly.
22 *
23 * @param[in] bytes - Size of the block device
24 */
John Edward Broadbenta6e3b992022-03-17 14:33:15 -070025 void geometryOkay()
26 {
John Edward Broadbent5d799bb2022-03-22 16:14:24 -070027 geometryOkay(util::findSizeOfBlockDevice(devPath));
John Edward Broadbenta6e3b992022-03-17 14:33:15 -070028 }
John Edward Broadbente6ffe702021-10-14 14:03:11 -070029 void geometryOkay(uint64_t bytes);
30};
John Edward Broadbentd3bfa7b2022-01-13 17:41:32 -080031
32} // namespace estoraged