#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.OSTree.Objects.SePolicy
(
SePolicy(..) ,
IsSePolicy ,
toSePolicy ,
noSePolicy ,
sePolicyFscreateconCleanup ,
#if ENABLE_OVERLOADING
SePolicyGetCsumMethodInfo ,
#endif
sePolicyGetCsum ,
#if ENABLE_OVERLOADING
SePolicyGetLabelMethodInfo ,
#endif
sePolicyGetLabel ,
#if ENABLE_OVERLOADING
SePolicyGetNameMethodInfo ,
#endif
sePolicyGetName ,
#if ENABLE_OVERLOADING
SePolicyGetPathMethodInfo ,
#endif
sePolicyGetPath ,
sePolicyNew ,
sePolicyNewAt ,
#if ENABLE_OVERLOADING
SePolicyRestoreconMethodInfo ,
#endif
sePolicyRestorecon ,
#if ENABLE_OVERLOADING
SePolicySetfscreateconMethodInfo ,
#endif
sePolicySetfscreatecon ,
#if ENABLE_OVERLOADING
SePolicyPathPropertyInfo ,
#endif
constructSePolicyPath ,
getSePolicyPath ,
#if ENABLE_OVERLOADING
sePolicyPath ,
#endif
#if ENABLE_OVERLOADING
SePolicyRootfsDfdPropertyInfo ,
#endif
constructSePolicyRootfsDfd ,
getSePolicyRootfsDfd ,
#if 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.ManagedPtr as B.ManagedPtr
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.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 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
newtype SePolicy = SePolicy (ManagedPtr SePolicy)
foreign import ccall "ostree_sepolicy_get_type"
c_ostree_sepolicy_get_type :: IO GType
instance GObject SePolicy where
gobjectType = c_ostree_sepolicy_get_type
class (GObject o, O.IsDescendantOf SePolicy o) => IsSePolicy o
instance (GObject o, O.IsDescendantOf SePolicy o) => IsSePolicy o
instance O.HasParentTypes SePolicy
type instance O.ParentTypes SePolicy = '[GObject.Object.Object, Gio.Initable.Initable]
toSePolicy :: (MonadIO m, IsSePolicy o) => o -> m SePolicy
toSePolicy = liftIO . unsafeCastTo SePolicy
noSePolicy :: Maybe SePolicy
noSePolicy = Nothing
#if ENABLE_OVERLOADING
type family ResolveSePolicyMethod (t :: Symbol) (o :: *) :: * 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 "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveSePolicyMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSePolicyMethod t SePolicy, O.MethodInfo info SePolicy p) => OL.IsLabel t (SePolicy -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
getSePolicyPath :: (MonadIO m, IsSePolicy o) => o -> m Gio.File.File
getSePolicyPath obj = liftIO $ checkUnexpectedNothing "getSePolicyPath" $ B.Properties.getObjectPropertyObject obj "path" Gio.File.File
constructSePolicyPath :: (IsSePolicy o, Gio.File.IsFile a) => a -> IO (GValueConstruct o)
constructSePolicyPath val = B.Properties.constructObjectPropertyObject "path" (Just val)
#if ENABLE_OVERLOADING
data SePolicyPathPropertyInfo
instance AttrInfo SePolicyPathPropertyInfo where
type AttrAllowedOps SePolicyPathPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint SePolicyPathPropertyInfo = Gio.File.IsFile
type AttrBaseTypeConstraint SePolicyPathPropertyInfo = IsSePolicy
type AttrGetType SePolicyPathPropertyInfo = Gio.File.File
type AttrLabel SePolicyPathPropertyInfo = "path"
type AttrOrigin SePolicyPathPropertyInfo = SePolicy
attrGet _ = getSePolicyPath
attrSet _ = undefined
attrConstruct _ = constructSePolicyPath
attrClear _ = undefined
#endif
getSePolicyRootfsDfd :: (MonadIO m, IsSePolicy o) => o -> m Int32
getSePolicyRootfsDfd obj = liftIO $ B.Properties.getObjectPropertyInt32 obj "rootfs-dfd"
constructSePolicyRootfsDfd :: (IsSePolicy o) => Int32 -> IO (GValueConstruct o)
constructSePolicyRootfsDfd val = B.Properties.constructObjectPropertyInt32 "rootfs-dfd" val
#if ENABLE_OVERLOADING
data SePolicyRootfsDfdPropertyInfo
instance AttrInfo SePolicyRootfsDfdPropertyInfo where
type AttrAllowedOps SePolicyRootfsDfdPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint SePolicyRootfsDfdPropertyInfo = (~) Int32
type AttrBaseTypeConstraint SePolicyRootfsDfdPropertyInfo = IsSePolicy
type AttrGetType SePolicyRootfsDfdPropertyInfo = Int32
type AttrLabel SePolicyRootfsDfdPropertyInfo = "rootfs-dfd"
type AttrOrigin SePolicyRootfsDfdPropertyInfo = SePolicy
attrGet _ = getSePolicyRootfsDfd
attrSet _ = undefined
attrConstruct _ = constructSePolicyRootfsDfd
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList SePolicy
type instance O.AttributeList SePolicy = SePolicyAttributeList
type SePolicyAttributeList = ('[ '("path", SePolicyPathPropertyInfo), '("rootfsDfd", SePolicyRootfsDfdPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
sePolicyPath :: AttrLabelProxy "path"
sePolicyPath = AttrLabelProxy
sePolicyRootfsDfd :: AttrLabelProxy "rootfsDfd"
sePolicyRootfsDfd = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList SePolicy = SePolicySignalList
type SePolicySignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#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 path cancellable = liftIO $ do
path' <- unsafeManagedPtrCastPtr path
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
result <- propagateGError $ ostree_sepolicy_new path' maybeCancellable
checkUnexpectedReturnNULL "sePolicyNew" result
result' <- (wrapObject SePolicy) result
touchManagedPtr path
whenJust cancellable touchManagedPtr
return result'
) (do
return ()
)
#if 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 rootfsDfd cancellable = liftIO $ do
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
result <- propagateGError $ ostree_sepolicy_new_at rootfsDfd maybeCancellable
checkUnexpectedReturnNULL "sePolicyNewAt" result
result' <- (wrapObject SePolicy) result
whenJust cancellable touchManagedPtr
return result'
) (do
return ()
)
#if 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 T.Text
sePolicyGetCsum self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
result <- ostree_sepolicy_get_csum self'
checkUnexpectedReturnNULL "sePolicyGetCsum" result
result' <- cstringToText result
touchManagedPtr self
return result'
#if ENABLE_OVERLOADING
data SePolicyGetCsumMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsSePolicy a) => O.MethodInfo SePolicyGetCsumMethodInfo a signature where
overloadedMethod _ = 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 (T.Text)
sePolicyGetLabel self relpath unixMode cancellable = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
relpath' <- textToCString relpath
outLabel <- allocMem :: IO (Ptr CString)
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
_ <- propagateGError $ ostree_sepolicy_get_label self' relpath' unixMode outLabel maybeCancellable
outLabel' <- peek outLabel
outLabel'' <- cstringToText outLabel'
freeMem outLabel'
touchManagedPtr self
whenJust cancellable touchManagedPtr
freeMem relpath'
freeMem outLabel
return outLabel''
) (do
freeMem relpath'
freeMem outLabel
)
#if ENABLE_OVERLOADING
data SePolicyGetLabelMethodInfo
instance (signature ~ (T.Text -> Word32 -> Maybe (b) -> m (T.Text)), MonadIO m, IsSePolicy a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SePolicyGetLabelMethodInfo a signature where
overloadedMethod _ = 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 self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
result <- ostree_sepolicy_get_name self'
checkUnexpectedReturnNULL "sePolicyGetName" result
result' <- cstringToText result
touchManagedPtr self
return result'
#if ENABLE_OVERLOADING
data SePolicyGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsSePolicy a) => O.MethodInfo SePolicyGetNameMethodInfo a signature where
overloadedMethod _ = 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 Gio.File.File
sePolicyGetPath self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
result <- ostree_sepolicy_get_path self'
checkUnexpectedReturnNULL "sePolicyGetPath" result
result' <- (newObject Gio.File.File) result
touchManagedPtr self
return result'
#if ENABLE_OVERLOADING
data SePolicyGetPathMethodInfo
instance (signature ~ (m Gio.File.File), MonadIO m, IsSePolicy a) => O.MethodInfo SePolicyGetPathMethodInfo a signature where
overloadedMethod _ = 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 (T.Text)
sePolicyRestorecon self path info target flags cancellable = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
path' <- textToCString path
maybeInfo <- case info of
Nothing -> return nullPtr
Just jInfo -> do
jInfo' <- unsafeManagedPtrCastPtr jInfo
return jInfo'
target' <- unsafeManagedPtrCastPtr target
let flags' = gflagsToWord flags
outNewLabel <- allocMem :: IO (Ptr CString)
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
_ <- propagateGError $ ostree_sepolicy_restorecon self' path' maybeInfo target' flags' outNewLabel maybeCancellable
outNewLabel' <- peek outNewLabel
outNewLabel'' <- cstringToText outNewLabel'
freeMem outNewLabel'
touchManagedPtr self
whenJust info touchManagedPtr
touchManagedPtr target
whenJust cancellable touchManagedPtr
freeMem path'
freeMem outNewLabel
return outNewLabel''
) (do
freeMem path'
freeMem outNewLabel
)
#if ENABLE_OVERLOADING
data SePolicyRestoreconMethodInfo
instance (signature ~ (T.Text -> Maybe (b) -> c -> [OSTree.Flags.SePolicyRestoreconFlags] -> Maybe (d) -> m (T.Text)), MonadIO m, IsSePolicy a, Gio.FileInfo.IsFileInfo b, Gio.File.IsFile c, Gio.Cancellable.IsCancellable d) => O.MethodInfo SePolicyRestoreconMethodInfo a signature where
overloadedMethod _ = 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 self path mode = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
path' <- textToCString path
onException (do
_ <- propagateGError $ ostree_sepolicy_setfscreatecon self' path' mode
touchManagedPtr self
freeMem path'
return ()
) (do
freeMem path'
)
#if ENABLE_OVERLOADING
data SePolicySetfscreateconMethodInfo
instance (signature ~ (T.Text -> Word32 -> m ()), MonadIO m, IsSePolicy a) => O.MethodInfo SePolicySetfscreateconMethodInfo a signature where
overloadedMethod _ = sePolicySetfscreatecon
#endif
foreign import ccall "ostree_sepolicy_fscreatecon_cleanup" ostree_sepolicy_fscreatecon_cleanup ::
Ptr () ->
IO ()
sePolicyFscreateconCleanup ::
(B.CallStack.HasCallStack, MonadIO m) =>
Ptr ()
-> m ()
sePolicyFscreateconCleanup unused = liftIO $ do
ostree_sepolicy_fscreatecon_cleanup unused
return ()
#if ENABLE_OVERLOADING
#endif