diff options
author | Joey Hess <joey@kitenet.net> | 2012-03-22 17:09:54 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-03-22 17:32:47 -0400 |
commit | e38a839a80ae70eba13b6fd0e7ee08be8a62c513 (patch) | |
tree | c6f3faf1df29c0d9ddf7458554661ee4e50c9aed /Config.hs | |
parent | f1398b558316a936690a8f3b01493f498d15b659 (diff) |
Rewrote free disk space checking code
Moving the portability handling into a small C library cleans up things
a lot, avoiding the pain of unpacking structs from inside haskell code.
Diffstat (limited to 'Config.hs')
-rw-r--r-- | Config.hs | 18 |
1 files changed, 3 insertions, 15 deletions
@@ -12,7 +12,6 @@ import qualified Git import qualified Git.Config import qualified Git.Command import qualified Annex -import qualified Build.SysConfig import Utility.DataUnits type ConfigKey = String @@ -92,19 +91,8 @@ getTrustLevel :: Git.Repo -> Annex (Maybe String) getTrustLevel r = fromRepo $ Git.Config.getMaybe $ remoteConfig r "trustlevel" {- Gets annex.diskreserve setting. -} -getDiskReserve :: Bool -> Annex Integer -getDiskReserve sanitycheck = do - r <- getConfig "diskreserve" "" - when sanitycheck $ check r - return $ fromMaybe megabyte $ readSize dataUnits r +getDiskReserve :: Annex Integer +getDiskReserve = fromMaybe megabyte . readSize dataUnits + <$> getConfig "diskreserve" "" where megabyte = 1000000 - check r - | not (null r) && not cancheck = do - unlessM (Annex.getState Annex.force) $ - error $ "You have configured a diskreserve of " - ++ r ++ - " but disk space checking is not working" - return () - | otherwise = return () - cancheck = Build.SysConfig.statfs_sanity_checked == Just True |