summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2012-07-28 21:21:35 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2012-07-28 21:21:35 +0200
commitededb764b496669013198419a56f2ee513d52587 (patch)
tree0f0379bc60ea332aed032c17e5218358af6b0a62 /src/Plugins
parent42f47c612a5aa113bdb5637c56c5bfaa1a98d846 (diff)
downloadxmobar-ededb764b496669013198419a56f2ee513d52587.tar.gz
xmobar-ededb764b496669013198419a56f2ee513d52587.tar.bz2
Fixes for DiskU, which was exploding on recent Linux
We're using now the recommended statvfs interface, instead of the obsolete statfs64. Moreover, we compute correctly the used space.
Diffstat (limited to 'src/Plugins')
-rw-r--r--src/Plugins/Monitors/Disk.hs19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/Plugins/Monitors/Disk.hs b/src/Plugins/Monitors/Disk.hs
index 725fe29..554be05 100644
--- a/src/Plugins/Monitors/Disk.hs
+++ b/src/Plugins/Monitors/Disk.hs
@@ -77,15 +77,6 @@ parseDev dat dev =
dat' = if length xs > 6 then [sp, rSp, wSp] else [0, 0, 0]
in (dev, dat')
-fsStats :: String -> IO [Integer]
-fsStats path = do
- stats <- getFileSystemStats path
- case stats of
- Nothing -> return [0, 0, 0]
- Just f -> let tot = fsStatByteCount f
- free = fsStatBytesAvailable f
- in return [tot, free, tot - free]
-
speedToStr :: Float -> String
speedToStr = showWithUnits 2 1
@@ -131,6 +122,16 @@ startDiskIO disks args rate cb = do
_ <- mountedData dref (map fst mounted)
runM args diskIOConfig (runDiskIO dref disks) rate cb
+fsStats :: String -> IO [Integer]
+fsStats path = do
+ stats <- getFileSystemStats path
+ case stats of
+ Nothing -> return [0, 0, 0]
+ Just f -> let tot = fsStatByteCount f
+ free = fsStatBytesAvailable f
+ used = fsStatBytesUsed f
+ in return [tot, free, used]
+
runDiskU' :: String -> String -> Monitor String
runDiskU' tmp path = do
setConfigValue tmp template