{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.OSTree.Objects.SePolicy
(
SePolicy(..) ,
IsSePolicy ,
toSePolicy ,
#if defined(ENABLE_OVERLOADING)
ResolveSePolicyMethod ,
#endif
sePolicyFscreateconCleanup ,
#if defined(ENABLE_OVERLOADING)
SePolicyGetCsumMethodInfo ,
#endif
sePolicyGetCsum ,
#if defined(ENABLE_OVERLOADING)
SePolicyGetLabelMethodInfo ,
#endif
sePolicyGetLabel ,
#if defined(ENABLE_OVERLOADING)
SePolicyGetNameMethodInfo ,
#endif
sePolicyGetName ,
#if defined(ENABLE_OVERLOADING)
SePolicyGetPathMethodInfo ,
#endif
sePolicyGetPath ,
sePolicyNew ,
sePolicyNewAt ,
sePolicyNewFromCommit ,
#if defined(ENABLE_OVERLOADING)
SePolicyRestoreconMethodInfo ,
#endif
sePolicyRestorecon ,
#if defined(ENABLE_OVERLOADING)
SePolicySetfscreateconMethodInfo ,
#endif
sePolicySetfscreatecon ,
#if defined(ENABLE_OVERLOADING)
SePolicyPathPropertyInfo ,
#endif
constructSePolicyPath ,
getSePolicyPath ,
#if defined(ENABLE_OVERLOADING)
sePolicyPath ,
#endif
#if defined(ENABLE_OVERLOADING)
SePolicyRootfsDfdPropertyInfo ,
#endif
constructSePolicyRootfsDfd ,
getSePolicyRootfsDfd ,
#if defined(ENABLE_OVERLOADING)
sePolicyRootfsDfd ,
#endif
) 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.GHashTable as B.GHT
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.Kind as DK
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.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Interfaces.File as Gio.File
import qualified GI.Gio.Interfaces.Initable as Gio.Initable
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import qualified GI.Gio.Objects.FileInfo as Gio.FileInfo
import {-# SOURCE #-} qualified GI.OSTree.Flags as OSTree.Flags
import {-# SOURCE #-} qualified GI.OSTree.Objects.Repo as OSTree.Repo
newtype SePolicy = SePolicy (SP.ManagedPtr SePolicy)
deriving (SePolicy -> SePolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SePolicy -> SePolicy -> Bool
$c/= :: SePolicy -> SePolicy -> Bool
== :: SePolicy -> SePolicy -> Bool
$c== :: SePolicy -> SePolicy -> Bool
Eq)
instance SP.ManagedPtrNewtype SePolicy where
toManagedPtr :: SePolicy -> ManagedPtr SePolicy
toManagedPtr (SePolicy ManagedPtr SePolicy
p) = ManagedPtr SePolicy
p
foreign import ccall "ostree_sepolicy_get_type"
c_ostree_sepolicy_get_type :: IO B.Types.GType
instance B.Types.TypedObject SePolicy where
glibType :: IO GType
glibType = IO GType
c_ostree_sepolicy_get_type
instance B.Types.GObject SePolicy
class (SP.GObject o, O.IsDescendantOf SePolicy o) => IsSePolicy o
instance (SP.GObject o, O.IsDescendantOf SePolicy o) => IsSePolicy o
instance O.HasParentTypes SePolicy
type instance O.ParentTypes SePolicy = '[GObject.Object.Object, Gio.Initable.Initable]
toSePolicy :: (MIO.MonadIO m, IsSePolicy o) => o -> m SePolicy
toSePolicy :: forall (m :: * -> *) o.
(MonadIO m, IsSePolicy o) =>
o -> m SePolicy
toSePolicy = forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr SePolicy -> SePolicy
SePolicy
instance B.GValue.IsGValue (Maybe SePolicy) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_ostree_sepolicy_get_type
gvalueSet_ :: Ptr GValue -> Maybe SePolicy -> IO ()
gvalueSet_ Ptr GValue
gv Maybe SePolicy
P.Nothing = forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (forall a. Ptr a
FP.nullPtr :: FP.Ptr SePolicy)
gvalueSet_ Ptr GValue
gv (P.Just SePolicy
obj) = forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr SePolicy
obj (forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe SePolicy)
gvalueGet_ Ptr GValue
gv = do
Ptr SePolicy
ptr <- forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr SePolicy)
if Ptr SePolicy
ptr forall a. Eq a => a -> a -> Bool
/= forall a. Ptr a
FP.nullPtr
then forall a. a -> Maybe a
P.Just forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr SePolicy -> SePolicy
SePolicy Ptr SePolicy
ptr
else forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveSePolicyMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveSePolicyMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveSePolicyMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveSePolicyMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveSePolicyMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveSePolicyMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveSePolicyMethod "init" o = Gio.Initable.InitableInitMethodInfo
ResolveSePolicyMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveSePolicyMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveSePolicyMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveSePolicyMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveSePolicyMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveSePolicyMethod "restorecon" o = SePolicyRestoreconMethodInfo
ResolveSePolicyMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveSePolicyMethod "setfscreatecon" o = SePolicySetfscreateconMethodInfo
ResolveSePolicyMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveSePolicyMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveSePolicyMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveSePolicyMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveSePolicyMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveSePolicyMethod "getCsum" o = SePolicyGetCsumMethodInfo
ResolveSePolicyMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveSePolicyMethod "getLabel" o = SePolicyGetLabelMethodInfo
ResolveSePolicyMethod "getName" o = SePolicyGetNameMethodInfo
ResolveSePolicyMethod "getPath" o = SePolicyGetPathMethodInfo
ResolveSePolicyMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveSePolicyMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveSePolicyMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveSePolicyMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveSePolicyMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveSePolicyMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSePolicyMethod t SePolicy, O.OverloadedMethod info SePolicy p) => OL.IsLabel t (SePolicy -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveSePolicyMethod t SePolicy, O.OverloadedMethod info SePolicy p, R.HasField t SePolicy p) => R.HasField t SePolicy p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveSePolicyMethod t SePolicy, O.OverloadedMethodInfo info SePolicy) => OL.IsLabel t (O.MethodProxy info SePolicy) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
getSePolicyPath :: (MonadIO m, IsSePolicy o) => o -> m (Maybe Gio.File.File)
getSePolicyPath :: forall (m :: * -> *) o.
(MonadIO m, IsSePolicy o) =>
o -> m (Maybe File)
getSePolicyPath o
obj = forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO forall a b. (a -> b) -> a -> b
$ forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"path" ManagedPtr File -> File
Gio.File.File
constructSePolicyPath :: (IsSePolicy o, MIO.MonadIO m, Gio.File.IsFile a) => a -> m (GValueConstruct o)
constructSePolicyPath :: forall o (m :: * -> *) a.
(IsSePolicy o, MonadIO m, IsFile a) =>
a -> m (GValueConstruct o)
constructSePolicyPath a
val = forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO forall a b. (a -> b) -> a -> b
$ do
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO forall a b. (a -> b) -> a -> b
$ forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject String
"path" (forall a. a -> Maybe a
P.Just a
val)
#if defined(ENABLE_OVERLOADING)
data SePolicyPathPropertyInfo
instance AttrInfo SePolicyPathPropertyInfo where
type AttrAllowedOps SePolicyPathPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint SePolicyPathPropertyInfo = IsSePolicy
type AttrSetTypeConstraint SePolicyPathPropertyInfo = Gio.File.IsFile
type AttrTransferTypeConstraint SePolicyPathPropertyInfo = Gio.File.IsFile
type AttrTransferType SePolicyPathPropertyInfo = Gio.File.File
type AttrGetType SePolicyPathPropertyInfo = (Maybe Gio.File.File)
type AttrLabel SePolicyPathPropertyInfo = "path"
type AttrOrigin SePolicyPathPropertyInfo = SePolicy
attrGet = getSePolicyPath
attrSet = undefined
attrTransfer _ v = do
unsafeCastTo Gio.File.File v
attrConstruct = constructSePolicyPath
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Objects.SePolicy.path"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Objects-SePolicy.html#g:attr:path"
})
#endif
getSePolicyRootfsDfd :: (MonadIO m, IsSePolicy o) => o -> m Int32
getSePolicyRootfsDfd :: forall (m :: * -> *) o. (MonadIO m, IsSePolicy o) => o -> m Int32
getSePolicyRootfsDfd o
obj = forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO forall a b. (a -> b) -> a -> b
$ forall a. GObject a => a -> String -> IO Int32
B.Properties.getObjectPropertyInt32 o
obj String
"rootfs-dfd"
constructSePolicyRootfsDfd :: (IsSePolicy o, MIO.MonadIO m) => Int32 -> m (GValueConstruct o)
constructSePolicyRootfsDfd :: forall o (m :: * -> *).
(IsSePolicy o, MonadIO m) =>
Int32 -> m (GValueConstruct o)
constructSePolicyRootfsDfd Int32
val = forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO forall a b. (a -> b) -> a -> b
$ do
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO forall a b. (a -> b) -> a -> b
$ forall o. String -> Int32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyInt32 String
"rootfs-dfd" Int32
val
#if defined(ENABLE_OVERLOADING)
data SePolicyRootfsDfdPropertyInfo
instance AttrInfo SePolicyRootfsDfdPropertyInfo where
type AttrAllowedOps SePolicyRootfsDfdPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SePolicyRootfsDfdPropertyInfo = IsSePolicy
type AttrSetTypeConstraint SePolicyRootfsDfdPropertyInfo = (~) Int32
type AttrTransferTypeConstraint SePolicyRootfsDfdPropertyInfo = (~) Int32
type AttrTransferType SePolicyRootfsDfdPropertyInfo = Int32
type AttrGetType SePolicyRootfsDfdPropertyInfo = Int32
type AttrLabel SePolicyRootfsDfdPropertyInfo = "rootfs-dfd"
type AttrOrigin SePolicyRootfsDfdPropertyInfo = SePolicy
attrGet = getSePolicyRootfsDfd
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructSePolicyRootfsDfd
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Objects.SePolicy.rootfsDfd"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Objects-SePolicy.html#g:attr:rootfsDfd"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SePolicy
type instance O.AttributeList SePolicy = SePolicyAttributeList
type SePolicyAttributeList = ('[ '("path", SePolicyPathPropertyInfo), '("rootfsDfd", SePolicyRootfsDfdPropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
sePolicyPath :: AttrLabelProxy "path"
sePolicyPath = AttrLabelProxy
sePolicyRootfsDfd :: AttrLabelProxy "rootfsDfd"
sePolicyRootfsDfd = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList SePolicy = SePolicySignalList
type SePolicySignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "ostree_sepolicy_new" ostree_sepolicy_new ::
Ptr Gio.File.File ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr SePolicy)
sePolicyNew ::
(B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m SePolicy
sePolicyNew :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsFile a, IsCancellable b) =>
a -> Maybe b -> m SePolicy
sePolicyNew a
path Maybe b
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr File
path' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
path
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
Just b
jCancellable -> do
Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
forall a b. IO a -> IO b -> IO a
onException (do
Ptr SePolicy
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr File
-> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr SePolicy)
ostree_sepolicy_new Ptr File
path' Ptr Cancellable
maybeCancellable
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sePolicyNew" Ptr SePolicy
result
SePolicy
result' <- (forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SePolicy -> SePolicy
SePolicy) Ptr SePolicy
result
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
path
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
forall (m :: * -> *) a. Monad m => a -> m a
return SePolicy
result'
) (do
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "ostree_sepolicy_new_at" ostree_sepolicy_new_at ::
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr SePolicy)
sePolicyNewAt ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Int32
-> Maybe (a)
-> m SePolicy
sePolicyNewAt :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Int32 -> Maybe a -> m SePolicy
sePolicyNewAt Int32
rootfsDfd Maybe a
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr Cancellable
maybeCancellable <- case Maybe a
cancellable of
Maybe a
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
Just a
jCancellable -> do
Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
forall a b. IO a -> IO b -> IO a
onException (do
Ptr SePolicy
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Int32 -> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr SePolicy)
ostree_sepolicy_new_at Int32
rootfsDfd Ptr Cancellable
maybeCancellable
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sePolicyNewAt" Ptr SePolicy
result
SePolicy
result' <- (forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SePolicy -> SePolicy
SePolicy) Ptr SePolicy
result
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
forall (m :: * -> *) a. Monad m => a -> m a
return SePolicy
result'
) (do
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "ostree_sepolicy_new_from_commit" ostree_sepolicy_new_from_commit ::
Ptr OSTree.Repo.Repo ->
CString ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr SePolicy)
sePolicyNewFromCommit ::
(B.CallStack.HasCallStack, MonadIO m, OSTree.Repo.IsRepo a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Maybe (b)
-> m SePolicy
sePolicyNewFromCommit :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsRepo a, IsCancellable b) =>
a -> Text -> Maybe b -> m SePolicy
sePolicyNewFromCommit a
repo Text
rev Maybe b
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr Repo
repo' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
repo
CString
rev' <- Text -> IO CString
textToCString Text
rev
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
Just b
jCancellable -> do
Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
forall a b. IO a -> IO b -> IO a
onException (do
Ptr SePolicy
result <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr Repo
-> CString
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr SePolicy)
ostree_sepolicy_new_from_commit Ptr Repo
repo' CString
rev' Ptr Cancellable
maybeCancellable
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sePolicyNewFromCommit" Ptr SePolicy
result
SePolicy
result' <- (forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SePolicy -> SePolicy
SePolicy) Ptr SePolicy
result
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
repo
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
forall a. Ptr a -> IO ()
freeMem CString
rev'
forall (m :: * -> *) a. Monad m => a -> m a
return SePolicy
result'
) (do
forall a. Ptr a -> IO ()
freeMem CString
rev'
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "ostree_sepolicy_get_csum" ostree_sepolicy_get_csum ::
Ptr SePolicy ->
IO CString
sePolicyGetCsum ::
(B.CallStack.HasCallStack, MonadIO m, IsSePolicy a) =>
a
-> m (Maybe T.Text)
sePolicyGetCsum :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSePolicy a) =>
a -> m (Maybe Text)
sePolicyGetCsum a
self = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr SePolicy
self' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
CString
result <- Ptr SePolicy -> IO CString
ostree_sepolicy_get_csum Ptr SePolicy
self'
Maybe Text
maybeResult <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
cstringToText CString
result'
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data SePolicyGetCsumMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsSePolicy a) => O.OverloadedMethod SePolicyGetCsumMethodInfo a signature where
overloadedMethod = sePolicyGetCsum
instance O.OverloadedMethodInfo SePolicyGetCsumMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Objects.SePolicy.sePolicyGetCsum",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Objects-SePolicy.html#v:sePolicyGetCsum"
})
#endif
foreign import ccall "ostree_sepolicy_get_label" ostree_sepolicy_get_label ::
Ptr SePolicy ->
CString ->
Word32 ->
Ptr CString ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
sePolicyGetLabel ::
(B.CallStack.HasCallStack, MonadIO m, IsSePolicy a, Gio.Cancellable.IsCancellable b) =>
a
-> T.Text
-> Word32
-> Maybe (b)
-> m ((Maybe T.Text))
sePolicyGetLabel :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSePolicy a, IsCancellable b) =>
a -> Text -> Word32 -> Maybe b -> m (Maybe Text)
sePolicyGetLabel a
self Text
relpath Word32
unixMode Maybe b
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr SePolicy
self' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
CString
relpath' <- Text -> IO CString
textToCString Text
relpath
Ptr CString
outLabel <- forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
Just b
jCancellable -> do
Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr SePolicy
-> CString
-> Word32
-> Ptr CString
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_sepolicy_get_label Ptr SePolicy
self' CString
relpath' Word32
unixMode Ptr CString
outLabel Ptr Cancellable
maybeCancellable
CString
outLabel' <- forall a. Storable a => Ptr a -> IO a
peek Ptr CString
outLabel
Maybe Text
maybeOutLabel' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
outLabel' forall a b. (a -> b) -> a -> b
$ \CString
outLabel'' -> do
Text
outLabel''' <- HasCallStack => CString -> IO Text
cstringToText CString
outLabel''
forall (m :: * -> *) a. Monad m => a -> m a
return Text
outLabel'''
forall a. Ptr a -> IO ()
freeMem CString
outLabel'
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
forall a. Ptr a -> IO ()
freeMem CString
relpath'
forall a. Ptr a -> IO ()
freeMem Ptr CString
outLabel
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeOutLabel'
) (do
forall a. Ptr a -> IO ()
freeMem CString
relpath'
forall a. Ptr a -> IO ()
freeMem Ptr CString
outLabel
)
#if defined(ENABLE_OVERLOADING)
data SePolicyGetLabelMethodInfo
instance (signature ~ (T.Text -> Word32 -> Maybe (b) -> m ((Maybe T.Text))), MonadIO m, IsSePolicy a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SePolicyGetLabelMethodInfo a signature where
overloadedMethod = sePolicyGetLabel
instance O.OverloadedMethodInfo SePolicyGetLabelMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Objects.SePolicy.sePolicyGetLabel",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Objects-SePolicy.html#v:sePolicyGetLabel"
})
#endif
foreign import ccall "ostree_sepolicy_get_name" ostree_sepolicy_get_name ::
Ptr SePolicy ->
IO CString
sePolicyGetName ::
(B.CallStack.HasCallStack, MonadIO m, IsSePolicy a) =>
a
-> m T.Text
sePolicyGetName :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSePolicy a) =>
a -> m Text
sePolicyGetName a
self = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr SePolicy
self' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
CString
result <- Ptr SePolicy -> IO CString
ostree_sepolicy_get_name Ptr SePolicy
self'
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sePolicyGetName" CString
result
Text
result' <- HasCallStack => CString -> IO Text
cstringToText CString
result
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data SePolicyGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsSePolicy a) => O.OverloadedMethod SePolicyGetNameMethodInfo a signature where
overloadedMethod = sePolicyGetName
instance O.OverloadedMethodInfo SePolicyGetNameMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Objects.SePolicy.sePolicyGetName",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Objects-SePolicy.html#v:sePolicyGetName"
})
#endif
foreign import ccall "ostree_sepolicy_get_path" ostree_sepolicy_get_path ::
Ptr SePolicy ->
IO (Ptr Gio.File.File)
sePolicyGetPath ::
(B.CallStack.HasCallStack, MonadIO m, IsSePolicy a) =>
a
-> m (Maybe Gio.File.File)
sePolicyGetPath :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSePolicy a) =>
a -> m (Maybe File)
sePolicyGetPath a
self = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr SePolicy
self' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
Ptr File
result <- Ptr SePolicy -> IO (Ptr File)
ostree_sepolicy_get_path Ptr SePolicy
self'
Maybe File
maybeResult <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr File
result forall a b. (a -> b) -> a -> b
$ \Ptr File
result' -> do
File
result'' <- (forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr File -> File
Gio.File.File) Ptr File
result'
forall (m :: * -> *) a. Monad m => a -> m a
return File
result''
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe File
maybeResult
#if defined(ENABLE_OVERLOADING)
data SePolicyGetPathMethodInfo
instance (signature ~ (m (Maybe Gio.File.File)), MonadIO m, IsSePolicy a) => O.OverloadedMethod SePolicyGetPathMethodInfo a signature where
overloadedMethod = sePolicyGetPath
instance O.OverloadedMethodInfo SePolicyGetPathMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Objects.SePolicy.sePolicyGetPath",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Objects-SePolicy.html#v:sePolicyGetPath"
})
#endif
foreign import ccall "ostree_sepolicy_restorecon" ostree_sepolicy_restorecon ::
Ptr SePolicy ->
CString ->
Ptr Gio.FileInfo.FileInfo ->
Ptr Gio.File.File ->
CUInt ->
Ptr CString ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
sePolicyRestorecon ::
(B.CallStack.HasCallStack, MonadIO m, IsSePolicy a, Gio.FileInfo.IsFileInfo b, Gio.File.IsFile c, Gio.Cancellable.IsCancellable d) =>
a
-> T.Text
-> Maybe (b)
-> c
-> [OSTree.Flags.SePolicyRestoreconFlags]
-> Maybe (d)
-> m ((Maybe T.Text))
sePolicyRestorecon :: forall (m :: * -> *) a b c d.
(HasCallStack, MonadIO m, IsSePolicy a, IsFileInfo b, IsFile c,
IsCancellable d) =>
a
-> Text
-> Maybe b
-> c
-> [SePolicyRestoreconFlags]
-> Maybe d
-> m (Maybe Text)
sePolicyRestorecon a
self Text
path Maybe b
info c
target [SePolicyRestoreconFlags]
flags Maybe d
cancellable = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr SePolicy
self' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
CString
path' <- Text -> IO CString
textToCString Text
path
Ptr FileInfo
maybeInfo <- case Maybe b
info of
Maybe b
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
Just b
jInfo -> do
Ptr FileInfo
jInfo' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jInfo
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr FileInfo
jInfo'
Ptr File
target' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
target
let flags' :: CUInt
flags' = forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [SePolicyRestoreconFlags]
flags
Ptr CString
outNewLabel <- forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
Ptr Cancellable
maybeCancellable <- case Maybe d
cancellable of
Maybe d
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
Just d
jCancellable -> do
Ptr Cancellable
jCancellable' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr d
jCancellable
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr SePolicy
-> CString
-> Ptr FileInfo
-> Ptr File
-> CUInt
-> Ptr CString
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_sepolicy_restorecon Ptr SePolicy
self' CString
path' Ptr FileInfo
maybeInfo Ptr File
target' CUInt
flags' Ptr CString
outNewLabel Ptr Cancellable
maybeCancellable
CString
outNewLabel' <- forall a. Storable a => Ptr a -> IO a
peek Ptr CString
outNewLabel
Maybe Text
maybeOutNewLabel' <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
outNewLabel' forall a b. (a -> b) -> a -> b
$ \CString
outNewLabel'' -> do
Text
outNewLabel''' <- HasCallStack => CString -> IO Text
cstringToText CString
outNewLabel''
forall (m :: * -> *) a. Monad m => a -> m a
return Text
outNewLabel'''
forall a. Ptr a -> IO ()
freeMem CString
outNewLabel'
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
info forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr c
target
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe d
cancellable forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
forall a. Ptr a -> IO ()
freeMem CString
path'
forall a. Ptr a -> IO ()
freeMem Ptr CString
outNewLabel
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeOutNewLabel'
) (do
forall a. Ptr a -> IO ()
freeMem CString
path'
forall a. Ptr a -> IO ()
freeMem Ptr CString
outNewLabel
)
#if defined(ENABLE_OVERLOADING)
data SePolicyRestoreconMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> c -> [OSTree.Flags.SePolicyRestoreconFlags] -> Maybe (d) -> m ((Maybe T.Text))), MonadIO m, IsSePolicy a, Gio.FileInfo.IsFileInfo b, Gio.File.IsFile c, Gio.Cancellable.IsCancellable d) => O.OverloadedMethod SePolicyRestoreconMethodInfo a signature where
overloadedMethod = sePolicyRestorecon
instance O.OverloadedMethodInfo SePolicyRestoreconMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Objects.SePolicy.sePolicyRestorecon",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Objects-SePolicy.html#v:sePolicyRestorecon"
})
#endif
foreign import ccall "ostree_sepolicy_setfscreatecon" ostree_sepolicy_setfscreatecon ::
Ptr SePolicy ->
CString ->
Word32 ->
Ptr (Ptr GError) ->
IO CInt
sePolicySetfscreatecon ::
(B.CallStack.HasCallStack, MonadIO m, IsSePolicy a) =>
a
-> T.Text
-> Word32
-> m ()
sePolicySetfscreatecon :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSePolicy a) =>
a -> Text -> Word32 -> m ()
sePolicySetfscreatecon a
self Text
path Word32
mode = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr SePolicy
self' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
CString
path' <- Text -> IO CString
textToCString Text
path
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError forall a b. (a -> b) -> a -> b
$ Ptr SePolicy -> CString -> Word32 -> Ptr (Ptr GError) -> IO CInt
ostree_sepolicy_setfscreatecon Ptr SePolicy
self' CString
path' Word32
mode
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
forall a. Ptr a -> IO ()
freeMem CString
path'
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
forall a. Ptr a -> IO ()
freeMem CString
path'
)
#if defined(ENABLE_OVERLOADING)
data SePolicySetfscreateconMethodInfo
instance (signature ~ (T.Text -> Word32 -> m ()), MonadIO m, IsSePolicy a) => O.OverloadedMethod SePolicySetfscreateconMethodInfo a signature where
overloadedMethod = sePolicySetfscreatecon
instance O.OverloadedMethodInfo SePolicySetfscreateconMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.OSTree.Objects.SePolicy.sePolicySetfscreatecon",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ostree-1.0.16/docs/GI-OSTree-Objects-SePolicy.html#v:sePolicySetfscreatecon"
})
#endif
foreign import ccall "ostree_sepolicy_fscreatecon_cleanup" ostree_sepolicy_fscreatecon_cleanup ::
Ptr () ->
IO ()
sePolicyFscreateconCleanup ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ptr ()
-> m ()
sePolicyFscreateconCleanup :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Ptr () -> m ()
sePolicyFscreateconCleanup Ptr ()
unused = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr () -> IO ()
ostree_sepolicy_fscreatecon_cleanup Ptr ()
unused
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
#endif