summaryrefslogtreecommitdiff
path: root/diskman/partition.hh
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-02-12 10:13:23 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-02-12 10:13:23 -0600
commitd72ef990a3a417e4f9062517313afe325e7035e6 (patch)
tree87710964990847b4c0fe22392ba497680bc3c947 /diskman/partition.hh
parente16056761ebbfdbf8d0cf6b394e72d1689e7b3ce (diff)
downloadhorizon-d72ef990a3a417e4f9062517313afe325e7035e6.tar.gz
horizon-d72ef990a3a417e4f9062517313afe325e7035e6.tar.bz2
horizon-d72ef990a3a417e4f9062517313afe325e7035e6.tar.xz
horizon-d72ef990a3a417e4f9062517313afe325e7035e6.zip
DiskMan: Add partition support, codify the source of creation objects
Diffstat (limited to 'diskman/partition.hh')
-rw-r--r--diskman/partition.hh46
1 files changed, 46 insertions, 0 deletions
diff --git a/diskman/partition.hh b/diskman/partition.hh
index e69de29..93090d8 100644
--- a/diskman/partition.hh
+++ b/diskman/partition.hh
@@ -0,0 +1,46 @@
+/*
+ * partition.hh - Definition of the Partition class
+ * diskman, the Disk Manipulation library for
+ * Project Horizon
+ *
+ * Copyright (c) 2020 Adélie Linux and contributors. All rights reserved.
+ * This code is licensed under the AGPL 3.0 license, as noted in the
+ * LICENSE-code file in the root directory of this repository.
+ *
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+#ifndef DISKMAN__PARTITION_HH
+#define DISKMAN__PARTITION_HH
+
+#include <cstdint>
+#include <string>
+
+namespace Horizon {
+namespace DiskMan {
+
+class Disk;
+
+class Partition {
+public:
+ /*! Retrieve the size of the partition in bytes. */
+ uint64_t size() const { return this->_size; };
+ /*! Retrieve the file system type of this partition. */
+ const std::string fstype() const { return this->_fs_type; }
+ /*! Retrieve the label of the file system on this partition. */
+ const std::string label() const { return this->_label; }
+private:
+ /*! The size of the partition, in bytes. */
+ uint64_t _size;
+ /*! The type of the file system on this partition (if any) */
+ std::string _fs_type;
+ /*! The label of the file system on this partition (if any) */
+ std::string _label;
+ Partition(Disk &d, void *creation, int type);
+ friend class Disk;
+};
+
+}
+}
+
+#endif /* !DISKMAN__PARTITION_HH */