summaryrefslogtreecommitdiff
path: root/hscript/disk.hh
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-21 01:36:47 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-21 01:36:47 -0500
commit07a2de27b57848789171dee2559e4bd78d0e921c (patch)
tree67f4a95dc146a09207f293feccb6555063c6f955 /hscript/disk.hh
parent790217353e94a4a9ee14d51b8a9e6c2dafc6377d (diff)
downloadhorizon-07a2de27b57848789171dee2559e4bd78d0e921c.tar.gz
horizon-07a2de27b57848789171dee2559e4bd78d0e921c.tar.bz2
horizon-07a2de27b57848789171dee2559e4bd78d0e921c.tar.xz
horizon-07a2de27b57848789171dee2559e4bd78d0e921c.zip
hscript: Implement DiskLabel, add tests
Diffstat (limited to 'hscript/disk.hh')
-rw-r--r--hscript/disk.hh25
1 files changed, 25 insertions, 0 deletions
diff --git a/hscript/disk.hh b/hscript/disk.hh
index 02ecb98..f8a9574 100644
--- a/hscript/disk.hh
+++ b/hscript/disk.hh
@@ -37,6 +37,31 @@ public:
};
class DiskLabel : public Key {
+public:
+ /*! The type of disklabel. */
+ enum LabelType {
+ /*! Apple Partition Map (APM) */
+ APM,
+ /*! Master Boot Record (MBR) */
+ MBR,
+ /*! GUID Partition Table (GPT) */
+ GPT
+ };
+private:
+ const std::string _block;
+ const LabelType _type;
+
+ DiskLabel(int _line, const std::string &_b, const LabelType &_t) :
+ Key(_line), _block(_b), _type(_t) {}
+public:
+ /*! Retrieve the block device that this key identifies. */
+ const std::string device() const { return this->_block; }
+ /*! Retrieve the type of disklabel for the block device. */
+ const LabelType type() const { return this->_type; }
+
+ static Key *parseFromData(const std::string &, int, int*, int*);
+ bool validate(ScriptOptions) const override;
+ bool execute(ScriptOptions) const override;
};
class Partition : public Key {