-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Bindings to libzfs, for dealing with the Z File System and Zpools.
--
-- These are just some bindings to the real libzfs, written in C. Note
-- that libzfs is licensed under the CDDL.
@package libzfs
@version 0.1.0.2
module System.Zfs.Lowlevel
data LibzfsHandle
type LibzfsHandlePtr = Ptr LibzfsHandle
data ZpoolHandle
type ZpoolHandlePtr = Ptr ZpoolHandle
data ZfsHandle
type ZfsHandlePtr = Ptr ZfsHandle
data Nvlist
type NvlistPtr = Ptr Nvlist
data Nvpair
type NvpairPtr = Ptr Nvpair
data VdevState
type VdevStatePtr = Ptr VdevState
type ZpoolIterF a = FunPtr (ZpoolHandlePtr -> Ptr a -> IO Int)
type ZfsIterF a = FunPtr (ZfsHandlePtr -> Ptr a -> IO Int)
libzfs_init :: IO LibzfsHandlePtr
libzfs_fini :: LibzfsHandlePtr -> IO ()
zpool_open :: LibzfsHandlePtr -> CString -> IO ZpoolHandlePtr
zpool_close :: ZpoolHandlePtr -> IO ()
zpool_close_ :: FunPtr (ZpoolHandlePtr -> IO ())
zpool_get_name :: ZpoolHandlePtr -> IO CString
libzfs_errno :: LibzfsHandlePtr -> IO Int
zpool_get_state :: ZpoolHandlePtr -> IO Int
zpool_iter :: LibzfsHandlePtr -> ZpoolIterF a -> Ptr a -> IO Int
zpool_create :: LibzfsHandlePtr -> CString -> NvlistPtr -> NvlistPtr -> NvlistPtr -> IO Int
zpool_destroy :: ZpoolHandlePtr -> CString -> IO Int
zpool_enable_datasets :: ZpoolHandlePtr -> CString -> Int -> IO Int
zpool_disable_datasets :: ZpoolHandlePtr -> Bool -> IO Int
zpool_add :: ZpoolHandlePtr -> NvlistPtr -> IO Int
wrap_zpool_iter :: (ZpoolHandlePtr -> Ptr a -> IO Int) -> IO (FunPtr (ZpoolHandlePtr -> Ptr a -> IO Int))
zpool_get_config :: ZpoolHandlePtr -> Ptr NvlistPtr -> IO NvlistPtr
zpool_get_features :: ZpoolHandlePtr -> IO NvlistPtr
zfs_iter_root :: LibzfsHandlePtr -> ZfsIterF a -> Ptr a -> IO Int
zfs_iter_children :: ZfsHandlePtr -> ZfsIterF a -> Ptr a -> IO Int
zfs_iter_filesystems :: ZfsHandlePtr -> ZfsIterF a -> Ptr a -> IO Int
zfs_iter_snapshots :: ZfsHandlePtr -> ZfsIterF a -> Ptr a -> IO Int
zfs_get_name :: ZfsHandlePtr -> IO CString
zfs_get_type :: ZfsHandlePtr -> IO Int
wrap_zfs_iter :: (ZfsHandlePtr -> Ptr a -> IO Int) -> IO (FunPtr (ZfsHandlePtr -> Ptr a -> IO Int))
zfs_open :: LibzfsHandlePtr -> CString -> Int -> IO ZfsHandlePtr
zfs_close :: ZfsHandlePtr -> IO ()
zfs_close_ :: FunPtr (ZfsHandlePtr -> IO ())
zfs_is_mounted :: ZfsHandlePtr -> Ptr CString -> IO Bool
zfs_mount :: ZfsHandlePtr -> CString -> Int -> IO Int
zfs_unmount :: ZfsHandlePtr -> CString -> Int -> IO Int
zfs_unmountall :: ZfsHandlePtr -> Int -> IO Int
zfs_create :: LibzfsHandlePtr -> CString -> Int -> NvlistPtr -> IO Int
zfs_destroy :: ZfsHandlePtr -> Bool -> IO Int
zpool_vdev_name :: LibzfsHandlePtr -> ZpoolHandlePtr -> NvlistPtr -> Bool -> IO CString
zpool_vdev_online :: ZpoolHandlePtr -> CString -> Int -> VdevStatePtr -> IO Int
zpool_vdev_offline :: ZpoolHandlePtr -> CString -> Bool -> IO Int
zpool_vdev_attach :: ZpoolHandlePtr -> CString -> CString -> NvlistPtr -> Bool -> IO Int
zpool_vdev_detach :: ZpoolHandlePtr -> CString -> IO Int
zpool_vdev_remove :: ZpoolHandlePtr -> CString -> IO Int
nvlist_alloc :: Ptr NvlistPtr -> CUInt -> CInt -> IO Int
nvlist_free :: NvlistPtr -> IO ()
nvlist_size :: NvlistPtr -> Ptr CSize -> Int -> IO Int
nvlist_add_boolean :: NvlistPtr -> CString -> Bool -> IO Int
nvlist_add_byte :: NvlistPtr -> CString -> CUChar -> IO Int
nvlist_add_int8 :: NvlistPtr -> CString -> Int8 -> IO Int
nvlist_add_uint8 :: NvlistPtr -> CString -> Word8 -> IO Int
nvlist_add_int16 :: NvlistPtr -> CString -> Int16 -> IO Int
nlist_add_uint16 :: NvlistPtr -> CString -> Word16 -> IO Int
nvlist_add_int32 :: NvlistPtr -> CString -> Int32 -> IO Int
nvlist_add_uint32 :: NvlistPtr -> CString -> Word32 -> IO Int
nvlist_add_int64 :: NvlistPtr -> CString -> Int64 -> IO Int
nvlist_add_uint64 :: NvlistPtr -> CString -> Word64 -> IO Int
nvlist_add_string :: NvlistPtr -> CString -> CString -> IO Int
nvlist_add_nvlist :: NvlistPtr -> CString -> NvlistPtr -> IO Int
nvlist_add_nvlist_array :: NvlistPtr -> CString -> Ptr NvlistPtr -> CUInt -> IO Int
nvlist_remove :: NvlistPtr -> CString -> IO Int
nvlist_lookup_boolean :: NvlistPtr -> CString -> Ptr Bool -> IO Int
nvlist_lookup_byte :: NvlistPtr -> CString -> Ptr CUChar -> IO Int
nvlist_lookup_uint64 :: NvlistPtr -> CString -> Ptr Word64 -> IO Int
nvlist_lookup_nvlist :: NvlistPtr -> CString -> Ptr NvlistPtr -> IO Int
nvlist_lookup_nvlist_array :: NvlistPtr -> CString -> Ptr (Ptr NvlistPtr) -> Ptr CUInt -> IO Int
nvlist_lookup_string :: NvlistPtr -> CString -> Ptr CString -> IO Int
nvlist_next_nvpair :: NvlistPtr -> NvpairPtr -> IO NvpairPtr
nvlist_prev_nvpair :: NvlistPtr -> NvpairPtr -> IO NvpairPtr
nvpair_name :: NvpairPtr -> IO CString
nvpair_type :: NvpairPtr -> IO Int
module System.Zfs.Errors
data ZError
EzInitFailed :: ZError
EzNoMem :: ZError
EzBadProp :: ZError
EzPropReadOnly :: ZError
EzPropType :: ZError
EzPropNonInherit :: ZError
EzPropSpace :: ZError
EzBadType :: ZError
EzBusy :: ZError
EzExists :: ZError
EzNoEnt :: ZError
EzBadStream :: ZError
EzDsReadonly :: ZError
EzVolTooBig :: ZError
EzInvalidName :: ZError
EzBadRestore :: ZError
EzBadBackup :: ZError
EzBadTarget :: ZError
EzNoDevice :: ZError
EzBadDev :: ZError
EzNoReplicas :: ZError
EzResilvering :: ZError
EzBadVersion :: ZError
EzPoolUnavail :: ZError
EzDevOverflow :: ZError
EzBadPath :: ZError
EzCrossTarget :: ZError
EzZoned :: ZError
EzMountFailed :: ZError
EzUmountFailed :: ZError
EzUnshareNfsFailed :: ZError
EzShareNfsFailed :: ZError
EzPerm :: ZError
EzNoSpc :: ZError
EzFault :: ZError
EzIO :: ZError
EzIntr :: ZError
EzIsSpare :: ZError
EzInvalConfig :: ZError
EzRecursive :: ZError
EzNoHistory :: ZError
EzPoolProps :: ZError
EzPoolNotSup :: ZError
EzPoolInvalArg :: ZError
errnoToZError :: Int -> ZError
yieldZError :: LibzfsHandlePtr -> IO (Either ZError a)
instance GHC.Show.Show System.Zfs.Errors.ZError
module System.Zfs.Types
-- | Libzfs context (hidden)
newtype ZfsContext z
ZfsContext :: LibzfsHandlePtr -> ZfsContext z
-- | A Zpool handle
newtype Zpool z
Zpool :: (ForeignPtr ZpoolHandle) -> Zpool z
-- | A Zfs handle
newtype Zdataset z
Zdataset :: (ForeignPtr ZfsHandle) -> Zdataset z
-- | A monad transformer encapsulating all ZFS actions. Calls libzfs_init
-- and libzfs_fini. The type parameter z prevents the programmer
-- from passing Zpool and Zfs handles to the outside.
newtype ZfsT z m a
Zfs :: (ZfsContext z -> m (Either ZError a)) -> ZfsT z m a
[runZfs'] :: ZfsT z m a -> ZfsContext z -> m (Either ZError a)
-- | Some Zfs function that works for all underlying MonadIO instances
type Zfs z a = forall m. MonadIO m => ZfsT z m a
-- | A Zpool device
data Vdev
VdFile :: String -> Vdev
VdMirror :: [Vdev] -> Vdev
data ZpoolConfig
ZpoolConfig :: Integer -> String -> Integer -> Integer -> String -> ZpoolConfig
[zpVersion] :: ZpoolConfig -> Integer
[zpName] :: ZpoolConfig -> String
[zpState] :: ZpoolConfig -> Integer
[zpGuid] :: ZpoolConfig -> Integer
[zpHostname] :: ZpoolConfig -> String
instance GHC.Show.Show System.Zfs.Types.ZpoolConfig
instance GHC.Read.Read System.Zfs.Types.ZpoolConfig
instance GHC.Show.Show System.Zfs.Types.Vdev
instance GHC.Classes.Eq System.Zfs.Types.Vdev
instance GHC.Base.Monad m => GHC.Base.Functor (System.Zfs.Types.ZfsT z m)
instance GHC.Base.Monad m => GHC.Base.Applicative (System.Zfs.Types.ZfsT z m)
instance GHC.Base.Monad m => GHC.Base.Monad (System.Zfs.Types.ZfsT z m)
instance GHC.Base.Monad m => Control.Monad.Error.Class.MonadError System.Zfs.Errors.ZError (System.Zfs.Types.ZfsT z m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (System.Zfs.Types.ZfsT z m)
instance Control.Monad.Trans.Class.MonadTrans (System.Zfs.Types.ZfsT z)
module System.Zfs.Zpool
-- | Gets a Zpool by name
getZpool :: String -> Zfs z (Zpool z)
-- | Gets the name of some Zpool
getZpoolName :: Zpool z -> Zfs z String
-- | Run some function for all available Zpools and return the results as a
-- list
forZpools :: MonadIO m => (Zpool z -> ZfsT z IO a) -> ZfsT z m [a]
-- | Run some function for all available Zpools without result. Less
-- expensive than forZpools.
forZpools_ :: MonadIO m => (Zpool z -> ZfsT z IO ()) -> ZfsT z m ()
-- | Get the number of available Zpools. Less expensive than `length
-- $ getZpools'.
getZpoolCount :: Zfs z Int
defaultFeatures :: [[Char]]
mkVdev :: Vdev -> IO NvlistPtr
-- | Create a zpool consisting of the given devices
createZpool :: String -> [Vdev] -> Zfs z ()
-- | Get all available Zpools. Implemented using forZpools.
getZpools :: Zfs z [Zpool z]
-- | Get Zpool config
getZpoolConfig :: Zpool z -> Zfs z ZpoolConfig
-- | Destroy a zpool. If second argument is True, unmounting is enforced.
destroyZpool :: Zpool z -> Bool -> Zfs z ()
-- | Get Vdevs. TODO: Whole disks, raidz
getVdevs :: Zpool z -> Zfs z [Vdev]
-- | Iterate over all Vdevs in a pool
forVdevs :: MonadIO m => Zpool z -> (Vdev -> ZfsT z m a) -> ZfsT z m [a]
module System.Zfs.Mount
-- | Mount all datasets in the given pool. Second argument contains mount
-- options (TODO: this shouldn't be a string...)
enableDatasets :: Zpool z -> String -> Zfs z ()
-- | Unmount all datasets in the given pool. Second argument specifies
-- whether to force unmounting.
disableDatasets :: Zpool z -> Bool -> Zfs z ()
-- | Unmount this filesystem and any children inheriting the mountpoint
-- property.
unmountAll :: Zdataset z -> Zfs z ()
-- | Mount the given filesystem with custom mount options
mount' :: Zdataset z -> Maybe String -> Zfs z ()
-- | Mount the given filesystem with default options
mount :: Zdataset z -> Zfs z ()
-- | Remount the given filesystem
remount :: Zdataset z -> Zfs z ()
-- | Unmount the given filesystem
unmount :: Zdataset z -> Zfs z ()
-- | Check if a file system is mounted and return the mountpoint if
-- available
tryGetMountpoint :: Zdataset z -> Zfs z (Maybe String)
module System.Zfs.Iter
-- | Get number of root zfs
getRootCount :: Zfs z Int
-- | Get number of child zfs
getChildrenCount :: Zdataset z -> Zfs z Int
-- | Get the number of available Zpools. Less expensive than `length
-- $ getZpools'.
getZpoolCount :: Zfs z Int
-- | Get all root file systems. Implemented using forRoots.
getRoots :: Zfs z [Zdataset z]
-- | Get all zfs children . Implemented using forChildren.
getChildren :: Zdataset z -> Zfs z [Zdataset z]
-- | Get all available Zpools. Implemented using forZpools.
getZpools :: Zfs z [Zpool z]
-- | Iterate over all root zfs
forRoots :: MonadIO m => (Zdataset z -> ZfsT z IO a) -> ZfsT z m [a]
-- | Iterate over all children
forChildren :: MonadIO m => Zdataset z -> (Zdataset z -> ZfsT z IO a) -> ZfsT z m [a]
-- | Iterate over all child filesystems
forFilesystems :: MonadIO m => Zdataset z -> (Zdataset z -> ZfsT z IO a) -> ZfsT z m [a]
-- | Iterate over all child zfs
forSnapshots :: MonadIO m => Zdataset z -> (Zdataset z -> ZfsT z IO a) -> ZfsT z m [a]
-- | Run some function for all available Zpools and return the results as a
-- list
forZpools :: MonadIO m => (Zpool z -> ZfsT z IO a) -> ZfsT z m [a]
-- | Run some function for all available Zpools without result. Less
-- expensive than forZpools.
forZpools_ :: MonadIO m => (Zpool z -> ZfsT z IO ()) -> ZfsT z m ()
-- | Iterate over all Vdevs in a pool
forVdevs :: MonadIO m => Zpool z -> (Vdev -> ZfsT z m a) -> ZfsT z m [a]
module System.Zfs.Dataset
-- | Create a filesystem
createFilesystem :: String -> Zfs z ()
-- | Create a block volume (path, block size, vol size)
createVolume :: String -> Integer -> Integer -> Zfs z ()
-- | Destroy a dataset.
destroyDataset :: Zdataset z -> Zfs z ()
-- | Gets the name of some Zfs
getDatasetName :: Zdataset z -> Zfs z String
module System.Zfs
-- | Runs some ZfsT function, making sure that no Zpool or Zfs handles are
-- passed to the outside. Calls libzfs_init and libzfs_fini.
runZfs :: MonadIO m => (forall z. ZfsT z m a) -> m (Either ZError a)
-- | Print Zpool config
printZpoolConfig :: Zpool z -> Zfs z ()