mountpoints 1.0.1 → 1.0.2
raw patch · 4 files changed
+23/−5 lines, 4 files
Files
- CHANGELOG +7/−0
- System/MountPoints.hsc +10/−3
- cbits/libmounts.h +4/−0
- mountpoints.cabal +2/−2
CHANGELOG view
@@ -1,3 +1,10 @@+mountpoints (1.0.2) unstable; urgency=medium++ * Fix build on Android.+ * getMounts uses getProcMounts on Android.++ -- Joey Hess <id@joeyh.name> Tue, 15 Mar 2016 13:20:03 -0400+ mountpoints (1.0.1) unstable; urgency=medium * Added full text of LGPL to package.
System/MountPoints.hsc view
@@ -5,7 +5,7 @@ -- Derived from hsshellscript, originally written by -- Volker Wysk <hsss@volker-wysk.de> -{-# LANGUAGE ForeignFunctionInterface #-}+{-# LANGUAGE ForeignFunctionInterface, CPP #-} module System.MountPoints ( Mntent(..),@@ -14,6 +14,7 @@ ) where #include "libmounts.h"+ import Control.Monad import Control.Exception import Data.Maybe@@ -34,6 +35,7 @@ -- -- This uses eiher getmntent or getmntinfo, depending on the OS. getMounts :: IO [Mntent]+#ifndef linux_android_HOST_OS getMounts = do h <- c_mounts_start when (h == nullPtr) $@@ -56,7 +58,11 @@ , mnt_type = mnt_type_str } getmntent h (ent:c)+#else+getMounts = getProcMounts+#endif +#ifndef linux_android_HOST_OS -- Using unsafe imports because the C functions are belived to never block. -- Note that getmntinfo is called with MNT_NOWAIT to avoid possibly blocking; -- while getmntent only accesses a file in /etc (or /proc) that should not@@ -67,12 +73,13 @@ :: Ptr () -> IO (Ptr ()) foreign import ccall unsafe "libmounts.h mounts_end" c_mounts_end :: Ptr () -> IO CInt+#endif -- | Read </proc/mounts> to get currently mounted filesystems. -- -- This works on Linux and related systems, including Android. --- Note that on Android, `getMounts` will always return [], so--- use this instead.++-- Note that on Android, `getMounts` calls this function. getProcMounts :: IO [Mntent] getProcMounts = do v <- try go :: IO (Either SomeException [Mntent])
cbits/libmounts.h view
@@ -1,4 +1,7 @@ /* Include appropriate headers for the OS, and define what will be used. */+#if defined __ANDROID__+# define UNKNOWN+#else #if defined (__FreeBSD__) || defined (__APPLE__) # include <sys/param.h> # include <sys/ucred.h>@@ -12,6 +15,7 @@ #else # warning mounts listing code not available for this OS # define UNKNOWN+#endif #endif #endif
mountpoints.cabal view
@@ -1,5 +1,5 @@ Name: mountpoints-Version: 1.0.1+Version: 1.0.2 Cabal-Version: >= 1.8 License: LGPL Maintainer: Joey Hess <id@joeyh.name>@@ -14,7 +14,7 @@ Lists currently mounted filesystems. . Works on: Linux, BSD, Mac OS X, Android-Extra-Source-FIles:+Extra-Source-Files: cbits/libmounts.h CHANGELOG LGPL-2.1