summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Parted.hs
diff options
context:
space:
mode:
authorJoey Hess2015-08-26 17:29:01 -0700
committerJoey Hess2015-08-31 13:54:49 -0700
commit94d6f453e7441749a83f0ea69d0e7c12737565a1 (patch)
tree6d13ab00a5594b77a1bfeccb9e87cc78c3b02859 /src/Propellor/Property/Parted.hs
parentc95f05ef8874b21c9a4f9756b8af79e178d80232 (diff)
propellor spin
(cherry picked from commit 7087a94b21a086a98784d17b45dd2b7779e320e9)
Diffstat (limited to 'src/Propellor/Property/Parted.hs')
-rw-r--r--src/Propellor/Property/Parted.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Propellor/Property/Parted.hs b/src/Propellor/Property/Parted.hs
index aa7bece4..29d94b4c 100644
--- a/src/Propellor/Property/Parted.hs
+++ b/src/Propellor/Property/Parted.hs
@@ -6,9 +6,9 @@ module Propellor.Property.Parted (
Partition(..),
mkPartition,
Partition.Fs(..),
- MegaBytes(..),
+ PartSize(..),
ByteSize,
- toMegaBytes,
+ toPartSize,
Partition.MkfsOpts,
PartType(..),
PartFlag(..),
@@ -48,7 +48,7 @@ instance Monoid PartTable where
-- | A partition on the disk.
data Partition = Partition
{ partType :: PartType
- , partSize :: MegaBytes
+ , partSize :: PartSize
, partFs :: Partition.Fs
, partMkFsOpts :: Partition.MkfsOpts
, partFlags :: [(PartFlag, Bool)] -- ^ flags can be set or unset (parted may set some flags by default)
@@ -57,7 +57,7 @@ data Partition = Partition
deriving (Show)
-- | Makes a Partition with defaults for non-important values.
-mkPartition :: Partition.Fs -> MegaBytes -> Partition
+mkPartition :: Partition.Fs -> PartSize -> Partition
mkPartition fs sz = Partition
{ partType = Primary
, partSize = sz
@@ -80,16 +80,16 @@ instance PartedVal PartType where
-- automatically lay out the partitions.
--
-- Note that these are SI megabytes, not mebibytes.
-newtype MegaBytes = MegaBytes Integer
+newtype PartSize = MegaBytes Integer
deriving (Show)
-instance PartedVal MegaBytes where
+instance PartedVal PartSize where
val (MegaBytes n) = show n ++ "MB"
-toMegaBytes :: ByteSize -> MegaBytes
-toMegaBytes b = MegaBytes (b `div` 1000000)
+toPartSize :: ByteSize -> PartSize
+toPartSize b = MegaBytes (b `div` 1000000)
-instance Monoid MegaBytes where
+instance Monoid PartSize where
mempty = MegaBytes 0
mappend (MegaBytes a) (MegaBytes b) = MegaBytes (a + b)