summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-03-22 17:09:54 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-03-22 17:32:47 -0400
commite38a839a80ae70eba13b6fd0e7ee08be8a62c513 (patch)
treec6f3faf1df29c0d9ddf7458554661ee4e50c9aed /Command
parentf1398b558316a936690a8f3b01493f498d15b659 (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 'Command')
-rw-r--r--Command/Status.hs16
1 files changed, 6 insertions, 10 deletions
diff --git a/Command/Status.hs b/Command/Status.hs
index aaf848905..40cefb5cc 100644
--- a/Command/Status.hs
+++ b/Command/Status.hs
@@ -22,7 +22,7 @@ import qualified Git
import qualified Annex
import Command
import Utility.DataUnits
-import Utility.StatFS
+import Utility.DiskFree
import Annex.Content
import Types.Key
import Backend
@@ -30,7 +30,6 @@ import Logs.UUID
import Logs.Trust
import Remote
import Config
-import qualified Build.SysConfig
-- a named computation that produces a statistic
type Stat = StatState (Maybe (String, StatState String))
@@ -173,19 +172,16 @@ bloom_info = stat "bloom filter size" $ json id $ do
disk_size :: Stat
disk_size = stat "available local disk space" $ json id $ lift $
- if Build.SysConfig.statfs_sanity_checked == Just True
- then calcfree
- <$> getDiskReserve False
- <*> inRepo (getFileSystemStats . gitAnnexDir)
- else return unknown
+ calcfree
+ <$> getDiskReserve
+ <*> inRepo (getDiskFree . gitAnnexDir)
where
- calcfree reserve (Just (FileSystemStats { fsStatBytesAvailable = have })) =
+ calcfree reserve (Just have) =
roughSize storageUnits True $ nonneg $ have - reserve
- calcfree _ _ = unknown
+ calcfree _ _ = "unknown"
nonneg x
| x >= 0 = x
| otherwise = 0
- unknown = "unknown"
backend_usage :: Stat
backend_usage = stat "backend usage" $ nojson $