HFuse 0.2.4.1 → 0.2.4.2
raw patch · 3 files changed
+51/−35 lines, 3 filesnew-uploaderPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- HFuse.cabal +15/−12
- README +8/−7
- System/Fuse.hsc +28/−16
HFuse.cabal view
@@ -1,12 +1,12 @@ Name: HFuse-Version: 0.2.4.1+Version: 0.2.4.2 License: BSD3 License-File: LICENSE Author: Jeremy Bobbio-Maintainer: Paul van der Walt <cabal@denknerd.org>+Maintainer: Montez Fitzpatrick <montezf@gmail.com> Synopsis: HFuse is a binding for the Linux FUSE library.-Description: Bindings for the FUSE library, compatible with OSXFUSE.-Homepage: https://github.com/toothbrush/hfuse+Description: Bindings for the FUSE library, compatible with OSXFUSE and FreeBSD.+Homepage: https://github.com/m15k/hfuse Category: System Stability: Experimental Cabal-Version: >= 1.6@@ -19,17 +19,20 @@ Extensions: ForeignFunctionInterface ScopedTypeVariables EmptyDataDecls Includes: dirent.h, fuse.h, fcntl.h Include-Dirs: /usr/include, /usr/local/include, .- if os(darwin) {+ if os(darwin) CC-Options: "-DMACFUSE"- CC-Options: "-DFUSE_USE_VERSION=26" Include-Dirs: /usr/local/include/osxfuse- } else {- Includes: sys/statfs.h- }+ else+ if os(freebsd) + Includes: sys/param.h, sys/mount.h+ CC-Options: "-Df_namelen=f_namemax"+ else+ Includes: sys/statfs.h+ Extra-Libraries: fuse Extra-Lib-Dirs: /usr/local/lib- CC-Options: -D_FILE_OFFSET_BITS=64+ CC-Options: "-D_FILE_OFFSET_BITS=64" source-repository head- type: head- location: https://github.com/toothbrush/hfuse.git+ type: git+ location: https://github.com/m15k/hfuse.git
README view
@@ -1,13 +1,14 @@-Programs using HFuse should be compiled with -threaded.+# Haskell FUSE API -HelloFS seems to work with:-* Linux 2.6.24-* The Glorious Glasgow Haskell Compilation System, version 6.8.2-* fuse-2.6+Filesystem in Userspace ("FUSE") makes it possible to implement a filesystem as a userspace program. -BindFS (?) is known to have a lurking deadlock problem.+This library is the Haskell binding to this library. -LiveFS is broken (from the old distribution).+## Information++- Programs using HFuse should be compiled with -threaded.+- This now works for base 4.6++- Added build options support for FreeBSD (contribution by https://github.com/pesco) Added support for MacFUSE. Tested HelloFS and BindFS with: * OSX 10.4.11 on a PPC G4 mac
System/Fuse.hsc view
@@ -4,9 +4,9 @@ -- Copyright : (c) Jérémy Bobbio, Taru Karttunen -- License : BSD-style -- --- Maintainer : taruti@taruti.net, jeremy.bobbio@etu.upmc.fr+-- Maintainer : Montez Fitzpatrick -- Stability : experimental--- Portability : GHC 6.4-6.12+-- Portability : GHC 6.4-7.8.1 -- -- A binding for the FUSE (Filesystem in USErspace) library -- (<http://fuse.sourceforge.net/>), which allows filesystems to be implemented@@ -21,6 +21,8 @@ -- ----------------------------------------------------------------------------- {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE Rank2Types #-}+{-# LANGUAGE CPP #-} module System.Fuse ( -- * Using FUSE @@ -70,7 +72,11 @@ import qualified System.Posix.Signals as Signals import GHC.IO.Handle(hDuplicateTo) import System.Exit-import qualified System.IO.Error as IO(catch,ioeGetErrorString)+#if MIN_VERSION_base(4,6,0)+import System.IO.Error (catchIOError,ioeGetErrorString)+#else+import System.IO.Error (catch,ioeGetErrorString)+#endif -- TODO: FileMode -> Permissions -- TODO: Arguments !@@ -79,7 +85,7 @@ #define FUSE_USE_VERSION 26 -#ifdef MACFUSE+#if defined MACFUSE || defined __FreeBSD__ #include <sys/mount.h> #else #include <sys/statfs.h>@@ -757,16 +763,17 @@ -- Mimic's daemon()s use of _exit() instead of exit(); we depend on this in fuseMainReal, -- because otherwise we'll unmount the filesystem when the foreground process exits. daemon f = forkProcess d >> exitImmediately ExitSuccess- where d = IO.catch (do createSession- changeWorkingDirectory "/"- -- need to open /dev/null twice because hDuplicateTo can't dup a ReadWriteMode to a ReadMode handle- withFile "/dev/null" WriteMode (\devNullOut ->- do hDuplicateTo devNullOut stdout- hDuplicateTo devNullOut stderr)- withFile "/dev/null" ReadMode (\devNullIn -> hDuplicateTo devNullIn stdin)- f- exitWith ExitSuccess)- (const exitFailure)+ where d = catch (do createSession+ changeWorkingDirectory "/"+ -- need to open /dev/null twice because hDuplicateTo can't dup a+ -- ReadWriteMode to a ReadMode handle+ withFile "/dev/null" WriteMode (\devNullOut ->+ do hDuplicateTo devNullOut stdout+ hDuplicateTo devNullOut stderr)+ withFile "/dev/null" ReadMode (\devNullIn -> hDuplicateTo devNullIn stdin)+ f+ exitWith ExitSuccess)+ (const exitFailure) -- Installs signal handlers for the duration of the main loop. withSignalHandlers exitHandler f =@@ -843,14 +850,14 @@ fuseRun :: String -> [String] -> Exception e => FuseOperations fh -> (e -> IO Errno) -> IO () fuseRun prog args ops handler =- IO.catch+ catch (withFuseArgs prog args (\pArgs -> do cmd <- fuseParseCommandLine pArgs case cmd of Nothing -> fail "" Just (Nothing, _, _) -> fail "Usage error: mount point required" Just (Just mountPt, _, foreground) -> fuseMainReal foreground ops handler pArgs mountPt))- ((\errStr -> when (not $ null errStr) (putStrLn errStr) >> exitFailure) . IO.ioeGetErrorString)+ ((\errStr -> when (not $ null errStr) (putStrLn errStr) >> exitFailure) . ioeGetErrorString) ----------------------------------------------------------------------------- -- Miscellaneous utilities@@ -868,6 +875,11 @@ pokeCStringLen0 :: CStringLen -> String -> IO () pokeCStringLen0 (pBuf, bufSize) src = pokeArray0 0 pBuf $ take (bufSize - 1) $ map castCharToCChar src++#if MIN_VERSION_base(4,6,0)+catch = catchIOError+#else+#endif ----------------------------------------------------------------------------- -- C land