Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
No description available in the introspection data.
Synopsis
- newtype KernelArgs = KernelArgs (ManagedPtr KernelArgs)
- kernelArgsAppend :: (HasCallStack, MonadIO m) => KernelArgs -> Text -> m ()
- kernelArgsAppendArgv :: (HasCallStack, MonadIO m) => KernelArgs -> Text -> m ()
- kernelArgsAppendArgvFiltered :: (HasCallStack, MonadIO m) => KernelArgs -> Text -> Text -> m ()
- kernelArgsAppendProcCmdline :: (HasCallStack, MonadIO m, IsCancellable a) => KernelArgs -> Maybe a -> m ()
- kernelArgsCleanup :: (HasCallStack, MonadIO m) => Ptr () -> m ()
- kernelArgsDelete :: (HasCallStack, MonadIO m) => KernelArgs -> Text -> m ()
- kernelArgsDeleteKeyEntry :: (HasCallStack, MonadIO m) => KernelArgs -> Text -> m ()
- kernelArgsFree :: (HasCallStack, MonadIO m) => KernelArgs -> m ()
- kernelArgsGetLastValue :: (HasCallStack, MonadIO m) => KernelArgs -> Text -> m Text
- kernelArgsNewReplace :: (HasCallStack, MonadIO m) => KernelArgs -> Text -> m ()
- kernelArgsParseAppend :: (HasCallStack, MonadIO m) => KernelArgs -> Text -> m ()
- kernelArgsReplace :: (HasCallStack, MonadIO m) => KernelArgs -> Text -> m ()
- kernelArgsReplaceArgv :: (HasCallStack, MonadIO m) => KernelArgs -> Text -> m ()
- kernelArgsReplaceTake :: (HasCallStack, MonadIO m) => KernelArgs -> Text -> m ()
- kernelArgsToString :: (HasCallStack, MonadIO m) => KernelArgs -> m Text
- kernelArgsToStrv :: (HasCallStack, MonadIO m) => KernelArgs -> m [Text]
Exported types
newtype KernelArgs Source #
Memory-managed wrapper type.
KernelArgs (ManagedPtr KernelArgs) |
Instances
Eq KernelArgs Source # | |
Defined in GI.OSTree.Structs.KernelArgs (==) :: KernelArgs -> KernelArgs -> Bool (/=) :: KernelArgs -> KernelArgs -> Bool | |
BoxedPtr KernelArgs Source # | |
Defined in GI.OSTree.Structs.KernelArgs boxedPtrCopy :: KernelArgs -> IO KernelArgs boxedPtrFree :: KernelArgs -> IO () | |
ManagedPtrNewtype KernelArgs Source # | |
Defined in GI.OSTree.Structs.KernelArgs toManagedPtr :: KernelArgs -> ManagedPtr KernelArgs |
Methods
Overloaded methods
append
:: (HasCallStack, MonadIO m) | |
=> KernelArgs |
|
-> Text |
|
-> m () |
Appends arg
which is in the form of key=value pair to the hash table kargs->table
(appends to the value list if key is already in the hash table)
and appends key to kargs->order if it is not in the hash table already.
Since: 2019.3
appendArgv
:: (HasCallStack, MonadIO m) | |
=> KernelArgs |
|
-> Text |
|
-> m () |
Appends each value in argv
to the corresponding value array and
appends key to kargs->order if it is not in the hash table already.
Since: 2019.3
appendArgvFiltered
kernelArgsAppendArgvFiltered Source #
:: (HasCallStack, MonadIO m) | |
=> KernelArgs |
|
-> Text |
|
-> Text |
|
-> m () |
Appends each argument that does not have one of the prefixes
as prefix to the kargs
Since: 2019.3
appendProcCmdline
kernelArgsAppendProcCmdline Source #
:: (HasCallStack, MonadIO m, IsCancellable a) | |
=> KernelArgs |
|
-> Maybe a |
|
-> m () | (Can throw |
Appends the command line arguments in the file "/proc/cmdline"
that does not have "BOOT_IMAGE=" and "initrd=" as prefixes to the kargs
Since: 2019.3
cleanup
Frees the OstreeKernelArgs structure pointed by *loc
Since: 2019.3
delete
:: (HasCallStack, MonadIO m) | |
=> KernelArgs |
|
-> Text |
|
-> m () | (Can throw |
There are few scenarios being handled for deletion:
1: for input arg with a single key(i.e without = for split), the key/value pair will be deleted if there is only one value that is associated with the key
2: for input arg wth key/value pair, the specific key value pair will be deleted from the pointer array if those exist.
3: If the found key has only one value associated with it, the key entry in the table will also be removed, and the key will be removed from order table
Returns: True
on success, False
on failure
Since: 2019.3
deleteKeyEntry
kernelArgsDeleteKeyEntry Source #
:: (HasCallStack, MonadIO m) | |
=> KernelArgs |
|
-> Text |
|
-> m () | (Can throw |
This function removes the key entry from the hashtable as well from the order pointer array inside kargs
Note: since both table and order inside kernel args are with free function, no extra free functions are being called as they are done automatically by GLib
Since: 2019.3
free
:: (HasCallStack, MonadIO m) | |
=> KernelArgs |
|
-> m () |
Frees the kargs structure
Since: 2019.3
getLastValue
kernelArgsGetLastValue Source #
:: (HasCallStack, MonadIO m) | |
=> KernelArgs |
|
-> Text |
|
-> m Text | Returns: NULL if |
Finds and returns the last element of value array
corresponding to the key
in kargs
hash table. Note that the application
will be terminated if the key
is found but the value array is empty
Since: 2019.3
newReplace
:: (HasCallStack, MonadIO m) | |
=> KernelArgs |
|
-> Text |
|
-> m () | (Can throw |
This function implements the basic logic behind key/value pair replacement. Do note that the arg need to be properly formatted
When replacing key with exact one value, the arg can be in the form: key, key=new_val, or key=old_val=new_val The first one swaps the old_val with the key to an empty value The second and third replace the old_val into the new_val
When replacing key with multiple values, the arg can only be in the form of: key=old_val=new_val. Unless there is a special case where there is an empty value associated with the key, then key=new_val will work because old_val is empty. The empty val will be swapped with the new_val in that case
Since: 2019.3
parseAppend
kernelArgsParseAppend Source #
:: (HasCallStack, MonadIO m) | |
=> KernelArgs |
|
-> Text |
|
-> m () |
Parses options
by separating it by whitespaces and appends each argument to kargs
Since: 2019.3
replace
:: (HasCallStack, MonadIO m) | |
=> KernelArgs |
|
-> Text |
|
-> m () |
Finds and replaces the old key if arg
is already in the hash table,
otherwise adds arg
as new key and split_keyeq (arg) as value.
Note that when replacing old key value pair, the old values are freed.
Since: 2019.3
replaceArgv
kernelArgsReplaceArgv Source #
:: (HasCallStack, MonadIO m) | |
=> KernelArgs |
|
-> Text |
|
-> m () |
Finds and replaces each non-null arguments of argv
in the hash table,
otherwise adds individual arg as new key and split_keyeq (arg) as value.
Note that when replacing old key value pair, the old values are freed.
Since: 2019.3
replaceTake
kernelArgsReplaceTake Source #
:: (HasCallStack, MonadIO m) | |
=> KernelArgs |
|
-> Text |
|
-> m () |
Finds and replaces the old key if arg
is already in the hash table,
otherwise adds arg
as new key and split_keyeq (arg) as value.
Note that when replacing old key, the old values are freed.
Since: 2019.3
toString
:: (HasCallStack, MonadIO m) | |
=> KernelArgs |
|
-> m Text | Returns: a string of "key=value" pairs or "key" if value is NULL, separated by single whitespaces |
Extracts all key value pairs in kargs
and appends to a temporary
GString in forms of "key=value" or "key" if value is NULL separated
by a single whitespace, and returns the temporary string with the
GString wrapper freed
Note: the application will be terminated if one of the values array
in kargs
is NULL
Since: 2019.3
toStrv
:: (HasCallStack, MonadIO m) | |
=> KernelArgs |
|
-> m [Text] | Returns: an array of "key=value" pairs or "key" if value is NULL |
Extracts all key value pairs in kargs
and appends to a temporary
array in forms of "key=value" or "key" if value is NULL, and returns
the temporary array with the GPtrArray wrapper freed
Since: 2019.3