blob: 144dd8dd680a3626dc7f50e4899d0484b2ac5d48 [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 *
Tom Tung043af592023-11-24 13:37:05 +080023 * @param[in] eraseMaxGeometry - the max expected size to erase.
24 * @param[in] eraseMinGeometry - the min expected size to erase.
25 * @param[in] bytes - Size of the block device.
John Edward Broadbente6ffe702021-10-14 14:03:11 -070026 */
Tom Tung043af592023-11-24 13:37:05 +080027 void geometryOkay(uint64_t eraseMaxGeometry, uint64_t eraseMinGemoetry)
John Edward Broadbenta6e3b992022-03-17 14:33:15 -070028 {
Tom Tung043af592023-11-24 13:37:05 +080029 geometryOkay(eraseMaxGeometry, eraseMinGemoetry,
30 util::findSizeOfBlockDevice(devPath));
John Edward Broadbenta6e3b992022-03-17 14:33:15 -070031 }
Tom Tung043af592023-11-24 13:37:05 +080032 void geometryOkay(uint64_t eraseMaxGeometry, uint64_t eraseMinGemoetry,
33 uint64_t bytes);
John Edward Broadbente6ffe702021-10-14 14:03:11 -070034};
John Edward Broadbentd3bfa7b2022-01-13 17:41:32 -080035
36} // namespace estoraged