-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.OSTree.Functions
    ( 

 -- * Methods


-- ** breakHardlink #method:breakHardlink#

    breakHardlink                           ,


-- ** checkVersion #method:checkVersion#

    checkVersion                            ,


-- ** checksumB64FromBytes #method:checksumB64FromBytes#

    checksumB64FromBytes                    ,


-- ** checksumB64ToBytes #method:checksumB64ToBytes#

    checksumB64ToBytes                      ,


-- ** checksumBytesPeek #method:checksumBytesPeek#

    checksumBytesPeek                       ,


-- ** checksumBytesPeekValidate #method:checksumBytesPeekValidate#

    checksumBytesPeekValidate               ,


-- ** checksumFile #method:checksumFile#

    checksumFile                            ,


-- ** checksumFileAsync #method:checksumFileAsync#

    checksumFileAsync                       ,


-- ** checksumFileAsyncFinish #method:checksumFileAsyncFinish#

    checksumFileAsyncFinish                 ,


-- ** checksumFileAt #method:checksumFileAt#

    checksumFileAt                          ,


-- ** checksumFileFromInput #method:checksumFileFromInput#

    checksumFileFromInput                   ,


-- ** checksumFromBytes #method:checksumFromBytes#

    checksumFromBytes                       ,


-- ** checksumFromBytesV #method:checksumFromBytesV#

    checksumFromBytesV                      ,


-- ** checksumInplaceToBytes #method:checksumInplaceToBytes#

    checksumInplaceToBytes                  ,


-- ** checksumToBytes #method:checksumToBytes#

    checksumToBytes                         ,


-- ** checksumToBytesV #method:checksumToBytesV#

    checksumToBytesV                        ,


-- ** cmd_Private__ #method:cmd_Private__#

    cmd_Private__                           ,


-- ** cmpChecksumBytes #method:cmpChecksumBytes#

    cmpChecksumBytes                        ,


-- ** commitGetContentChecksum #method:commitGetContentChecksum#

    commitGetContentChecksum                ,


-- ** commitGetObjectSizes #method:commitGetObjectSizes#

    commitGetObjectSizes                    ,


-- ** commitGetParent #method:commitGetParent#

    commitGetParent                         ,


-- ** commitGetTimestamp #method:commitGetTimestamp#

    commitGetTimestamp                      ,


-- ** commitMetadataForBootable #method:commitMetadataForBootable#

    commitMetadataForBootable               ,


-- ** contentFileParse #method:contentFileParse#

    contentFileParse                        ,


-- ** contentFileParseAt #method:contentFileParseAt#

    contentFileParseAt                      ,


-- ** contentStreamParse #method:contentStreamParse#

    contentStreamParse                      ,


-- ** createDirectoryMetadata #method:createDirectoryMetadata#

    createDirectoryMetadata                 ,


-- ** diffDirs #method:diffDirs#

    diffDirs                                ,


-- ** diffDirsWithOptions #method:diffDirsWithOptions#

    diffDirsWithOptions                     ,


-- ** diffPrint #method:diffPrint#

    diffPrint                               ,


-- ** gpgErrorQuark #method:gpgErrorQuark#

    gpgErrorQuark                           ,


-- ** hashObjectName #method:hashObjectName#

    hashObjectName                          ,


-- ** metadataVariantType #method:metadataVariantType#

    metadataVariantType                     ,


-- ** objectFromString #method:objectFromString#

    objectFromString                        ,


-- ** objectNameDeserialize #method:objectNameDeserialize#

    objectNameDeserialize                   ,


-- ** objectNameSerialize #method:objectNameSerialize#

    objectNameSerialize                     ,


-- ** objectToString #method:objectToString#

    objectToString                          ,


-- ** objectTypeFromString #method:objectTypeFromString#

    objectTypeFromString                    ,


-- ** objectTypeToString #method:objectTypeToString#

    objectTypeToString                      ,


-- ** parseRefspec #method:parseRefspec#

    parseRefspec                            ,


-- ** rawFileToArchiveZ2Stream #method:rawFileToArchiveZ2Stream#

    rawFileToArchiveZ2Stream                ,


-- ** rawFileToArchiveZ2StreamWithOptions #method:rawFileToArchiveZ2StreamWithOptions#

    rawFileToArchiveZ2StreamWithOptions     ,


-- ** rawFileToContentStream #method:rawFileToContentStream#

    rawFileToContentStream                  ,


-- ** validateChecksumString #method:validateChecksumString#

    validateChecksumString                  ,


-- ** validateCollectionId #method:validateCollectionId#

    validateCollectionId                    ,


-- ** validateRemoteName #method:validateRemoteName#

    validateRemoteName                      ,


-- ** validateRev #method:validateRev#

    validateRev                             ,


-- ** validateStructureofChecksumString #method:validateStructureofChecksumString#

    validateStructureofChecksumString       ,


-- ** validateStructureofCommit #method:validateStructureofCommit#

    validateStructureofCommit               ,


-- ** validateStructureofCsumV #method:validateStructureofCsumV#

    validateStructureofCsumV                ,


-- ** validateStructureofDirmeta #method:validateStructureofDirmeta#

    validateStructureofDirmeta              ,


-- ** validateStructureofDirtree #method:validateStructureofDirtree#

    validateStructureofDirtree              ,


-- ** validateStructureofFileMode #method:validateStructureofFileMode#

    validateStructureofFileMode             ,


-- ** validateStructureofObjtype #method:validateStructureofObjtype#

    validateStructureofObjtype              ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R

import qualified GI.GLib.Structs.VariantDict as GLib.VariantDict
import qualified GI.GLib.Structs.VariantType as GLib.VariantType
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Interfaces.File as Gio.File
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Gio.Objects.FileInfo as Gio.FileInfo
import qualified GI.Gio.Objects.InputStream as Gio.InputStream
import {-# SOURCE #-} qualified GI.OSTree.Enums as OSTree.Enums
import {-# SOURCE #-} qualified GI.OSTree.Flags as OSTree.Flags
import {-# SOURCE #-} qualified GI.OSTree.Structs.CmdPrivateVTable as OSTree.CmdPrivateVTable
import {-# SOURCE #-} qualified GI.OSTree.Structs.CommitSizesEntry as OSTree.CommitSizesEntry
import {-# SOURCE #-} qualified GI.OSTree.Structs.DiffDirsOptions as OSTree.DiffDirsOptions
import {-# SOURCE #-} qualified GI.OSTree.Structs.DiffItem as OSTree.DiffItem

-- function validate_structureof_objtype
-- Args: [ Arg
--           { argCName = "objtype"
--           , argType = TBasicType TUInt8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_validate_structureof_objtype" ostree_validate_structureof_objtype :: 
    Word8 ->                                -- objtype : TBasicType TUInt8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | /No description available in the introspection data./
validateStructureofObjtype ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word8
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
validateStructureofObjtype :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word8 -> m ()
validateStructureofObjtype Word8
objtype = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Word8 -> Ptr (Ptr GError) -> IO CInt
ostree_validate_structureof_objtype Word8
objtype
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )


-- function validate_structureof_file_mode
-- Args: [ Arg
--           { argCName = "mode"
--           , argType = TBasicType TUInt32
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A Unix filesystem mode"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_validate_structureof_file_mode" ostree_validate_structureof_file_mode :: 
    Word32 ->                               -- mode : TBasicType TUInt32
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | /No description available in the introspection data./
validateStructureofFileMode ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@mode@/: A Unix filesystem mode
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
validateStructureofFileMode :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word32 -> m ()
validateStructureofFileMode Word32
mode = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Word32 -> Ptr (Ptr GError) -> IO CInt
ostree_validate_structureof_file_mode Word32
mode
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )


-- function validate_structureof_dirtree
-- Args: [ Arg
--           { argCName = "dirtree"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "A dirtree object, %OSTREE_OBJECT_TYPE_DIR_TREE"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_validate_structureof_dirtree" ostree_validate_structureof_dirtree :: 
    Ptr GVariant ->                         -- dirtree : TVariant
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Use this to validate the basic structure of /@dirtree@/, independent of
-- any other objects it references.
validateStructureofDirtree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GVariant
    -- ^ /@dirtree@/: A dirtree object, 'GI.OSTree.Enums.ObjectTypeDirTree'
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
validateStructureofDirtree :: forall (m :: * -> *). (HasCallStack, MonadIO m) => GVariant -> m ()
validateStructureofDirtree GVariant
dirtree = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr GVariant
dirtree' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
dirtree
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr GVariant -> Ptr (Ptr GError) -> IO CInt
ostree_validate_structureof_dirtree Ptr GVariant
dirtree'
        GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
dirtree
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )


-- function validate_structureof_dirmeta
-- Args: [ Arg
--           { argCName = "dirmeta"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "A dirmeta object, %OSTREE_OBJECT_TYPE_DIR_META"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_validate_structureof_dirmeta" ostree_validate_structureof_dirmeta :: 
    Ptr GVariant ->                         -- dirmeta : TVariant
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Use this to validate the basic structure of /@dirmeta@/.
validateStructureofDirmeta ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GVariant
    -- ^ /@dirmeta@/: A dirmeta object, 'GI.OSTree.Enums.ObjectTypeDirMeta'
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
validateStructureofDirmeta :: forall (m :: * -> *). (HasCallStack, MonadIO m) => GVariant -> m ()
validateStructureofDirmeta GVariant
dirmeta = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr GVariant
dirmeta' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
dirmeta
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr GVariant -> Ptr (Ptr GError) -> IO CInt
ostree_validate_structureof_dirmeta Ptr GVariant
dirmeta'
        GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
dirmeta
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )


-- function validate_structureof_csum_v
-- Args: [ Arg
--           { argCName = "checksum"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GVariant of type \"ay\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_validate_structureof_csum_v" ostree_validate_structureof_csum_v :: 
    Ptr GVariant ->                         -- checksum : TVariant
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | /No description available in the introspection data./
validateStructureofCsumV ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GVariant
    -- ^ /@checksum@/: a t'GVariant' of type \"ay\"
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
validateStructureofCsumV :: forall (m :: * -> *). (HasCallStack, MonadIO m) => GVariant -> m ()
validateStructureofCsumV GVariant
checksum = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr GVariant
checksum' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
checksum
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr GVariant -> Ptr (Ptr GError) -> IO CInt
ostree_validate_structureof_csum_v Ptr GVariant
checksum'
        GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
checksum
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )


-- function validate_structureof_commit
-- Args: [ Arg
--           { argCName = "commit"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A commit object, %OSTREE_OBJECT_TYPE_COMMIT"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_validate_structureof_commit" ostree_validate_structureof_commit :: 
    Ptr GVariant ->                         -- commit : TVariant
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Use this to validate the basic structure of /@commit@/, independent of
-- any other objects it references.
validateStructureofCommit ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GVariant
    -- ^ /@commit@/: A commit object, 'GI.OSTree.Enums.ObjectTypeCommit'
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
validateStructureofCommit :: forall (m :: * -> *). (HasCallStack, MonadIO m) => GVariant -> m ()
validateStructureofCommit GVariant
commit = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr GVariant
commit' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
commit
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr GVariant -> Ptr (Ptr GError) -> IO CInt
ostree_validate_structureof_commit Ptr GVariant
commit'
        GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
commit
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )


-- function validate_structureof_checksum_string
-- Args: [ Arg
--           { argCName = "checksum"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an ASCII string" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_validate_structureof_checksum_string" ostree_validate_structureof_checksum_string :: 
    CString ->                              -- checksum : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | /No description available in the introspection data./
validateStructureofChecksumString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@checksum@/: an ASCII string
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
validateStructureofChecksumString :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m ()
validateStructureofChecksumString Text
checksum = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
checksum' <- Text -> IO CString
textToCString Text
checksum
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CString -> Ptr (Ptr GError) -> IO CInt
ostree_validate_structureof_checksum_string CString
checksum'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
checksum'
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
checksum'
     )


-- function validate_rev
-- Args: [ Arg
--           { argCName = "rev"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A revision string" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_validate_rev" ostree_validate_rev :: 
    CString ->                              -- rev : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | /No description available in the introspection data./
validateRev ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@rev@/: A revision string
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
validateRev :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m ()
validateRev Text
rev = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
rev' <- Text -> IO CString
textToCString Text
rev
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CString -> Ptr (Ptr GError) -> IO CInt
ostree_validate_rev CString
rev'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
rev'
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
rev'
     )


-- function validate_remote_name
-- Args: [ Arg
--           { argCName = "remote_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A remote name" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_validate_remote_name" ostree_validate_remote_name :: 
    CString ->                              -- remote_name : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | /No description available in the introspection data./
-- 
-- /Since: 2017.8/
validateRemoteName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@remoteName@/: A remote name
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
validateRemoteName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m ()
validateRemoteName Text
remoteName = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
remoteName' <- Text -> IO CString
textToCString Text
remoteName
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CString -> Ptr (Ptr GError) -> IO CInt
ostree_validate_remote_name CString
remoteName'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
remoteName'
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
remoteName'
     )


-- function validate_collection_id
-- Args: [ Arg
--           { argCName = "collection_id"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A collection ID" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_validate_collection_id" ostree_validate_collection_id :: 
    CString ->                              -- collection_id : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Check whether the given /@collectionId@/ is valid. Return an error if it is
-- invalid or 'P.Nothing'.
-- 
-- Valid collection IDs are reverse DNS names:
--  * They are composed of 1 or more elements separated by a period (@.@) character.
--    All elements must contain at least one character.
--  * Each element must only contain the ASCII characters @[A-Z][a-z][0-9]_@ and must not
--    begin with a digit.
--  * They must contain at least one @.@ (period) character (and thus at least two elements).
--  * They must not begin with a @.@ (period) character.
--  * They must not exceed 255 characters in length.
-- 
-- (This makes their format identical to D-Bus interface names, for consistency.)
-- 
-- /Since: 2018.6/
validateCollectionId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    -- ^ /@collectionId@/: A collection ID
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
validateCollectionId :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Maybe Text -> m ()
validateCollectionId Maybe Text
collectionId = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
maybeCollectionId <- case Maybe Text
collectionId of
        Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jCollectionId -> do
            CString
jCollectionId' <- Text -> IO CString
textToCString Text
jCollectionId
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jCollectionId'
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CString -> Ptr (Ptr GError) -> IO CInt
ostree_validate_collection_id CString
maybeCollectionId
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeCollectionId
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeCollectionId
     )


-- function validate_checksum_string
-- Args: [ Arg
--           { argCName = "sha256"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "SHA256 hex string" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_validate_checksum_string" ostree_validate_checksum_string :: 
    CString ->                              -- sha256 : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Use this function to see if input strings are checksums.
validateChecksumString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@sha256@/: SHA256 hex string
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
validateChecksumString :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m ()
validateChecksumString Text
sha256 = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
sha256' <- Text -> IO CString
textToCString Text
sha256
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CString -> Ptr (Ptr GError) -> IO CInt
ostree_validate_checksum_string CString
sha256'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
sha256'
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
sha256'
     )


-- function raw_file_to_content_stream
-- Args: [ Arg
--           { argCName = "input"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "File raw content stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "file_info"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "FileInfo" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A file info" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "xattrs"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Optional extended attributes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_input"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Serialized object stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "out_length"
--           , argType = TBasicType TUInt64
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of stream" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_raw_file_to_content_stream" ostree_raw_file_to_content_stream :: 
    Ptr Gio.InputStream.InputStream ->      -- input : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Gio.FileInfo.FileInfo ->            -- file_info : TInterface (Name {namespace = "Gio", name = "FileInfo"})
    Ptr GVariant ->                         -- xattrs : TVariant
    Ptr (Ptr Gio.InputStream.InputStream) -> -- out_input : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Word64 ->                           -- out_length : TBasicType TUInt64
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Convert from a \"bare\" file representation into an
-- OSTREE_OBJECT_TYPE_FILE stream.  This is a fundamental operation
-- for writing data to an t'GI.OSTree.Objects.Repo.Repo'.
rawFileToContentStream ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.InputStream.IsInputStream a, Gio.FileInfo.IsFileInfo b, Gio.Cancellable.IsCancellable c) =>
    a
    -- ^ /@input@/: File raw content stream
    -> b
    -- ^ /@fileInfo@/: A file info
    -> Maybe (GVariant)
    -- ^ /@xattrs@/: Optional extended attributes
    -> Maybe (c)
    -- ^ /@cancellable@/: Cancellable
    -> m ((Gio.InputStream.InputStream, Word64))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
rawFileToContentStream :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsInputStream a, IsFileInfo b,
 IsCancellable c) =>
a -> b -> Maybe GVariant -> Maybe c -> m (InputStream, Word64)
rawFileToContentStream a
input b
fileInfo Maybe GVariant
xattrs Maybe c
cancellable = IO (InputStream, Word64) -> m (InputStream, Word64)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (InputStream, Word64) -> m (InputStream, Word64))
-> IO (InputStream, Word64) -> m (InputStream, Word64)
forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
input' <- a -> IO (Ptr InputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
input
    Ptr FileInfo
fileInfo' <- b -> IO (Ptr FileInfo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
fileInfo
    Ptr GVariant
maybeXattrs <- case Maybe GVariant
xattrs of
        Maybe GVariant
Nothing -> Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
forall a. Ptr a
nullPtr
        Just GVariant
jXattrs -> do
            Ptr GVariant
jXattrs' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
jXattrs
            Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
jXattrs'
    Ptr (Ptr InputStream)
outInput <- IO (Ptr (Ptr InputStream))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Gio.InputStream.InputStream))
    Ptr Word64
outLength <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO (InputStream, Word64) -> IO () -> IO (InputStream, Word64)
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr InputStream
-> Ptr FileInfo
-> Ptr GVariant
-> Ptr (Ptr InputStream)
-> Ptr Word64
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_raw_file_to_content_stream Ptr InputStream
input' Ptr FileInfo
fileInfo' Ptr GVariant
maybeXattrs Ptr (Ptr InputStream)
outInput Ptr Word64
outLength Ptr Cancellable
maybeCancellable
        Ptr InputStream
outInput' <- Ptr (Ptr InputStream) -> IO (Ptr InputStream)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr InputStream)
outInput
        InputStream
outInput'' <- ((ManagedPtr InputStream -> InputStream)
-> Ptr InputStream -> IO InputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr InputStream -> InputStream
Gio.InputStream.InputStream) Ptr InputStream
outInput'
        Word64
outLength' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
outLength
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
input
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
fileInfo
        Maybe GVariant -> (GVariant -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe GVariant
xattrs GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Ptr (Ptr InputStream) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr InputStream)
outInput
        Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
outLength
        (InputStream, Word64) -> IO (InputStream, Word64)
forall (m :: * -> *) a. Monad m => a -> m a
return (InputStream
outInput'', Word64
outLength')
     ) (do
        Ptr (Ptr InputStream) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr InputStream)
outInput
        Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
outLength
     )


-- function raw_file_to_archive_z2_stream_with_options
-- Args: [ Arg
--           { argCName = "input"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "File raw content stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "file_info"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "FileInfo" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A file info" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "xattrs"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Optional extended attributes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "options"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "A GVariant `a{sv}` with an extensible set of flags"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_input"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Serialized object stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_raw_file_to_archive_z2_stream_with_options" ostree_raw_file_to_archive_z2_stream_with_options :: 
    Ptr Gio.InputStream.InputStream ->      -- input : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Gio.FileInfo.FileInfo ->            -- file_info : TInterface (Name {namespace = "Gio", name = "FileInfo"})
    Ptr GVariant ->                         -- xattrs : TVariant
    Ptr GVariant ->                         -- options : TVariant
    Ptr (Ptr Gio.InputStream.InputStream) -> -- out_input : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Like 'GI.OSTree.Functions.rawFileToArchiveZ2Stream', but supports an extensible set
-- of flags. The following flags are currently defined:
-- 
-- * @compression-level@ (@i@): Level of compression to use, 0–9, with 0 being
-- the least compression, and \<0 giving the default level (currently 6).
-- 
-- 
-- /Since: 2017.3/
rawFileToArchiveZ2StreamWithOptions ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.InputStream.IsInputStream a, Gio.FileInfo.IsFileInfo b, Gio.Cancellable.IsCancellable c) =>
    a
    -- ^ /@input@/: File raw content stream
    -> b
    -- ^ /@fileInfo@/: A file info
    -> Maybe (GVariant)
    -- ^ /@xattrs@/: Optional extended attributes
    -> Maybe (GVariant)
    -- ^ /@options@/: A GVariant @a{sv}@ with an extensible set of flags
    -> Maybe (c)
    -- ^ /@cancellable@/: Cancellable
    -> m (Gio.InputStream.InputStream)
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
rawFileToArchiveZ2StreamWithOptions :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsInputStream a, IsFileInfo b,
 IsCancellable c) =>
a
-> b
-> Maybe GVariant
-> Maybe GVariant
-> Maybe c
-> m InputStream
rawFileToArchiveZ2StreamWithOptions a
input b
fileInfo Maybe GVariant
xattrs Maybe GVariant
options Maybe c
cancellable = IO InputStream -> m InputStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO InputStream -> m InputStream)
-> IO InputStream -> m InputStream
forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
input' <- a -> IO (Ptr InputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
input
    Ptr FileInfo
fileInfo' <- b -> IO (Ptr FileInfo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
fileInfo
    Ptr GVariant
maybeXattrs <- case Maybe GVariant
xattrs of
        Maybe GVariant
Nothing -> Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
forall a. Ptr a
nullPtr
        Just GVariant
jXattrs -> do
            Ptr GVariant
jXattrs' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
jXattrs
            Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
jXattrs'
    Ptr GVariant
maybeOptions <- case Maybe GVariant
options of
        Maybe GVariant
Nothing -> Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
forall a. Ptr a
nullPtr
        Just GVariant
jOptions -> do
            Ptr GVariant
jOptions' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
jOptions
            Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
jOptions'
    Ptr (Ptr InputStream)
outInput <- IO (Ptr (Ptr InputStream))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Gio.InputStream.InputStream))
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO InputStream -> IO () -> IO InputStream
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr InputStream
-> Ptr FileInfo
-> Ptr GVariant
-> Ptr GVariant
-> Ptr (Ptr InputStream)
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_raw_file_to_archive_z2_stream_with_options Ptr InputStream
input' Ptr FileInfo
fileInfo' Ptr GVariant
maybeXattrs Ptr GVariant
maybeOptions Ptr (Ptr InputStream)
outInput Ptr Cancellable
maybeCancellable
        Ptr InputStream
outInput' <- Ptr (Ptr InputStream) -> IO (Ptr InputStream)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr InputStream)
outInput
        InputStream
outInput'' <- ((ManagedPtr InputStream -> InputStream)
-> Ptr InputStream -> IO InputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr InputStream -> InputStream
Gio.InputStream.InputStream) Ptr InputStream
outInput'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
input
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
fileInfo
        Maybe GVariant -> (GVariant -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe GVariant
xattrs GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Maybe GVariant -> (GVariant -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe GVariant
options GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Ptr (Ptr InputStream) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr InputStream)
outInput
        InputStream -> IO InputStream
forall (m :: * -> *) a. Monad m => a -> m a
return InputStream
outInput''
     ) (do
        Ptr (Ptr InputStream) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr InputStream)
outInput
     )


-- function raw_file_to_archive_z2_stream
-- Args: [ Arg
--           { argCName = "input"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "File raw content stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "file_info"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "FileInfo" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A file info" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "xattrs"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Optional extended attributes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_input"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Serialized object stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_raw_file_to_archive_z2_stream" ostree_raw_file_to_archive_z2_stream :: 
    Ptr Gio.InputStream.InputStream ->      -- input : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Gio.FileInfo.FileInfo ->            -- file_info : TInterface (Name {namespace = "Gio", name = "FileInfo"})
    Ptr GVariant ->                         -- xattrs : TVariant
    Ptr (Ptr Gio.InputStream.InputStream) -> -- out_input : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Convert from a \"bare\" file representation into an
-- OSTREE_OBJECT_TYPE_FILE stream suitable for ostree pull.
-- 
-- /Since: 2016.6/
rawFileToArchiveZ2Stream ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.InputStream.IsInputStream a, Gio.FileInfo.IsFileInfo b, Gio.Cancellable.IsCancellable c) =>
    a
    -- ^ /@input@/: File raw content stream
    -> b
    -- ^ /@fileInfo@/: A file info
    -> Maybe (GVariant)
    -- ^ /@xattrs@/: Optional extended attributes
    -> Maybe (c)
    -- ^ /@cancellable@/: Cancellable
    -> m (Gio.InputStream.InputStream)
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
rawFileToArchiveZ2Stream :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsInputStream a, IsFileInfo b,
 IsCancellable c) =>
a -> b -> Maybe GVariant -> Maybe c -> m InputStream
rawFileToArchiveZ2Stream a
input b
fileInfo Maybe GVariant
xattrs Maybe c
cancellable = IO InputStream -> m InputStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO InputStream -> m InputStream)
-> IO InputStream -> m InputStream
forall a b. (a -> b) -> a -> b
$ do
    Ptr InputStream
input' <- a -> IO (Ptr InputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
input
    Ptr FileInfo
fileInfo' <- b -> IO (Ptr FileInfo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
fileInfo
    Ptr GVariant
maybeXattrs <- case Maybe GVariant
xattrs of
        Maybe GVariant
Nothing -> Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
forall a. Ptr a
nullPtr
        Just GVariant
jXattrs -> do
            Ptr GVariant
jXattrs' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
jXattrs
            Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
jXattrs'
    Ptr (Ptr InputStream)
outInput <- IO (Ptr (Ptr InputStream))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Gio.InputStream.InputStream))
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO InputStream -> IO () -> IO InputStream
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr InputStream
-> Ptr FileInfo
-> Ptr GVariant
-> Ptr (Ptr InputStream)
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_raw_file_to_archive_z2_stream Ptr InputStream
input' Ptr FileInfo
fileInfo' Ptr GVariant
maybeXattrs Ptr (Ptr InputStream)
outInput Ptr Cancellable
maybeCancellable
        Ptr InputStream
outInput' <- Ptr (Ptr InputStream) -> IO (Ptr InputStream)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr InputStream)
outInput
        InputStream
outInput'' <- ((ManagedPtr InputStream -> InputStream)
-> Ptr InputStream -> IO InputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr InputStream -> InputStream
Gio.InputStream.InputStream) Ptr InputStream
outInput'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
input
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
fileInfo
        Maybe GVariant -> (GVariant -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe GVariant
xattrs GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Ptr (Ptr InputStream) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr InputStream)
outInput
        InputStream -> IO InputStream
forall (m :: * -> *) a. Monad m => a -> m a
return InputStream
outInput''
     ) (do
        Ptr (Ptr InputStream) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr InputStream)
outInput
     )


-- function parse_refspec
-- Args: [ Arg
--           { argCName = "refspec"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A \"refspec\" string"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_remote"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Return location for the remote name,\n   or %NULL if the refspec refs to a local ref"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "out_ref"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return location for the ref name"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_parse_refspec" ostree_parse_refspec :: 
    CString ->                              -- refspec : TBasicType TUTF8
    Ptr CString ->                          -- out_remote : TBasicType TUTF8
    Ptr CString ->                          -- out_ref : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Split a refspec like @gnome-ostree:gnome-ostree\/buildmain@ or just
-- @gnome-ostree\/buildmain@ into two parts. In the first case, /@outRemote@/
-- will be set to @gnome-ostree@, and /@outRef@/ to @gnome-ostree\/buildmain@.
-- In the second case (a local ref), /@outRemote@/ will be 'P.Nothing', and /@outRef@/
-- will be @gnome-ostree\/buildmain@. In both cases, 'P.True' will be returned.
parseRefspec ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@refspec@/: A \"refspec\" string
    -> m ((Maybe T.Text, T.Text))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
parseRefspec :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m (Maybe Text, Text)
parseRefspec Text
refspec = IO (Maybe Text, Text) -> m (Maybe Text, Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text, Text) -> m (Maybe Text, Text))
-> IO (Maybe Text, Text) -> m (Maybe Text, Text)
forall a b. (a -> b) -> a -> b
$ do
    CString
refspec' <- Text -> IO CString
textToCString Text
refspec
    Ptr CString
outRemote <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr CString
outRef <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    IO (Maybe Text, Text) -> IO () -> IO (Maybe Text, Text)
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CString
-> Ptr CString -> Ptr CString -> Ptr (Ptr GError) -> IO CInt
ostree_parse_refspec CString
refspec' Ptr CString
outRemote Ptr CString
outRef
        CString
outRemote' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
outRemote
        Maybe Text
maybeOutRemote' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
outRemote' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
outRemote'' -> do
            Text
outRemote''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
outRemote''
            Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
outRemote'''
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
outRemote'
        CString
outRef' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
outRef
        Text
outRef'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
outRef'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
outRef'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
refspec'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outRemote
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outRef
        (Maybe Text, Text) -> IO (Maybe Text, Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Text
maybeOutRemote', Text
outRef'')
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
refspec'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outRemote
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outRef
     )


-- function object_type_to_string
-- Args: [ Arg
--           { argCName = "objtype"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "ObjectType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeObjectType"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_object_type_to_string" ostree_object_type_to_string :: 
    CUInt ->                                -- objtype : TInterface (Name {namespace = "OSTree", name = "ObjectType"})
    IO CString

-- | Serialize /@objtype@/ to a string; this is used for file extensions.
objectTypeToString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    OSTree.Enums.ObjectType
    -- ^ /@objtype@/: an t'GI.OSTree.Enums.ObjectType'
    -> m T.Text
objectTypeToString :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ObjectType -> m Text
objectTypeToString ObjectType
objtype = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    let objtype' :: CUInt
objtype' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (ObjectType -> Int) -> ObjectType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectType -> Int
forall a. Enum a => a -> Int
fromEnum) ObjectType
objtype
    CString
result <- CUInt -> IO CString
ostree_object_type_to_string CUInt
objtype'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"objectTypeToString" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function object_type_from_string
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A stringified version of #OstreeObjectType"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "OSTree" , name = "ObjectType" })
-- throws : False
-- Skip return : False

foreign import ccall "ostree_object_type_from_string" ostree_object_type_from_string :: 
    CString ->                              -- str : TBasicType TUTF8
    IO CUInt

-- | The reverse of 'GI.OSTree.Functions.objectTypeToString'.
objectTypeFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@str@/: A stringified version of t'GI.OSTree.Enums.ObjectType'
    -> m OSTree.Enums.ObjectType
objectTypeFromString :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m ObjectType
objectTypeFromString Text
str = IO ObjectType -> m ObjectType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ObjectType -> m ObjectType) -> IO ObjectType -> m ObjectType
forall a b. (a -> b) -> a -> b
$ do
    CString
str' <- Text -> IO CString
textToCString Text
str
    CUInt
result <- CString -> IO CUInt
ostree_object_type_from_string CString
str'
    let result' :: ObjectType
result' = (Int -> ObjectType
forall a. Enum a => Int -> a
toEnum (Int -> ObjectType) -> (CUInt -> Int) -> CUInt -> ObjectType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
str'
    ObjectType -> IO ObjectType
forall (m :: * -> *) a. Monad m => a -> m a
return ObjectType
result'


-- function object_to_string
-- Args: [ Arg
--           { argCName = "checksum"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An ASCII checksum" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "objtype"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "ObjectType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Object type" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_object_to_string" ostree_object_to_string :: 
    CString ->                              -- checksum : TBasicType TUTF8
    CUInt ->                                -- objtype : TInterface (Name {namespace = "OSTree", name = "ObjectType"})
    IO CString

-- | /No description available in the introspection data./
objectToString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@checksum@/: An ASCII checksum
    -> OSTree.Enums.ObjectType
    -- ^ /@objtype@/: Object type
    -> m T.Text
    -- ^ __Returns:__ A string containing both /@checksum@/ and a stringifed version of /@objtype@/
objectToString :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> ObjectType -> m Text
objectToString Text
checksum ObjectType
objtype = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
checksum' <- Text -> IO CString
textToCString Text
checksum
    let objtype' :: CUInt
objtype' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (ObjectType -> Int) -> ObjectType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectType -> Int
forall a. Enum a => a -> Int
fromEnum) ObjectType
objtype
    CString
result <- CString -> CUInt -> IO CString
ostree_object_to_string CString
checksum' CUInt
objtype'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"objectToString" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
checksum'
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function object_name_serialize
-- Args: [ Arg
--           { argCName = "checksum"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An ASCII checksum" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "objtype"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "ObjectType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An object type" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "ostree_object_name_serialize" ostree_object_name_serialize :: 
    CString ->                              -- checksum : TBasicType TUTF8
    CUInt ->                                -- objtype : TInterface (Name {namespace = "OSTree", name = "ObjectType"})
    IO (Ptr GVariant)

-- | /No description available in the introspection data./
objectNameSerialize ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@checksum@/: An ASCII checksum
    -> OSTree.Enums.ObjectType
    -- ^ /@objtype@/: An object type
    -> m GVariant
    -- ^ __Returns:__ A new floating t'GVariant' containing checksum string and objtype
objectNameSerialize :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> ObjectType -> m GVariant
objectNameSerialize Text
checksum ObjectType
objtype = IO GVariant -> m GVariant
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GVariant -> m GVariant) -> IO GVariant -> m GVariant
forall a b. (a -> b) -> a -> b
$ do
    CString
checksum' <- Text -> IO CString
textToCString Text
checksum
    let objtype' :: CUInt
objtype' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (ObjectType -> Int) -> ObjectType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectType -> Int
forall a. Enum a => a -> Int
fromEnum) ObjectType
objtype
    Ptr GVariant
result <- CString -> CUInt -> IO (Ptr GVariant)
ostree_object_name_serialize CString
checksum' CUInt
objtype'
    Text -> Ptr GVariant -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"objectNameSerialize" Ptr GVariant
result
    GVariant
result' <- Ptr GVariant -> IO GVariant
B.GVariant.newGVariantFromPtr Ptr GVariant
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
checksum'
    GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result'


-- function object_name_deserialize
-- Args: [ Arg
--           { argCName = "variant"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GVariant of type (su)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_checksum"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Pointer into string memory of @variant with checksum"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_objtype"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "ObjectType" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return object type" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_object_name_deserialize" ostree_object_name_deserialize :: 
    Ptr GVariant ->                         -- variant : TVariant
    Ptr CString ->                          -- out_checksum : TBasicType TUTF8
    Ptr CUInt ->                            -- out_objtype : TInterface (Name {namespace = "OSTree", name = "ObjectType"})
    IO ()

-- | Reverse 'GI.OSTree.Functions.objectNameSerialize'.  Note that /@outChecksum@/ is
-- only valid for the lifetime of /@variant@/, and must not be freed.
objectNameDeserialize ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GVariant
    -- ^ /@variant@/: A t'GVariant' of type (su)
    -> m ((T.Text, OSTree.Enums.ObjectType))
objectNameDeserialize :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GVariant -> m (Text, ObjectType)
objectNameDeserialize GVariant
variant = IO (Text, ObjectType) -> m (Text, ObjectType)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Text, ObjectType) -> m (Text, ObjectType))
-> IO (Text, ObjectType) -> m (Text, ObjectType)
forall a b. (a -> b) -> a -> b
$ do
    Ptr GVariant
variant' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
variant
    Ptr CString
outChecksum <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr CUInt
outObjtype <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
    Ptr GVariant -> Ptr CString -> Ptr CUInt -> IO ()
ostree_object_name_deserialize Ptr GVariant
variant' Ptr CString
outChecksum Ptr CUInt
outObjtype
    CString
outChecksum' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
outChecksum
    Text
outChecksum'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
outChecksum'
    CUInt
outObjtype' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
outObjtype
    let outObjtype'' :: ObjectType
outObjtype'' = (Int -> ObjectType
forall a. Enum a => Int -> a
toEnum (Int -> ObjectType) -> (CUInt -> Int) -> CUInt -> ObjectType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
outObjtype'
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
variant
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outChecksum
    Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
outObjtype
    (Text, ObjectType) -> IO (Text, ObjectType)
forall (m :: * -> *) a. Monad m => a -> m a
return (Text
outChecksum'', ObjectType
outObjtype'')


-- function object_from_string
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An ASCII checksum" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_checksum"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Parsed checksum" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "out_objtype"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "ObjectType" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Parsed object type" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_object_from_string" ostree_object_from_string :: 
    CString ->                              -- str : TBasicType TUTF8
    Ptr CString ->                          -- out_checksum : TBasicType TUTF8
    Ptr CUInt ->                            -- out_objtype : TInterface (Name {namespace = "OSTree", name = "ObjectType"})
    IO ()

-- | Reverse 'GI.OSTree.Functions.objectToString'.
objectFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@str@/: An ASCII checksum
    -> m ((T.Text, OSTree.Enums.ObjectType))
objectFromString :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m (Text, ObjectType)
objectFromString Text
str = IO (Text, ObjectType) -> m (Text, ObjectType)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Text, ObjectType) -> m (Text, ObjectType))
-> IO (Text, ObjectType) -> m (Text, ObjectType)
forall a b. (a -> b) -> a -> b
$ do
    CString
str' <- Text -> IO CString
textToCString Text
str
    Ptr CString
outChecksum <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr CUInt
outObjtype <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
    CString -> Ptr CString -> Ptr CUInt -> IO ()
ostree_object_from_string CString
str' Ptr CString
outChecksum Ptr CUInt
outObjtype
    CString
outChecksum' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
outChecksum
    Text
outChecksum'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
outChecksum'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
outChecksum'
    CUInt
outObjtype' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
outObjtype
    let outObjtype'' :: ObjectType
outObjtype'' = (Int -> ObjectType
forall a. Enum a => Int -> a
toEnum (Int -> ObjectType) -> (CUInt -> Int) -> CUInt -> ObjectType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
outObjtype'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
str'
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outChecksum
    Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
outObjtype
    (Text, ObjectType) -> IO (Text, ObjectType)
forall (m :: * -> *) a. Monad m => a -> m a
return (Text
outChecksum'', ObjectType
outObjtype'')


-- function metadata_variant_type
-- Args: [ Arg
--           { argCName = "objtype"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "ObjectType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "GLib" , name = "VariantType" })
-- throws : False
-- Skip return : False

foreign import ccall "ostree_metadata_variant_type" ostree_metadata_variant_type :: 
    CUInt ->                                -- objtype : TInterface (Name {namespace = "OSTree", name = "ObjectType"})
    IO (Ptr GLib.VariantType.VariantType)

-- | /No description available in the introspection data./
metadataVariantType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    OSTree.Enums.ObjectType
    -> m GLib.VariantType.VariantType
metadataVariantType :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ObjectType -> m VariantType
metadataVariantType ObjectType
objtype = IO VariantType -> m VariantType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO VariantType -> m VariantType)
-> IO VariantType -> m VariantType
forall a b. (a -> b) -> a -> b
$ do
    let objtype' :: CUInt
objtype' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (ObjectType -> Int) -> ObjectType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectType -> Int
forall a. Enum a => a -> Int
fromEnum) ObjectType
objtype
    Ptr VariantType
result <- CUInt -> IO (Ptr VariantType)
ostree_metadata_variant_type CUInt
objtype'
    Text -> Ptr VariantType -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"metadataVariantType" Ptr VariantType
result
    VariantType
result' <- ((ManagedPtr VariantType -> VariantType)
-> Ptr VariantType -> IO VariantType
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr VariantType -> VariantType
GLib.VariantType.VariantType) Ptr VariantType
result
    VariantType -> IO VariantType
forall (m :: * -> *) a. Monad m => a -> m a
return VariantType
result'


-- function hash_object_name
-- Args: [ Arg
--           { argCName = "a"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GVariant containing a serialized object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_hash_object_name" ostree_hash_object_name :: 
    Ptr () ->                               -- a : TBasicType TPtr
    IO Word32

-- | Use this function with t'GI.GLib.Structs.HashTable.HashTable' and 'GI.OSTree.Functions.objectNameSerialize'.
hashObjectName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    -- ^ /@a@/: A t'GVariant' containing a serialized object
    -> m Word32
hashObjectName :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ptr () -> m Word32
hashObjectName Ptr ()
a = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Word32
result <- Ptr () -> IO Word32
ostree_hash_object_name Ptr ()
a
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function gpg_error_quark
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_gpg_error_quark" ostree_gpg_error_quark :: 
    IO Word32

-- | /No description available in the introspection data./
-- 
-- /Since: 2017.10/
gpgErrorQuark ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
gpgErrorQuark :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word32
gpgErrorQuark  = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Word32
result <- IO Word32
ostree_gpg_error_quark
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function diff_print
-- Args: [ Arg
--           { argCName = "a"
--           , argType = TInterface Name { namespace = "Gio" , name = "File" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "First directory path"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TInterface Name { namespace = "Gio" , name = "File" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "First directory path"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "modified"
--           , argType =
--               TPtrArray
--                 (TInterface Name { namespace = "OSTree" , name = "DiffItem" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Modified files" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "removed"
--           , argType =
--               TPtrArray (TInterface Name { namespace = "Gio" , name = "File" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Removed files" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "added"
--           , argType =
--               TPtrArray (TInterface Name { namespace = "Gio" , name = "File" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Added files" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_diff_print" ostree_diff_print :: 
    Ptr Gio.File.File ->                    -- a : TInterface (Name {namespace = "Gio", name = "File"})
    Ptr Gio.File.File ->                    -- b : TInterface (Name {namespace = "Gio", name = "File"})
    Ptr (GPtrArray (Ptr OSTree.DiffItem.DiffItem)) -> -- modified : TPtrArray (TInterface (Name {namespace = "OSTree", name = "DiffItem"}))
    Ptr (GPtrArray (Ptr Gio.File.File)) ->  -- removed : TPtrArray (TInterface (Name {namespace = "Gio", name = "File"}))
    Ptr (GPtrArray (Ptr Gio.File.File)) ->  -- added : TPtrArray (TInterface (Name {namespace = "Gio", name = "File"}))
    IO ()

-- | Print the contents of a diff to stdout.
diffPrint ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a, Gio.File.IsFile b) =>
    a
    -- ^ /@a@/: First directory path
    -> b
    -- ^ /@b@/: First directory path
    -> [OSTree.DiffItem.DiffItem]
    -- ^ /@modified@/: Modified files
    -> [Gio.File.File]
    -- ^ /@removed@/: Removed files
    -> [Gio.File.File]
    -- ^ /@added@/: Added files
    -> m ()
diffPrint :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsFile a, IsFile b) =>
a -> b -> [DiffItem] -> [File] -> [File] -> m ()
diffPrint a
a b
b [DiffItem]
modified [File]
removed [File]
added = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
a' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
a
    Ptr File
b' <- b -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
b
    [Ptr DiffItem]
modified' <- (DiffItem -> IO (Ptr DiffItem)) -> [DiffItem] -> IO [Ptr DiffItem]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM DiffItem -> IO (Ptr DiffItem)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [DiffItem]
modified
    Ptr (GPtrArray (Ptr DiffItem))
modified'' <- [Ptr DiffItem] -> IO (Ptr (GPtrArray (Ptr DiffItem)))
forall a. [Ptr a] -> IO (Ptr (GPtrArray (Ptr a)))
packGPtrArray [Ptr DiffItem]
modified'
    [Ptr File]
removed' <- (File -> IO (Ptr File)) -> [File] -> IO [Ptr File]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM File -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr [File]
removed
    Ptr (GPtrArray (Ptr File))
removed'' <- [Ptr File] -> IO (Ptr (GPtrArray (Ptr File)))
forall a. [Ptr a] -> IO (Ptr (GPtrArray (Ptr a)))
packGPtrArray [Ptr File]
removed'
    [Ptr File]
added' <- (File -> IO (Ptr File)) -> [File] -> IO [Ptr File]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM File -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr [File]
added
    Ptr (GPtrArray (Ptr File))
added'' <- [Ptr File] -> IO (Ptr (GPtrArray (Ptr File)))
forall a. [Ptr a] -> IO (Ptr (GPtrArray (Ptr a)))
packGPtrArray [Ptr File]
added'
    Ptr File
-> Ptr File
-> Ptr (GPtrArray (Ptr DiffItem))
-> Ptr (GPtrArray (Ptr File))
-> Ptr (GPtrArray (Ptr File))
-> IO ()
ostree_diff_print Ptr File
a' Ptr File
b' Ptr (GPtrArray (Ptr DiffItem))
modified'' Ptr (GPtrArray (Ptr File))
removed'' Ptr (GPtrArray (Ptr File))
added''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
a
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
b
    (DiffItem -> IO ()) -> [DiffItem] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ DiffItem -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [DiffItem]
modified
    (File -> IO ()) -> [File] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ File -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [File]
removed
    (File -> IO ()) -> [File] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ File -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [File]
added
    Ptr (GPtrArray (Ptr DiffItem)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr DiffItem))
modified''
    Ptr (GPtrArray (Ptr File)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr File))
removed''
    Ptr (GPtrArray (Ptr File)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr File))
added''
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function diff_dirs_with_options
-- Args: [ Arg
--           { argCName = "flags"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "DiffFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Flags" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "a"
--           , argType = TInterface Name { namespace = "Gio" , name = "File" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "First directory path, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TInterface Name { namespace = "Gio" , name = "File" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "First directory path"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "modified"
--           , argType =
--               TPtrArray
--                 (TInterface Name { namespace = "OSTree" , name = "DiffItem" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Modified files" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "removed"
--           , argType =
--               TPtrArray (TInterface Name { namespace = "Gio" , name = "File" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Removed files" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "added"
--           , argType =
--               TPtrArray (TInterface Name { namespace = "Gio" , name = "File" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Added files" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "options"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "DiffDirsOptions" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Options" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_diff_dirs_with_options" ostree_diff_dirs_with_options :: 
    CUInt ->                                -- flags : TInterface (Name {namespace = "OSTree", name = "DiffFlags"})
    Ptr Gio.File.File ->                    -- a : TInterface (Name {namespace = "Gio", name = "File"})
    Ptr Gio.File.File ->                    -- b : TInterface (Name {namespace = "Gio", name = "File"})
    Ptr (GPtrArray (Ptr OSTree.DiffItem.DiffItem)) -> -- modified : TPtrArray (TInterface (Name {namespace = "OSTree", name = "DiffItem"}))
    Ptr (GPtrArray (Ptr Gio.File.File)) ->  -- removed : TPtrArray (TInterface (Name {namespace = "Gio", name = "File"}))
    Ptr (GPtrArray (Ptr Gio.File.File)) ->  -- added : TPtrArray (TInterface (Name {namespace = "Gio", name = "File"}))
    Ptr OSTree.DiffDirsOptions.DiffDirsOptions -> -- options : TInterface (Name {namespace = "OSTree", name = "DiffDirsOptions"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Compute the difference between directory /@a@/ and /@b@/ as 3 separate
-- sets of t'GI.OSTree.Structs.DiffItem.DiffItem' in /@modified@/, /@removed@/, and /@added@/.
-- 
-- /Since: 2017.4/
diffDirsWithOptions ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a, Gio.File.IsFile b, Gio.Cancellable.IsCancellable c) =>
    [OSTree.Flags.DiffFlags]
    -- ^ /@flags@/: Flags
    -> a
    -- ^ /@a@/: First directory path, or 'P.Nothing'
    -> b
    -- ^ /@b@/: First directory path
    -> [OSTree.DiffItem.DiffItem]
    -- ^ /@modified@/: Modified files
    -> [Gio.File.File]
    -- ^ /@removed@/: Removed files
    -> [Gio.File.File]
    -- ^ /@added@/: Added files
    -> Maybe (OSTree.DiffDirsOptions.DiffDirsOptions)
    -- ^ /@options@/: Options
    -> Maybe (c)
    -- ^ /@cancellable@/: Cancellable
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
diffDirsWithOptions :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsFile a, IsFile b, IsCancellable c) =>
[DiffFlags]
-> a
-> b
-> [DiffItem]
-> [File]
-> [File]
-> Maybe DiffDirsOptions
-> Maybe c
-> m ()
diffDirsWithOptions [DiffFlags]
flags a
a b
b [DiffItem]
modified [File]
removed [File]
added Maybe DiffDirsOptions
options Maybe c
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let flags' :: CUInt
flags' = [DiffFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [DiffFlags]
flags
    Ptr File
a' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
a
    Ptr File
b' <- b -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
b
    [Ptr DiffItem]
modified' <- (DiffItem -> IO (Ptr DiffItem)) -> [DiffItem] -> IO [Ptr DiffItem]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM DiffItem -> IO (Ptr DiffItem)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [DiffItem]
modified
    Ptr (GPtrArray (Ptr DiffItem))
modified'' <- [Ptr DiffItem] -> IO (Ptr (GPtrArray (Ptr DiffItem)))
forall a. [Ptr a] -> IO (Ptr (GPtrArray (Ptr a)))
packGPtrArray [Ptr DiffItem]
modified'
    [Ptr File]
removed' <- (File -> IO (Ptr File)) -> [File] -> IO [Ptr File]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM File -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr [File]
removed
    Ptr (GPtrArray (Ptr File))
removed'' <- [Ptr File] -> IO (Ptr (GPtrArray (Ptr File)))
forall a. [Ptr a] -> IO (Ptr (GPtrArray (Ptr a)))
packGPtrArray [Ptr File]
removed'
    [Ptr File]
added' <- (File -> IO (Ptr File)) -> [File] -> IO [Ptr File]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM File -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr [File]
added
    Ptr (GPtrArray (Ptr File))
added'' <- [Ptr File] -> IO (Ptr (GPtrArray (Ptr File)))
forall a. [Ptr a] -> IO (Ptr (GPtrArray (Ptr a)))
packGPtrArray [Ptr File]
added'
    Ptr DiffDirsOptions
maybeOptions <- case Maybe DiffDirsOptions
options of
        Maybe DiffDirsOptions
Nothing -> Ptr DiffDirsOptions -> IO (Ptr DiffDirsOptions)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr DiffDirsOptions
forall a. Ptr a
nullPtr
        Just DiffDirsOptions
jOptions -> do
            Ptr DiffDirsOptions
jOptions' <- DiffDirsOptions -> IO (Ptr DiffDirsOptions)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffDirsOptions
jOptions
            Ptr DiffDirsOptions -> IO (Ptr DiffDirsOptions)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr DiffDirsOptions
jOptions'
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CUInt
-> Ptr File
-> Ptr File
-> Ptr (GPtrArray (Ptr DiffItem))
-> Ptr (GPtrArray (Ptr File))
-> Ptr (GPtrArray (Ptr File))
-> Ptr DiffDirsOptions
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_diff_dirs_with_options CUInt
flags' Ptr File
a' Ptr File
b' Ptr (GPtrArray (Ptr DiffItem))
modified'' Ptr (GPtrArray (Ptr File))
removed'' Ptr (GPtrArray (Ptr File))
added'' Ptr DiffDirsOptions
maybeOptions Ptr Cancellable
maybeCancellable
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
a
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
b
        (DiffItem -> IO ()) -> [DiffItem] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ DiffItem -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [DiffItem]
modified
        (File -> IO ()) -> [File] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ File -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [File]
removed
        (File -> IO ()) -> [File] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ File -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [File]
added
        Maybe DiffDirsOptions -> (DiffDirsOptions -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe DiffDirsOptions
options DiffDirsOptions -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Ptr (GPtrArray (Ptr DiffItem)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr DiffItem))
modified''
        Ptr (GPtrArray (Ptr File)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr File))
removed''
        Ptr (GPtrArray (Ptr File)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr File))
added''
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        Ptr (GPtrArray (Ptr DiffItem)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr DiffItem))
modified''
        Ptr (GPtrArray (Ptr File)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr File))
removed''
        Ptr (GPtrArray (Ptr File)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr File))
added''
     )


-- function diff_dirs
-- Args: [ Arg
--           { argCName = "flags"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "DiffFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Flags" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "a"
--           , argType = TInterface Name { namespace = "Gio" , name = "File" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "First directory path, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TInterface Name { namespace = "Gio" , name = "File" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "First directory path"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "modified"
--           , argType =
--               TPtrArray
--                 (TInterface Name { namespace = "OSTree" , name = "DiffItem" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Modified files" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "removed"
--           , argType =
--               TPtrArray (TInterface Name { namespace = "Gio" , name = "File" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Removed files" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "added"
--           , argType =
--               TPtrArray (TInterface Name { namespace = "Gio" , name = "File" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Added files" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_diff_dirs" ostree_diff_dirs :: 
    CUInt ->                                -- flags : TInterface (Name {namespace = "OSTree", name = "DiffFlags"})
    Ptr Gio.File.File ->                    -- a : TInterface (Name {namespace = "Gio", name = "File"})
    Ptr Gio.File.File ->                    -- b : TInterface (Name {namespace = "Gio", name = "File"})
    Ptr (GPtrArray (Ptr OSTree.DiffItem.DiffItem)) -> -- modified : TPtrArray (TInterface (Name {namespace = "OSTree", name = "DiffItem"}))
    Ptr (GPtrArray (Ptr Gio.File.File)) ->  -- removed : TPtrArray (TInterface (Name {namespace = "Gio", name = "File"}))
    Ptr (GPtrArray (Ptr Gio.File.File)) ->  -- added : TPtrArray (TInterface (Name {namespace = "Gio", name = "File"}))
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Compute the difference between directory /@a@/ and /@b@/ as 3 separate
-- sets of t'GI.OSTree.Structs.DiffItem.DiffItem' in /@modified@/, /@removed@/, and /@added@/.
diffDirs ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a, Gio.File.IsFile b, Gio.Cancellable.IsCancellable c) =>
    [OSTree.Flags.DiffFlags]
    -- ^ /@flags@/: Flags
    -> a
    -- ^ /@a@/: First directory path, or 'P.Nothing'
    -> b
    -- ^ /@b@/: First directory path
    -> [OSTree.DiffItem.DiffItem]
    -- ^ /@modified@/: Modified files
    -> [Gio.File.File]
    -- ^ /@removed@/: Removed files
    -> [Gio.File.File]
    -- ^ /@added@/: Added files
    -> Maybe (c)
    -- ^ /@cancellable@/: Cancellable
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
diffDirs :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsFile a, IsFile b, IsCancellable c) =>
[DiffFlags]
-> a -> b -> [DiffItem] -> [File] -> [File] -> Maybe c -> m ()
diffDirs [DiffFlags]
flags a
a b
b [DiffItem]
modified [File]
removed [File]
added Maybe c
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let flags' :: CUInt
flags' = [DiffFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [DiffFlags]
flags
    Ptr File
a' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
a
    Ptr File
b' <- b -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
b
    [Ptr DiffItem]
modified' <- (DiffItem -> IO (Ptr DiffItem)) -> [DiffItem] -> IO [Ptr DiffItem]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM DiffItem -> IO (Ptr DiffItem)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [DiffItem]
modified
    Ptr (GPtrArray (Ptr DiffItem))
modified'' <- [Ptr DiffItem] -> IO (Ptr (GPtrArray (Ptr DiffItem)))
forall a. [Ptr a] -> IO (Ptr (GPtrArray (Ptr a)))
packGPtrArray [Ptr DiffItem]
modified'
    [Ptr File]
removed' <- (File -> IO (Ptr File)) -> [File] -> IO [Ptr File]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM File -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr [File]
removed
    Ptr (GPtrArray (Ptr File))
removed'' <- [Ptr File] -> IO (Ptr (GPtrArray (Ptr File)))
forall a. [Ptr a] -> IO (Ptr (GPtrArray (Ptr a)))
packGPtrArray [Ptr File]
removed'
    [Ptr File]
added' <- (File -> IO (Ptr File)) -> [File] -> IO [Ptr File]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM File -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr [File]
added
    Ptr (GPtrArray (Ptr File))
added'' <- [Ptr File] -> IO (Ptr (GPtrArray (Ptr File)))
forall a. [Ptr a] -> IO (Ptr (GPtrArray (Ptr a)))
packGPtrArray [Ptr File]
added'
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CUInt
-> Ptr File
-> Ptr File
-> Ptr (GPtrArray (Ptr DiffItem))
-> Ptr (GPtrArray (Ptr File))
-> Ptr (GPtrArray (Ptr File))
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_diff_dirs CUInt
flags' Ptr File
a' Ptr File
b' Ptr (GPtrArray (Ptr DiffItem))
modified'' Ptr (GPtrArray (Ptr File))
removed'' Ptr (GPtrArray (Ptr File))
added'' Ptr Cancellable
maybeCancellable
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
a
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
b
        (DiffItem -> IO ()) -> [DiffItem] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ DiffItem -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [DiffItem]
modified
        (File -> IO ()) -> [File] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ File -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [File]
removed
        (File -> IO ()) -> [File] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ File -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [File]
added
        Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Ptr (GPtrArray (Ptr DiffItem)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr DiffItem))
modified''
        Ptr (GPtrArray (Ptr File)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr File))
removed''
        Ptr (GPtrArray (Ptr File)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr File))
added''
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        Ptr (GPtrArray (Ptr DiffItem)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr DiffItem))
modified''
        Ptr (GPtrArray (Ptr File)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr File))
removed''
        Ptr (GPtrArray (Ptr File)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr File))
added''
     )


-- function create_directory_metadata
-- Args: [ Arg
--           { argCName = "dir_info"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "FileInfo" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GFileInfo containing directory information"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "xattrs"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Optional extended attributes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "ostree_create_directory_metadata" ostree_create_directory_metadata :: 
    Ptr Gio.FileInfo.FileInfo ->            -- dir_info : TInterface (Name {namespace = "Gio", name = "FileInfo"})
    Ptr GVariant ->                         -- xattrs : TVariant
    IO (Ptr GVariant)

-- | /No description available in the introspection data./
createDirectoryMetadata ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.FileInfo.IsFileInfo a) =>
    a
    -- ^ /@dirInfo@/: a t'GI.Gio.Objects.FileInfo.FileInfo' containing directory information
    -> Maybe (GVariant)
    -- ^ /@xattrs@/: Optional extended attributes
    -> m GVariant
    -- ^ __Returns:__ A new t'GVariant' containing 'GI.OSTree.Enums.ObjectTypeDirMeta'
createDirectoryMetadata :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFileInfo a) =>
a -> Maybe GVariant -> m GVariant
createDirectoryMetadata a
dirInfo Maybe GVariant
xattrs = IO GVariant -> m GVariant
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GVariant -> m GVariant) -> IO GVariant -> m GVariant
forall a b. (a -> b) -> a -> b
$ do
    Ptr FileInfo
dirInfo' <- a -> IO (Ptr FileInfo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
dirInfo
    Ptr GVariant
maybeXattrs <- case Maybe GVariant
xattrs of
        Maybe GVariant
Nothing -> Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
forall a. Ptr a
nullPtr
        Just GVariant
jXattrs -> do
            Ptr GVariant
jXattrs' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
jXattrs
            Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
jXattrs'
    Ptr GVariant
result <- Ptr FileInfo -> Ptr GVariant -> IO (Ptr GVariant)
ostree_create_directory_metadata Ptr FileInfo
dirInfo' Ptr GVariant
maybeXattrs
    Text -> Ptr GVariant -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"createDirectoryMetadata" Ptr GVariant
result
    GVariant
result' <- Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr Ptr GVariant
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
dirInfo
    Maybe GVariant -> (GVariant -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe GVariant
xattrs GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result'


-- function content_stream_parse
-- Args: [ Arg
--           { argCName = "compressed"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Whether or not the stream is zlib-compressed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "input"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Object content stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "input_length"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of stream" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "trusted"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "If %TRUE, assume the content has been validated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_input"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The raw file content stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "out_file_info"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "FileInfo" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Normal metadata" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "out_xattrs"
--           , argType = TVariant
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Extended attributes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_content_stream_parse" ostree_content_stream_parse :: 
    CInt ->                                 -- compressed : TBasicType TBoolean
    Ptr Gio.InputStream.InputStream ->      -- input : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Word64 ->                               -- input_length : TBasicType TUInt64
    CInt ->                                 -- trusted : TBasicType TBoolean
    Ptr (Ptr Gio.InputStream.InputStream) -> -- out_input : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr (Ptr Gio.FileInfo.FileInfo) ->      -- out_file_info : TInterface (Name {namespace = "Gio", name = "FileInfo"})
    Ptr (Ptr GVariant) ->                   -- out_xattrs : TVariant
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | The reverse of 'GI.OSTree.Functions.rawFileToContentStream'; this function
-- converts an object content stream back into components.
contentStreamParse ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.InputStream.IsInputStream a, Gio.Cancellable.IsCancellable b) =>
    Bool
    -- ^ /@compressed@/: Whether or not the stream is zlib-compressed
    -> a
    -- ^ /@input@/: Object content stream
    -> Word64
    -- ^ /@inputLength@/: Length of stream
    -> Bool
    -- ^ /@trusted@/: If 'P.True', assume the content has been validated
    -> Maybe (b)
    -- ^ /@cancellable@/: Cancellable
    -> m ((Gio.InputStream.InputStream, Gio.FileInfo.FileInfo, GVariant))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
contentStreamParse :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) =>
Bool
-> a
-> Word64
-> Bool
-> Maybe b
-> m (InputStream, FileInfo, GVariant)
contentStreamParse Bool
compressed a
input Word64
inputLength Bool
trusted Maybe b
cancellable = IO (InputStream, FileInfo, GVariant)
-> m (InputStream, FileInfo, GVariant)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (InputStream, FileInfo, GVariant)
 -> m (InputStream, FileInfo, GVariant))
-> IO (InputStream, FileInfo, GVariant)
-> m (InputStream, FileInfo, GVariant)
forall a b. (a -> b) -> a -> b
$ do
    let compressed' :: CInt
compressed' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
compressed
    Ptr InputStream
input' <- a -> IO (Ptr InputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
input
    let trusted' :: CInt
trusted' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
trusted
    Ptr (Ptr InputStream)
outInput <- IO (Ptr (Ptr InputStream))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Gio.InputStream.InputStream))
    Ptr (Ptr FileInfo)
outFileInfo <- IO (Ptr (Ptr FileInfo))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Gio.FileInfo.FileInfo))
    Ptr (Ptr GVariant)
outXattrs <- IO (Ptr (Ptr GVariant))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr GVariant))
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO (InputStream, FileInfo, GVariant)
-> IO () -> IO (InputStream, FileInfo, GVariant)
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CInt
-> Ptr InputStream
-> Word64
-> CInt
-> Ptr (Ptr InputStream)
-> Ptr (Ptr FileInfo)
-> Ptr (Ptr GVariant)
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_content_stream_parse CInt
compressed' Ptr InputStream
input' Word64
inputLength CInt
trusted' Ptr (Ptr InputStream)
outInput Ptr (Ptr FileInfo)
outFileInfo Ptr (Ptr GVariant)
outXattrs Ptr Cancellable
maybeCancellable
        Ptr InputStream
outInput' <- Ptr (Ptr InputStream) -> IO (Ptr InputStream)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr InputStream)
outInput
        InputStream
outInput'' <- ((ManagedPtr InputStream -> InputStream)
-> Ptr InputStream -> IO InputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr InputStream -> InputStream
Gio.InputStream.InputStream) Ptr InputStream
outInput'
        Ptr FileInfo
outFileInfo' <- Ptr (Ptr FileInfo) -> IO (Ptr FileInfo)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr FileInfo)
outFileInfo
        FileInfo
outFileInfo'' <- ((ManagedPtr FileInfo -> FileInfo) -> Ptr FileInfo -> IO FileInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileInfo -> FileInfo
Gio.FileInfo.FileInfo) Ptr FileInfo
outFileInfo'
        Ptr GVariant
outXattrs' <- Ptr (Ptr GVariant) -> IO (Ptr GVariant)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr GVariant)
outXattrs
        GVariant
outXattrs'' <- Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr Ptr GVariant
outXattrs'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
input
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Ptr (Ptr InputStream) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr InputStream)
outInput
        Ptr (Ptr FileInfo) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr FileInfo)
outFileInfo
        Ptr (Ptr GVariant) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr GVariant)
outXattrs
        (InputStream, FileInfo, GVariant)
-> IO (InputStream, FileInfo, GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return (InputStream
outInput'', FileInfo
outFileInfo'', GVariant
outXattrs'')
     ) (do
        Ptr (Ptr InputStream) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr InputStream)
outInput
        Ptr (Ptr FileInfo) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr FileInfo)
outFileInfo
        Ptr (Ptr GVariant) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr GVariant)
outXattrs
     )


-- function content_file_parse_at
-- Args: [ Arg
--           { argCName = "compressed"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Whether or not the stream is zlib-compressed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "parent_dfd"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Directory file descriptor"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Subpath" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "trusted"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "If %TRUE, assume the content has been validated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_input"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The raw file content stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "out_file_info"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "FileInfo" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Normal metadata" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "out_xattrs"
--           , argType = TVariant
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Extended attributes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_content_file_parse_at" ostree_content_file_parse_at :: 
    CInt ->                                 -- compressed : TBasicType TBoolean
    Int32 ->                                -- parent_dfd : TBasicType TInt
    CString ->                              -- path : TBasicType TUTF8
    CInt ->                                 -- trusted : TBasicType TBoolean
    Ptr (Ptr Gio.InputStream.InputStream) -> -- out_input : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr (Ptr Gio.FileInfo.FileInfo) ->      -- out_file_info : TInterface (Name {namespace = "Gio", name = "FileInfo"})
    Ptr (Ptr GVariant) ->                   -- out_xattrs : TVariant
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | A thin wrapper for 'GI.OSTree.Functions.contentStreamParse'; this function
-- converts an object content stream back into components.
contentFileParseAt ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
    Bool
    -- ^ /@compressed@/: Whether or not the stream is zlib-compressed
    -> Int32
    -- ^ /@parentDfd@/: Directory file descriptor
    -> T.Text
    -- ^ /@path@/: Subpath
    -> Bool
    -- ^ /@trusted@/: If 'P.True', assume the content has been validated
    -> Maybe (a)
    -- ^ /@cancellable@/: Cancellable
    -> m ((Gio.InputStream.InputStream, Gio.FileInfo.FileInfo, GVariant))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
contentFileParseAt :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Bool
-> Int32
-> Text
-> Bool
-> Maybe a
-> m (InputStream, FileInfo, GVariant)
contentFileParseAt Bool
compressed Int32
parentDfd Text
path Bool
trusted Maybe a
cancellable = IO (InputStream, FileInfo, GVariant)
-> m (InputStream, FileInfo, GVariant)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (InputStream, FileInfo, GVariant)
 -> m (InputStream, FileInfo, GVariant))
-> IO (InputStream, FileInfo, GVariant)
-> m (InputStream, FileInfo, GVariant)
forall a b. (a -> b) -> a -> b
$ do
    let compressed' :: CInt
compressed' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
compressed
    CString
path' <- Text -> IO CString
textToCString Text
path
    let trusted' :: CInt
trusted' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
trusted
    Ptr (Ptr InputStream)
outInput <- IO (Ptr (Ptr InputStream))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Gio.InputStream.InputStream))
    Ptr (Ptr FileInfo)
outFileInfo <- IO (Ptr (Ptr FileInfo))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Gio.FileInfo.FileInfo))
    Ptr (Ptr GVariant)
outXattrs <- IO (Ptr (Ptr GVariant))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr GVariant))
    Ptr Cancellable
maybeCancellable <- case Maybe a
cancellable of
        Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just a
jCancellable -> do
            Ptr Cancellable
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO (InputStream, FileInfo, GVariant)
-> IO () -> IO (InputStream, FileInfo, GVariant)
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CInt
-> Int32
-> CString
-> CInt
-> Ptr (Ptr InputStream)
-> Ptr (Ptr FileInfo)
-> Ptr (Ptr GVariant)
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_content_file_parse_at CInt
compressed' Int32
parentDfd CString
path' CInt
trusted' Ptr (Ptr InputStream)
outInput Ptr (Ptr FileInfo)
outFileInfo Ptr (Ptr GVariant)
outXattrs Ptr Cancellable
maybeCancellable
        Ptr InputStream
outInput' <- Ptr (Ptr InputStream) -> IO (Ptr InputStream)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr InputStream)
outInput
        InputStream
outInput'' <- ((ManagedPtr InputStream -> InputStream)
-> Ptr InputStream -> IO InputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr InputStream -> InputStream
Gio.InputStream.InputStream) Ptr InputStream
outInput'
        Ptr FileInfo
outFileInfo' <- Ptr (Ptr FileInfo) -> IO (Ptr FileInfo)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr FileInfo)
outFileInfo
        FileInfo
outFileInfo'' <- ((ManagedPtr FileInfo -> FileInfo) -> Ptr FileInfo -> IO FileInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileInfo -> FileInfo
Gio.FileInfo.FileInfo) Ptr FileInfo
outFileInfo'
        Ptr GVariant
outXattrs' <- Ptr (Ptr GVariant) -> IO (Ptr GVariant)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr GVariant)
outXattrs
        GVariant
outXattrs'' <- Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr Ptr GVariant
outXattrs'
        Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
cancellable a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
        Ptr (Ptr InputStream) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr InputStream)
outInput
        Ptr (Ptr FileInfo) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr FileInfo)
outFileInfo
        Ptr (Ptr GVariant) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr GVariant)
outXattrs
        (InputStream, FileInfo, GVariant)
-> IO (InputStream, FileInfo, GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return (InputStream
outInput'', FileInfo
outFileInfo'', GVariant
outXattrs'')
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
        Ptr (Ptr InputStream) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr InputStream)
outInput
        Ptr (Ptr FileInfo) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr FileInfo)
outFileInfo
        Ptr (Ptr GVariant) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr GVariant)
outXattrs
     )


-- function content_file_parse
-- Args: [ Arg
--           { argCName = "compressed"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Whether or not the stream is zlib-compressed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "content_path"
--           , argType = TInterface Name { namespace = "Gio" , name = "File" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Path to file containing content"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "trusted"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "If %TRUE, assume the content has been validated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_input"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The raw file content stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "out_file_info"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "FileInfo" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Normal metadata" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "out_xattrs"
--           , argType = TVariant
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Extended attributes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_content_file_parse" ostree_content_file_parse :: 
    CInt ->                                 -- compressed : TBasicType TBoolean
    Ptr Gio.File.File ->                    -- content_path : TInterface (Name {namespace = "Gio", name = "File"})
    CInt ->                                 -- trusted : TBasicType TBoolean
    Ptr (Ptr Gio.InputStream.InputStream) -> -- out_input : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr (Ptr Gio.FileInfo.FileInfo) ->      -- out_file_info : TInterface (Name {namespace = "Gio", name = "FileInfo"})
    Ptr (Ptr GVariant) ->                   -- out_xattrs : TVariant
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | A thin wrapper for 'GI.OSTree.Functions.contentStreamParse'; this function
-- converts an object content stream back into components.
contentFileParse ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a, Gio.Cancellable.IsCancellable b) =>
    Bool
    -- ^ /@compressed@/: Whether or not the stream is zlib-compressed
    -> a
    -- ^ /@contentPath@/: Path to file containing content
    -> Bool
    -- ^ /@trusted@/: If 'P.True', assume the content has been validated
    -> Maybe (b)
    -- ^ /@cancellable@/: Cancellable
    -> m ((Gio.InputStream.InputStream, Gio.FileInfo.FileInfo, GVariant))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
contentFileParse :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsFile a, IsCancellable b) =>
Bool -> a -> Bool -> Maybe b -> m (InputStream, FileInfo, GVariant)
contentFileParse Bool
compressed a
contentPath Bool
trusted Maybe b
cancellable = IO (InputStream, FileInfo, GVariant)
-> m (InputStream, FileInfo, GVariant)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (InputStream, FileInfo, GVariant)
 -> m (InputStream, FileInfo, GVariant))
-> IO (InputStream, FileInfo, GVariant)
-> m (InputStream, FileInfo, GVariant)
forall a b. (a -> b) -> a -> b
$ do
    let compressed' :: CInt
compressed' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
compressed
    Ptr File
contentPath' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
contentPath
    let trusted' :: CInt
trusted' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
trusted
    Ptr (Ptr InputStream)
outInput <- IO (Ptr (Ptr InputStream))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Gio.InputStream.InputStream))
    Ptr (Ptr FileInfo)
outFileInfo <- IO (Ptr (Ptr FileInfo))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Gio.FileInfo.FileInfo))
    Ptr (Ptr GVariant)
outXattrs <- IO (Ptr (Ptr GVariant))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr GVariant))
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO (InputStream, FileInfo, GVariant)
-> IO () -> IO (InputStream, FileInfo, GVariant)
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CInt
-> Ptr File
-> CInt
-> Ptr (Ptr InputStream)
-> Ptr (Ptr FileInfo)
-> Ptr (Ptr GVariant)
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_content_file_parse CInt
compressed' Ptr File
contentPath' CInt
trusted' Ptr (Ptr InputStream)
outInput Ptr (Ptr FileInfo)
outFileInfo Ptr (Ptr GVariant)
outXattrs Ptr Cancellable
maybeCancellable
        Ptr InputStream
outInput' <- Ptr (Ptr InputStream) -> IO (Ptr InputStream)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr InputStream)
outInput
        InputStream
outInput'' <- ((ManagedPtr InputStream -> InputStream)
-> Ptr InputStream -> IO InputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr InputStream -> InputStream
Gio.InputStream.InputStream) Ptr InputStream
outInput'
        Ptr FileInfo
outFileInfo' <- Ptr (Ptr FileInfo) -> IO (Ptr FileInfo)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr FileInfo)
outFileInfo
        FileInfo
outFileInfo'' <- ((ManagedPtr FileInfo -> FileInfo) -> Ptr FileInfo -> IO FileInfo
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr FileInfo -> FileInfo
Gio.FileInfo.FileInfo) Ptr FileInfo
outFileInfo'
        Ptr GVariant
outXattrs' <- Ptr (Ptr GVariant) -> IO (Ptr GVariant)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr GVariant)
outXattrs
        GVariant
outXattrs'' <- Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr Ptr GVariant
outXattrs'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
contentPath
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Ptr (Ptr InputStream) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr InputStream)
outInput
        Ptr (Ptr FileInfo) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr FileInfo)
outFileInfo
        Ptr (Ptr GVariant) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr GVariant)
outXattrs
        (InputStream, FileInfo, GVariant)
-> IO (InputStream, FileInfo, GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return (InputStream
outInput'', FileInfo
outFileInfo'', GVariant
outXattrs'')
     ) (do
        Ptr (Ptr InputStream) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr InputStream)
outInput
        Ptr (Ptr FileInfo) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr FileInfo)
outFileInfo
        Ptr (Ptr GVariant) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr GVariant)
outXattrs
     )


-- function commit_metadata_for_bootable
-- Args: [ Arg
--           { argCName = "root"
--           , argType = TInterface Name { namespace = "Gio" , name = "File" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Root filesystem to be committed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "dict"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "VariantDict" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Dictionary to update"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_commit_metadata_for_bootable" ostree_commit_metadata_for_bootable :: 
    Ptr Gio.File.File ->                    -- root : TInterface (Name {namespace = "Gio", name = "File"})
    Ptr GLib.VariantDict.VariantDict ->     -- dict : TInterface (Name {namespace = "GLib", name = "VariantDict"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Update provided /@dict@/ with standard metadata for bootable OSTree commits.
-- 
-- /Since: 2021.1/
commitMetadataForBootable ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@root@/: Root filesystem to be committed
    -> GLib.VariantDict.VariantDict
    -- ^ /@dict@/: Dictionary to update
    -> Maybe (b)
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
commitMetadataForBootable :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsFile a, IsCancellable b) =>
a -> VariantDict -> Maybe b -> m ()
commitMetadataForBootable a
root VariantDict
dict Maybe b
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
root' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
root
    Ptr VariantDict
dict' <- VariantDict -> IO (Ptr VariantDict)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr VariantDict
dict
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr VariantDict
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_commit_metadata_for_bootable Ptr File
root' Ptr VariantDict
dict' Ptr Cancellable
maybeCancellable
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
root
        VariantDict -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr VariantDict
dict
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )


-- function commit_get_timestamp
-- Args: [ Arg
--           { argCName = "commit_variant"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Commit object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_commit_get_timestamp" ostree_commit_get_timestamp :: 
    Ptr GVariant ->                         -- commit_variant : TVariant
    IO Word64

-- | /No description available in the introspection data./
-- 
-- /Since: 2016.3/
commitGetTimestamp ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GVariant
    -- ^ /@commitVariant@/: Commit object
    -> m Word64
    -- ^ __Returns:__ timestamp in seconds since the Unix epoch, UTC
commitGetTimestamp :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GVariant -> m Word64
commitGetTimestamp GVariant
commitVariant = IO Word64 -> m Word64
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
forall a b. (a -> b) -> a -> b
$ do
    Ptr GVariant
commitVariant' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
commitVariant
    Word64
result <- Ptr GVariant -> IO Word64
ostree_commit_get_timestamp Ptr GVariant
commitVariant'
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
commitVariant
    Word64 -> IO Word64
forall (m :: * -> *) a. Monad m => a -> m a
return Word64
result


-- function commit_get_parent
-- Args: [ Arg
--           { argCName = "commit_variant"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Variant of type %OSTREE_OBJECT_TYPE_COMMIT"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_commit_get_parent" ostree_commit_get_parent :: 
    Ptr GVariant ->                         -- commit_variant : TVariant
    IO CString

-- | /No description available in the introspection data./
commitGetParent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GVariant
    -- ^ /@commitVariant@/: Variant of type 'GI.OSTree.Enums.ObjectTypeCommit'
    -> m T.Text
    -- ^ __Returns:__ Checksum of the parent commit of /@commitVariant@/, or 'P.Nothing'
    -- if none
commitGetParent :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GVariant -> m Text
commitGetParent GVariant
commitVariant = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr GVariant
commitVariant' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
commitVariant
    CString
result <- Ptr GVariant -> IO CString
ostree_commit_get_parent Ptr GVariant
commitVariant'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"commitGetParent" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
commitVariant
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function commit_get_object_sizes
-- Args: [ Arg
--           { argCName = "commit_variant"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "variant of type %OSTREE_OBJECT_TYPE_COMMIT"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_sizes_entries"
--           , argType =
--               TPtrArray
--                 (TInterface
--                    Name { namespace = "OSTree" , name = "CommitSizesEntry" })
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "\n  return location for an array of object size entries"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferContainer
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_commit_get_object_sizes" ostree_commit_get_object_sizes :: 
    Ptr GVariant ->                         -- commit_variant : TVariant
    Ptr (Ptr (GPtrArray (Ptr OSTree.CommitSizesEntry.CommitSizesEntry))) -> -- out_sizes_entries : TPtrArray (TInterface (Name {namespace = "OSTree", name = "CommitSizesEntry"}))
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Reads a commit\'s \"ostree.sizes\" metadata and returns an array of
-- t'GI.OSTree.Structs.CommitSizesEntry.CommitSizesEntry' in /@outSizesEntries@/. Each element
-- represents an object in the commit. If the commit does not contain
-- the \"ostree.sizes\" metadata, a 'GI.Gio.Enums.IOErrorEnumNotFound' error will be
-- returned.
-- 
-- /Since: 2020.1/
commitGetObjectSizes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GVariant
    -- ^ /@commitVariant@/: variant of type 'GI.OSTree.Enums.ObjectTypeCommit'
    -> m ([OSTree.CommitSizesEntry.CommitSizesEntry])
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
commitGetObjectSizes :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GVariant -> m [CommitSizesEntry]
commitGetObjectSizes GVariant
commitVariant = IO [CommitSizesEntry] -> m [CommitSizesEntry]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [CommitSizesEntry] -> m [CommitSizesEntry])
-> IO [CommitSizesEntry] -> m [CommitSizesEntry]
forall a b. (a -> b) -> a -> b
$ do
    Ptr GVariant
commitVariant' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
commitVariant
    Ptr (Ptr (GPtrArray (Ptr CommitSizesEntry)))
outSizesEntries <- IO (Ptr (Ptr (GPtrArray (Ptr CommitSizesEntry))))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr (GPtrArray (Ptr OSTree.CommitSizesEntry.CommitSizesEntry))))
    IO [CommitSizesEntry] -> IO () -> IO [CommitSizesEntry]
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr GVariant
-> Ptr (Ptr (GPtrArray (Ptr CommitSizesEntry)))
-> Ptr (Ptr GError)
-> IO CInt
ostree_commit_get_object_sizes Ptr GVariant
commitVariant' Ptr (Ptr (GPtrArray (Ptr CommitSizesEntry)))
outSizesEntries
        Ptr (GPtrArray (Ptr CommitSizesEntry))
outSizesEntries' <- Ptr (Ptr (GPtrArray (Ptr CommitSizesEntry)))
-> IO (Ptr (GPtrArray (Ptr CommitSizesEntry)))
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr (GPtrArray (Ptr CommitSizesEntry)))
outSizesEntries
        [Ptr CommitSizesEntry]
outSizesEntries'' <- Ptr (GPtrArray (Ptr CommitSizesEntry)) -> IO [Ptr CommitSizesEntry]
forall a. Ptr (GPtrArray (Ptr a)) -> IO [Ptr a]
unpackGPtrArray Ptr (GPtrArray (Ptr CommitSizesEntry))
outSizesEntries'
        [CommitSizesEntry]
outSizesEntries''' <- (Ptr CommitSizesEntry -> IO CommitSizesEntry)
-> [Ptr CommitSizesEntry] -> IO [CommitSizesEntry]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr CommitSizesEntry -> CommitSizesEntry)
-> Ptr CommitSizesEntry -> IO CommitSizesEntry
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr CommitSizesEntry -> CommitSizesEntry
OSTree.CommitSizesEntry.CommitSizesEntry) [Ptr CommitSizesEntry]
outSizesEntries''
        Ptr (GPtrArray (Ptr CommitSizesEntry)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr CommitSizesEntry))
outSizesEntries'
        GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
commitVariant
        Ptr (Ptr (GPtrArray (Ptr CommitSizesEntry))) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr (GPtrArray (Ptr CommitSizesEntry)))
outSizesEntries
        [CommitSizesEntry] -> IO [CommitSizesEntry]
forall (m :: * -> *) a. Monad m => a -> m a
return [CommitSizesEntry]
outSizesEntries'''
     ) (do
        Ptr (Ptr (GPtrArray (Ptr CommitSizesEntry))) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr (GPtrArray (Ptr CommitSizesEntry)))
outSizesEntries
     )


-- function commit_get_content_checksum
-- Args: [ Arg
--           { argCName = "commit_variant"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A commit object" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_commit_get_content_checksum" ostree_commit_get_content_checksum :: 
    Ptr GVariant ->                         -- commit_variant : TVariant
    IO CString

-- | There are use cases where one wants a checksum just of the content of a
-- commit. OSTree commits by default capture the current timestamp, and may have
-- additional metadata, which means that re-committing identical content
-- often results in a new checksum.
-- 
-- By comparing checksums of content, it\'s possible to easily distinguish
-- cases where nothing actually changed.
-- 
-- The content checksums is simply defined as @SHA256(root dirtree_checksum || root_dirmeta_checksum)@,
-- i.e. the SHA-256 of the root \"dirtree\" object\'s checksum concatenated with the
-- root \"dirmeta\" checksum (both in binary form, not hexadecimal).
-- 
-- /Since: 2018.2/
commitGetContentChecksum ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GVariant
    -- ^ /@commitVariant@/: A commit object
    -> m (Maybe T.Text)
    -- ^ __Returns:__ A SHA-256 hex string, or 'P.Nothing' if /@commitVariant@/ is not well-formed
commitGetContentChecksum :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GVariant -> m (Maybe Text)
commitGetContentChecksum GVariant
commitVariant = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr GVariant
commitVariant' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
commitVariant
    CString
result <- Ptr GVariant -> IO CString
ostree_commit_get_content_checksum Ptr GVariant
commitVariant'
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
commitVariant
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function cmp_checksum_bytes
-- Args: [ Arg
--           { argCName = "a"
--           , argType = TBasicType TUInt8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A binary checksum" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TBasicType TUInt8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A binary checksum" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_cmp_checksum_bytes" ostree_cmp_checksum_bytes :: 
    Word8 ->                                -- a : TBasicType TUInt8
    Word8 ->                                -- b : TBasicType TUInt8
    IO Int32

-- | Compare two binary checksums, using @/memcmp()/@.
cmpChecksumBytes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word8
    -- ^ /@a@/: A binary checksum
    -> Word8
    -- ^ /@b@/: A binary checksum
    -> m Int32
cmpChecksumBytes :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Word8 -> Word8 -> m Int32
cmpChecksumBytes Word8
a Word8
b = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Int32
result <- Word8 -> Word8 -> IO Int32
ostree_cmp_checksum_bytes Word8
a Word8
b
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function cmd__private__
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "OSTree" , name = "CmdPrivateVTable" })
-- throws : False
-- Skip return : False

foreign import ccall "ostree_cmd__private__" ostree_cmd__private__ :: 
    IO (Ptr OSTree.CmdPrivateVTable.CmdPrivateVTable)

-- | /No description available in the introspection data./
cmd_Private__ ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m OSTree.CmdPrivateVTable.CmdPrivateVTable
cmd_Private__ :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
m CmdPrivateVTable
cmd_Private__  = IO CmdPrivateVTable -> m CmdPrivateVTable
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CmdPrivateVTable -> m CmdPrivateVTable)
-> IO CmdPrivateVTable -> m CmdPrivateVTable
forall a b. (a -> b) -> a -> b
$ do
    Ptr CmdPrivateVTable
result <- IO (Ptr CmdPrivateVTable)
ostree_cmd__private__
    Text -> Ptr CmdPrivateVTable -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"cmd_Private__" Ptr CmdPrivateVTable
result
    CmdPrivateVTable
result' <- ((ManagedPtr CmdPrivateVTable -> CmdPrivateVTable)
-> Ptr CmdPrivateVTable -> IO CmdPrivateVTable
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr CmdPrivateVTable -> CmdPrivateVTable
OSTree.CmdPrivateVTable.CmdPrivateVTable) Ptr CmdPrivateVTable
result
    CmdPrivateVTable -> IO CmdPrivateVTable
forall (m :: * -> *) a. Monad m => a -> m a
return CmdPrivateVTable
result'


-- function checksum_to_bytes_v
-- Args: [ Arg
--           { argCName = "checksum"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An ASCII checksum" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "ostree_checksum_to_bytes_v" ostree_checksum_to_bytes_v :: 
    CString ->                              -- checksum : TBasicType TUTF8
    IO (Ptr GVariant)

-- | /No description available in the introspection data./
checksumToBytesV ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@checksum@/: An ASCII checksum
    -> m GVariant
    -- ^ __Returns:__ New t'GVariant' of type ay with length 32
checksumToBytesV :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m GVariant
checksumToBytesV Text
checksum = IO GVariant -> m GVariant
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GVariant -> m GVariant) -> IO GVariant -> m GVariant
forall a b. (a -> b) -> a -> b
$ do
    CString
checksum' <- Text -> IO CString
textToCString Text
checksum
    Ptr GVariant
result <- CString -> IO (Ptr GVariant)
ostree_checksum_to_bytes_v CString
checksum'
    Text -> Ptr GVariant -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"checksumToBytesV" Ptr GVariant
result
    GVariant
result' <- Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr Ptr GVariant
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
checksum'
    GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result'


-- function checksum_to_bytes
-- Args: [ Arg
--           { argCName = "checksum"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An ASCII checksum" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TCArray False 32 (-1) (TBasicType TUInt8))
-- throws : False
-- Skip return : False

foreign import ccall "ostree_checksum_to_bytes" ostree_checksum_to_bytes :: 
    CString ->                              -- checksum : TBasicType TUTF8
    IO (Ptr Word8)

-- | /No description available in the introspection data./
checksumToBytes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@checksum@/: An ASCII checksum
    -> m ByteString
    -- ^ __Returns:__ Binary checksum from /@checksum@/ of length 32; free with 'GI.GLib.Functions.free'.
checksumToBytes :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m ByteString
checksumToBytes Text
checksum = IO ByteString -> m ByteString
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ByteString -> m ByteString) -> IO ByteString -> m ByteString
forall a b. (a -> b) -> a -> b
$ do
    CString
checksum' <- Text -> IO CString
textToCString Text
checksum
    Ptr Word8
result <- CString -> IO (Ptr Word8)
ostree_checksum_to_bytes CString
checksum'
    Text -> Ptr Word8 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"checksumToBytes" Ptr Word8
result
    ByteString
result' <- (Integer -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Integer
32) Ptr Word8
result
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
checksum'
    ByteString -> IO ByteString
forall (m :: * -> *) a. Monad m => a -> m a
return ByteString
result'


-- function checksum_inplace_to_bytes
-- Args: [ Arg
--           { argCName = "checksum"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a SHA256 string" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buf"
--           , argType = TBasicType TUInt8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Output buffer with at least 32 bytes of space"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_checksum_inplace_to_bytes" ostree_checksum_inplace_to_bytes :: 
    CString ->                              -- checksum : TBasicType TUTF8
    Word8 ->                                -- buf : TBasicType TUInt8
    IO ()

-- | Convert /@checksum@/ from a string to binary in-place, without
-- allocating memory.  Use this function in hot code paths.
checksumInplaceToBytes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@checksum@/: a SHA256 string
    -> Word8
    -- ^ /@buf@/: Output buffer with at least 32 bytes of space
    -> m ()
checksumInplaceToBytes :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Word8 -> m ()
checksumInplaceToBytes Text
checksum Word8
buf = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
checksum' <- Text -> IO CString
textToCString Text
checksum
    CString -> Word8 -> IO ()
ostree_checksum_inplace_to_bytes CString
checksum' Word8
buf
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
checksum'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function checksum_from_bytes_v
-- Args: [ Arg
--           { argCName = "csum_v"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#GVariant of type ay"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_checksum_from_bytes_v" ostree_checksum_from_bytes_v :: 
    Ptr GVariant ->                         -- csum_v : TVariant
    IO CString

-- | /No description available in the introspection data./
checksumFromBytesV ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GVariant
    -- ^ /@csumV@/: t'GVariant' of type ay
    -> m T.Text
    -- ^ __Returns:__ String form of /@csumBytes@/
checksumFromBytesV :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GVariant -> m Text
checksumFromBytesV GVariant
csumV = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr GVariant
csumV' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
csumV
    CString
result <- Ptr GVariant -> IO CString
ostree_checksum_from_bytes_v Ptr GVariant
csumV'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"checksumFromBytesV" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
csumV
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function checksum_from_bytes
-- Args: [ Arg
--           { argCName = "csum"
--           , argType = TCArray False 32 (-1) (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An binary checksum of length 32"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_checksum_from_bytes" ostree_checksum_from_bytes :: 
    Ptr Word8 ->                            -- csum : TCArray False 32 (-1) (TBasicType TUInt8)
    IO CString

-- | /No description available in the introspection data./
checksumFromBytes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@csum@/: An binary checksum of length 32
    -> m T.Text
    -- ^ __Returns:__ String form of /@csum@/
checksumFromBytes :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m Text
checksumFromBytes ByteString
csum = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Word8
csum' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
csum
    CString
result <- Ptr Word8 -> IO CString
ostree_checksum_from_bytes Ptr Word8
csum'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"checksumFromBytes" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
csum'
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function checksum_file_from_input
-- Args: [ Arg
--           { argCName = "file_info"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "FileInfo" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "File information" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "xattrs"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Optional extended attributes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "in"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "File content, should be %NULL for symbolic links"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "objtype"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "ObjectType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Object type" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_csum"
--           , argType = TCArray False 32 (-1) (TBasicType TUInt8)
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return location for binary checksum"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_checksum_file_from_input" ostree_checksum_file_from_input :: 
    Ptr Gio.FileInfo.FileInfo ->            -- file_info : TInterface (Name {namespace = "Gio", name = "FileInfo"})
    Ptr GVariant ->                         -- xattrs : TVariant
    Ptr Gio.InputStream.InputStream ->      -- in : TInterface (Name {namespace = "Gio", name = "InputStream"})
    CUInt ->                                -- objtype : TInterface (Name {namespace = "OSTree", name = "ObjectType"})
    Ptr (Ptr Word8) ->                      -- out_csum : TCArray False 32 (-1) (TBasicType TUInt8)
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Compute the OSTree checksum for a given input.
checksumFileFromInput ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.FileInfo.IsFileInfo a, Gio.InputStream.IsInputStream b, Gio.Cancellable.IsCancellable c) =>
    a
    -- ^ /@fileInfo@/: File information
    -> Maybe (GVariant)
    -- ^ /@xattrs@/: Optional extended attributes
    -> Maybe (b)
    -- ^ /@in@/: File content, should be 'P.Nothing' for symbolic links
    -> OSTree.Enums.ObjectType
    -- ^ /@objtype@/: Object type
    -> Maybe (c)
    -- ^ /@cancellable@/: Cancellable
    -> m (ByteString)
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
checksumFileFromInput :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsFileInfo a, IsInputStream b,
 IsCancellable c) =>
a
-> Maybe GVariant
-> Maybe b
-> ObjectType
-> Maybe c
-> m ByteString
checksumFileFromInput a
fileInfo Maybe GVariant
xattrs Maybe b
in_ ObjectType
objtype Maybe c
cancellable = IO ByteString -> m ByteString
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ByteString -> m ByteString) -> IO ByteString -> m ByteString
forall a b. (a -> b) -> a -> b
$ do
    Ptr FileInfo
fileInfo' <- a -> IO (Ptr FileInfo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
fileInfo
    Ptr GVariant
maybeXattrs <- case Maybe GVariant
xattrs of
        Maybe GVariant
Nothing -> Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
forall a. Ptr a
nullPtr
        Just GVariant
jXattrs -> do
            Ptr GVariant
jXattrs' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
jXattrs
            Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
jXattrs'
    Ptr InputStream
maybeIn_ <- case Maybe b
in_ of
        Maybe b
Nothing -> Ptr InputStream -> IO (Ptr InputStream)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr InputStream
forall a. Ptr a
nullPtr
        Just b
jIn_ -> do
            Ptr InputStream
jIn_' <- b -> IO (Ptr InputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jIn_
            Ptr InputStream -> IO (Ptr InputStream)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr InputStream
jIn_'
    let objtype' :: CUInt
objtype' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (ObjectType -> Int) -> ObjectType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectType -> Int
forall a. Enum a => a -> Int
fromEnum) ObjectType
objtype
    Ptr (Ptr Word8)
outCsum <- IO (Ptr (Ptr Word8))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Word8))
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Maybe c
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO ByteString -> IO () -> IO ByteString
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr FileInfo
-> Ptr GVariant
-> Ptr InputStream
-> CUInt
-> Ptr (Ptr Word8)
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_checksum_file_from_input Ptr FileInfo
fileInfo' Ptr GVariant
maybeXattrs Ptr InputStream
maybeIn_ CUInt
objtype' Ptr (Ptr Word8)
outCsum Ptr Cancellable
maybeCancellable
        Ptr Word8
outCsum' <- Ptr (Ptr Word8) -> IO (Ptr Word8)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Word8)
outCsum
        ByteString
outCsum'' <- (Integer -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Integer
32) Ptr Word8
outCsum'
        Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
outCsum'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
fileInfo
        Maybe GVariant -> (GVariant -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe GVariant
xattrs GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
in_ b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
outCsum
        ByteString -> IO ByteString
forall (m :: * -> *) a. Monad m => a -> m a
return ByteString
outCsum''
     ) (do
        Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
outCsum
     )


-- function checksum_file_at
-- Args: [ Arg
--           { argCName = "dfd"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Directory file descriptor"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Subpath\n@stbuf (allow-none): Optional stat buffer"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stbuf"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "objtype"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "ObjectType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Object type" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "ChecksumFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Flags\n@out_checksum (out) (transfer full): Return location for hex checksum"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_checksum"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_checksum_file_at" ostree_checksum_file_at :: 
    Int32 ->                                -- dfd : TBasicType TInt
    CString ->                              -- path : TBasicType TUTF8
    Ptr () ->                               -- stbuf : TBasicType TPtr
    CUInt ->                                -- objtype : TInterface (Name {namespace = "OSTree", name = "ObjectType"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "OSTree", name = "ChecksumFlags"})
    CString ->                              -- out_checksum : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Compute the OSTree checksum for a given file. This is an fd-relative version
-- of 'GI.OSTree.Functions.checksumFile' which also takes flags and fills in a caller
-- allocated buffer.
-- 
-- /Since: 2017.13/
checksumFileAt ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
    Int32
    -- ^ /@dfd@/: Directory file descriptor
    -> T.Text
    -- ^ /@path@/: Subpath
    -- /@stbuf@/ (allow-none): Optional stat buffer
    -> Ptr ()
    -> OSTree.Enums.ObjectType
    -- ^ /@objtype@/: Object type
    -> [OSTree.Flags.ChecksumFlags]
    -- ^ /@flags@/: Flags
    -- /@outChecksum@/ (out) (transfer full): Return location for hex checksum
    -> T.Text
    -> Maybe (a)
    -- ^ /@cancellable@/: Cancellable
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
checksumFileAt :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Int32
-> Text
-> Ptr ()
-> ObjectType
-> [ChecksumFlags]
-> Text
-> Maybe a
-> m ()
checksumFileAt Int32
dfd Text
path Ptr ()
stbuf ObjectType
objtype [ChecksumFlags]
flags Text
outChecksum Maybe a
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
path' <- Text -> IO CString
textToCString Text
path
    let objtype' :: CUInt
objtype' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (ObjectType -> Int) -> ObjectType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectType -> Int
forall a. Enum a => a -> Int
fromEnum) ObjectType
objtype
    let flags' :: CUInt
flags' = [ChecksumFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ChecksumFlags]
flags
    CString
outChecksum' <- Text -> IO CString
textToCString Text
outChecksum
    Ptr Cancellable
maybeCancellable <- case Maybe a
cancellable of
        Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just a
jCancellable -> do
            Ptr Cancellable
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Int32
-> CString
-> Ptr ()
-> CUInt
-> CUInt
-> CString
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_checksum_file_at Int32
dfd CString
path' Ptr ()
stbuf CUInt
objtype' CUInt
flags' CString
outChecksum' Ptr Cancellable
maybeCancellable
        Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
cancellable a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
outChecksum'
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
outChecksum'
     )


-- function checksum_file_async_finish
-- Args: [ Arg
--           { argCName = "f"
--           , argType = TInterface Name { namespace = "Gio" , name = "File" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "File path" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Async result" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_csum"
--           , argType = TCArray False 32 (-1) (TBasicType TUInt8)
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return location for binary checksum"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_checksum_file_async_finish" ostree_checksum_file_async_finish :: 
    Ptr Gio.File.File ->                    -- f : TInterface (Name {namespace = "Gio", name = "File"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr Word8) ->                      -- out_csum : TCArray False 32 (-1) (TBasicType TUInt8)
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Finish computing the OSTree checksum for a given file; see
-- 'GI.OSTree.Functions.checksumFileAsync'.
checksumFileAsyncFinish ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@f@/: File path
    -> b
    -- ^ /@result@/: Async result
    -> m (ByteString)
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
checksumFileAsyncFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsFile a, IsAsyncResult b) =>
a -> b -> m ByteString
checksumFileAsyncFinish a
f b
result_ = IO ByteString -> m ByteString
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ByteString -> m ByteString) -> IO ByteString -> m ByteString
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
f' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
f
    Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    Ptr (Ptr Word8)
outCsum <- IO (Ptr (Ptr Word8))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Word8))
    IO ByteString -> IO () -> IO ByteString
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr AsyncResult
-> Ptr (Ptr Word8)
-> Ptr (Ptr GError)
-> IO CInt
ostree_checksum_file_async_finish Ptr File
f' Ptr AsyncResult
result_' Ptr (Ptr Word8)
outCsum
        Ptr Word8
outCsum' <- Ptr (Ptr Word8) -> IO (Ptr Word8)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Word8)
outCsum
        ByteString
outCsum'' <- (Integer -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Integer
32) Ptr Word8
outCsum'
        Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
outCsum'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
f
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
outCsum
        ByteString -> IO ByteString
forall (m :: * -> *) a. Monad m => a -> m a
return ByteString
outCsum''
     ) (do
        Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
outCsum
     )


-- function checksum_file_async
-- Args: [ Arg
--           { argCName = "f"
--           , argType = TInterface Name { namespace = "Gio" , name = "File" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "File path" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "objtype"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "ObjectType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Object type" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "io_priority"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Priority for operation, see %G_IO_PRIORITY_DEFAULT"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Invoked when operation is complete"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 5
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Data for @callback" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_checksum_file_async" ostree_checksum_file_async :: 
    Ptr Gio.File.File ->                    -- f : TInterface (Name {namespace = "Gio", name = "File"})
    CUInt ->                                -- objtype : TInterface (Name {namespace = "OSTree", name = "ObjectType"})
    Int32 ->                                -- io_priority : TBasicType TInt
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Asynchronously compute the OSTree checksum for a given file;
-- complete with 'GI.OSTree.Functions.checksumFileAsyncFinish'.
checksumFileAsync ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@f@/: File path
    -> OSTree.Enums.ObjectType
    -- ^ /@objtype@/: Object type
    -> Int32
    -- ^ /@ioPriority@/: Priority for operation, see @/G_IO_PRIORITY_DEFAULT/@
    -> Maybe (b)
    -- ^ /@cancellable@/: Cancellable
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: Invoked when operation is complete
    -> m ()
checksumFileAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsFile a, IsCancellable b) =>
a
-> ObjectType
-> Int32
-> Maybe b
-> Maybe AsyncReadyCallback
-> m ()
checksumFileAsync a
f ObjectType
objtype Int32
ioPriority Maybe b
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
f' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
f
    let objtype' :: CUInt
objtype' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (ObjectType -> Int) -> ObjectType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectType -> Int
forall a. Enum a => a -> Int
fromEnum) ObjectType
objtype
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    Ptr File
-> CUInt
-> Int32
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
ostree_checksum_file_async Ptr File
f' CUInt
objtype' Int32
ioPriority Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
f
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function checksum_file
-- Args: [ Arg
--           { argCName = "f"
--           , argType = TInterface Name { namespace = "Gio" , name = "File" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "File path" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "objtype"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "ObjectType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Object type" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_csum"
--           , argType = TCArray False 32 (-1) (TBasicType TUInt8)
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return location for binary checksum"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_checksum_file" ostree_checksum_file :: 
    Ptr Gio.File.File ->                    -- f : TInterface (Name {namespace = "Gio", name = "File"})
    CUInt ->                                -- objtype : TInterface (Name {namespace = "OSTree", name = "ObjectType"})
    Ptr (Ptr Word8) ->                      -- out_csum : TCArray False 32 (-1) (TBasicType TUInt8)
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Compute the OSTree checksum for a given file.
checksumFile ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@f@/: File path
    -> OSTree.Enums.ObjectType
    -- ^ /@objtype@/: Object type
    -> Maybe (b)
    -- ^ /@cancellable@/: Cancellable
    -> m (ByteString)
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
checksumFile :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsFile a, IsCancellable b) =>
a -> ObjectType -> Maybe b -> m ByteString
checksumFile a
f ObjectType
objtype Maybe b
cancellable = IO ByteString -> m ByteString
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ByteString -> m ByteString) -> IO ByteString -> m ByteString
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
f' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
f
    let objtype' :: CUInt
objtype' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (ObjectType -> Int) -> ObjectType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ObjectType -> Int
forall a. Enum a => a -> Int
fromEnum) ObjectType
objtype
    Ptr (Ptr Word8)
outCsum <- IO (Ptr (Ptr Word8))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Word8))
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO ByteString -> IO () -> IO ByteString
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr File
-> CUInt
-> Ptr (Ptr Word8)
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_checksum_file Ptr File
f' CUInt
objtype' Ptr (Ptr Word8)
outCsum Ptr Cancellable
maybeCancellable
        Ptr Word8
outCsum' <- Ptr (Ptr Word8) -> IO (Ptr Word8)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Word8)
outCsum
        ByteString
outCsum'' <- (Integer -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Integer
32) Ptr Word8
outCsum'
        Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
outCsum'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
f
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
outCsum
        ByteString -> IO ByteString
forall (m :: * -> *) a. Monad m => a -> m a
return ByteString
outCsum''
     ) (do
        Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
outCsum
     )


-- function checksum_bytes_peek_validate
-- Args: [ Arg
--           { argCName = "bytes"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#GVariant of type ay"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TCArray False 32 (-1) (TBasicType TUInt8))
-- throws : True
-- Skip return : False

foreign import ccall "ostree_checksum_bytes_peek_validate" ostree_checksum_bytes_peek_validate :: 
    Ptr GVariant ->                         -- bytes : TVariant
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Word8)

-- | Like 'GI.OSTree.Functions.checksumBytesPeek', but also throws /@error@/.
checksumBytesPeekValidate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GVariant
    -- ^ /@bytes@/: t'GVariant' of type ay
    -> m ByteString
    -- ^ __Returns:__ Binary checksum data /(Can throw 'Data.GI.Base.GError.GError')/
checksumBytesPeekValidate :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GVariant -> m ByteString
checksumBytesPeekValidate GVariant
bytes = IO ByteString -> m ByteString
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ByteString -> m ByteString) -> IO ByteString -> m ByteString
forall a b. (a -> b) -> a -> b
$ do
    Ptr GVariant
bytes' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
bytes
    IO ByteString -> IO () -> IO ByteString
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr Word8
result <- (Ptr (Ptr GError) -> IO (Ptr Word8)) -> IO (Ptr Word8)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Word8)) -> IO (Ptr Word8))
-> (Ptr (Ptr GError) -> IO (Ptr Word8)) -> IO (Ptr Word8)
forall a b. (a -> b) -> a -> b
$ Ptr GVariant -> Ptr (Ptr GError) -> IO (Ptr Word8)
ostree_checksum_bytes_peek_validate Ptr GVariant
bytes'
        Text -> Ptr Word8 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"checksumBytesPeekValidate" Ptr Word8
result
        ByteString
result' <- (Integer -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Integer
32) Ptr Word8
result
        GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
bytes
        ByteString -> IO ByteString
forall (m :: * -> *) a. Monad m => a -> m a
return ByteString
result'
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )


-- function checksum_bytes_peek
-- Args: [ Arg
--           { argCName = "bytes"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#GVariant of type ay"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TCArray False 32 (-1) (TBasicType TUInt8))
-- throws : False
-- Skip return : False

foreign import ccall "ostree_checksum_bytes_peek" ostree_checksum_bytes_peek :: 
    Ptr GVariant ->                         -- bytes : TVariant
    IO (Ptr Word8)

-- | /No description available in the introspection data./
checksumBytesPeek ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GVariant
    -- ^ /@bytes@/: t'GVariant' of type ay
    -> m ByteString
    -- ^ __Returns:__ Binary checksum data in /@bytes@/; do not free.  If /@bytes@/ does not have the correct length, return 'P.Nothing'.
checksumBytesPeek :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GVariant -> m ByteString
checksumBytesPeek GVariant
bytes = IO ByteString -> m ByteString
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ByteString -> m ByteString) -> IO ByteString -> m ByteString
forall a b. (a -> b) -> a -> b
$ do
    Ptr GVariant
bytes' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
bytes
    Ptr Word8
result <- Ptr GVariant -> IO (Ptr Word8)
ostree_checksum_bytes_peek Ptr GVariant
bytes'
    Text -> Ptr Word8 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"checksumBytesPeek" Ptr Word8
result
    ByteString
result' <- (Integer -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Integer
32) Ptr Word8
result
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
bytes
    ByteString -> IO ByteString
forall (m :: * -> *) a. Monad m => a -> m a
return ByteString
result'


-- function checksum_b64_to_bytes
-- Args: [ Arg
--           { argCName = "checksum"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An ASCII checksum" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TCArray False 32 (-1) (TBasicType TUInt8))
-- throws : False
-- Skip return : False

foreign import ccall "ostree_checksum_b64_to_bytes" ostree_checksum_b64_to_bytes :: 
    CString ->                              -- checksum : TBasicType TUTF8
    IO (Ptr Word8)

-- | /No description available in the introspection data./
-- 
-- /Since: 2016.8/
checksumB64ToBytes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@checksum@/: An ASCII checksum
    -> m ByteString
    -- ^ __Returns:__ Binary version of /@checksum@/.
checksumB64ToBytes :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m ByteString
checksumB64ToBytes Text
checksum = IO ByteString -> m ByteString
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ByteString -> m ByteString) -> IO ByteString -> m ByteString
forall a b. (a -> b) -> a -> b
$ do
    CString
checksum' <- Text -> IO CString
textToCString Text
checksum
    Ptr Word8
result <- CString -> IO (Ptr Word8)
ostree_checksum_b64_to_bytes CString
checksum'
    Text -> Ptr Word8 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"checksumB64ToBytes" Ptr Word8
result
    ByteString
result' <- (Integer -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Integer
32) Ptr Word8
result
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
checksum'
    ByteString -> IO ByteString
forall (m :: * -> *) a. Monad m => a -> m a
return ByteString
result'


-- function checksum_b64_from_bytes
-- Args: [ Arg
--           { argCName = "csum"
--           , argType = TCArray False 32 (-1) (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "An binary checksum of length 32"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_checksum_b64_from_bytes" ostree_checksum_b64_from_bytes :: 
    Ptr Word8 ->                            -- csum : TCArray False 32 (-1) (TBasicType TUInt8)
    IO CString

-- | /No description available in the introspection data./
-- 
-- /Since: 2016.8/
checksumB64FromBytes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@csum@/: An binary checksum of length 32
    -> m T.Text
    -- ^ __Returns:__ Modified base64 encoding of /@csum@/
    -- 
    -- The \"modified\" term refers to the fact that instead of \'\/\', the \'_\'
    -- character is used.
checksumB64FromBytes :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m Text
checksumB64FromBytes ByteString
csum = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Word8
csum' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
csum
    CString
result <- Ptr Word8 -> IO CString
ostree_checksum_b64_from_bytes Ptr Word8
csum'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"checksumB64FromBytes" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
csum'
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function check_version
-- Args: [ Arg
--           { argCName = "required_year"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Major/year required"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "required_release"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Release version required"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_check_version" ostree_check_version :: 
    Word32 ->                               -- required_year : TBasicType TUInt
    Word32 ->                               -- required_release : TBasicType TUInt
    IO CInt

-- | /No description available in the introspection data./
-- 
-- /Since: 2017.4/
checkVersion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@requiredYear@/: Major\/year required
    -> Word32
    -- ^ /@requiredRelease@/: Release version required
    -> m Bool
    -- ^ __Returns:__ 'P.True' if current libostree has at least the requested version, 'P.False' otherwise
checkVersion :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Word32 -> Word32 -> m Bool
checkVersion Word32
requiredYear Word32
requiredRelease = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CInt
result <- Word32 -> Word32 -> IO CInt
ostree_check_version Word32
requiredYear Word32
requiredRelease
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function break_hardlink
-- Args: [ Arg
--           { argCName = "dfd"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Directory fd" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Path relative to @dfd"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "skip_xattrs"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Do not copy extended attributes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_break_hardlink" ostree_break_hardlink :: 
    Int32 ->                                -- dfd : TBasicType TInt
    CString ->                              -- path : TBasicType TUTF8
    CInt ->                                 -- skip_xattrs : TBasicType TBoolean
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | In many cases using libostree, a program may need to \"break\"
-- hardlinks by performing a copy.  For example, in order to
-- logically append to a file.
-- 
-- This function performs full copying, including e.g. extended
-- attributes and permissions of both regular files and symbolic links.
-- 
-- If the file is not hardlinked, this function does nothing and
-- returns successfully.
-- 
-- This function does not perform synchronization via @fsync()@ or
-- @fdatasync()@; the idea is this will commonly be done as part
-- of an @ostree_repo_commit_transaction()@, which itself takes
-- care of synchronization.
-- 
-- /Since: 2017.15/
breakHardlink ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
    Int32
    -- ^ /@dfd@/: Directory fd
    -> T.Text
    -- ^ /@path@/: Path relative to /@dfd@/
    -> Bool
    -- ^ /@skipXattrs@/: Do not copy extended attributes
    -> Maybe (a)
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
breakHardlink :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Int32 -> Text -> Bool -> Maybe a -> m ()
breakHardlink Int32
dfd Text
path Bool
skipXattrs Maybe a
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
path' <- Text -> IO CString
textToCString Text
path
    let skipXattrs' :: CInt
skipXattrs' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
skipXattrs
    Ptr Cancellable
maybeCancellable <- case Maybe a
cancellable of
        Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just a
jCancellable -> do
            Ptr Cancellable
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Int32
-> CString
-> CInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_break_hardlink Int32
dfd CString
path' CInt
skipXattrs' Ptr Cancellable
maybeCancellable
        Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
cancellable a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
     )