-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Linux kernel modules support -- -- Manipulate Linux kernel modules through the libkmod library. @package linux-kmod @version 0.1.0.0 -- | High-level bindings to to the libkmod library for -- manipulating Linux kernel modules. module System.Linux.KMod -- | Opaque object representing the library context. data Context -- | Create a kmod Context from configuration -- files. new :: Maybe FilePath -> Maybe [FilePath] -> IO Context -- | Load indexes and keep them open in Context. loadResources :: Context -> IO () -- | Unload all the indexes. unloadResources :: Context -> IO () -- | Represent the return values of validateResources. data Resources Ok :: Resources MustReload :: Resources MustRecreate :: Resources -- | Check if indexes and configuration files changed on disk and the -- current context is not valid anymore. validateResources :: Context -> IO Resources -- | Represent an index file. data Index ModulesDep :: Index ModulesAlias :: Index ModulesSymbol :: Index ModulesBuiltin :: Index -- | Dump Index to file descriptor. dumpIndex :: Context -> Index -> Fd -> IO () -- | Set the current logging priority. The value controls which messages -- are logged. setLogPriority :: Context -> Int -> IO () -- | Get the current logging priority. getLogPriority :: Context -> IO Int -- | Represent the key in a (key,value) pair. type Key = String -- | Represent the value in a (key,value) pair. type Value = String -- | Get the list of blacklisted modules. configGetBlacklists :: Context -> IO [String] -- | Get the list of modules and corresponding install commands. configGetInstallCommands :: Context -> IO [(Key, Value)] -- | Get the list of modules and corresponding remove commands. configGetRemoveCommands :: Context -> IO [(Key, Value)] -- | Get the list of modules and corresponding aliases. configGetAliases :: Context -> IO [(Key, Value)] -- | Get the list of modules and corresponding options. configGetOptions :: Context -> IO [(Key, Value)] -- | Get the list of modules and corresponding soft dependencies. configGetSoftdeps :: Context -> IO [(Key, Value)] -- | Opaque object representing a module. The Show instance -- of Module is achieved using -- kmod_module_get_name. data Module -- | Create a new list of Modules using an alias or module -- name and lookup libkmod's configuration files and indexes in order to -- find the module. Once it's found in one of the places, it stops -- searching and create the list of Modules. moduleNewFromLookup :: Context -> String -> IO [Module] -- | Filter type for moduleNewFromLookupWithFilter. data Filter Filter :: Bool -> Bool -> Filter filterBlacklist :: Filter -> Bool filterBuiltin :: Filter -> Bool -- | Same as moduleNewFromLookup but apply filter the -- output list. moduleNewFromLookupWithFilter :: Context -> String -> Filter -> IO [Module] -- | Create a new Module using the module name, that can -- not be an alias, file name or anything else; it must be a module name. -- There's no check if the module exists in the system. moduleNewFromName :: Context -> String -> IO Module -- | Create a new Module using the module path. moduleNewFromPath :: Context -> String -> IO Module -- | Options for module loading to pass to Linux Kernel. type Options = String -- | Flags for moduleInsertModule. data InsertFlags InsertFlags :: Bool -> Bool -> InsertFlags insertForceVerMagic :: InsertFlags -> Bool insertForceModVersion :: InsertFlags -> Bool -- | Insert a module in Linux kernel. moduleInsertModule :: Module -> InsertFlags -> Options -> IO () -- | Flags for moduleProbeInsertModule. data ProbeFlags ProbeFlags :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> ProbeFlags probeForceVerMagic :: ProbeFlags -> Bool probeForceModVersion :: ProbeFlags -> Bool probeIgnoreCommand :: ProbeFlags -> Bool probeIgnoreLoaded :: ProbeFlags -> Bool probeDryRun :: ProbeFlags -> Bool probeFailOnLoaded :: ProbeFlags -> Bool -- | Blacklist filter for -- moduleProbeInsertModule specifies how blacklist -- configuration should be applied. data Blacklist -- | Apply blacklist configuration to the module and its dependencies BlacklistAll :: Blacklist -- | Apply blacklist configuration to the module alone Blacklist :: Blacklist -- | Apply blacklist configuration to the module only if it is an alias BlacklistAliasOnly :: Blacklist -- | Do not apply blacklist configuration NoBlacklist :: Blacklist -- | Function to run a module install commands. type RunInstall = Module -> String -> IO () -- | Function to print the actions being taken during the execution of -- moduleProbeInsertModule. type PrintAction = Module -> Bool -> Options -> IO () -- | Exception thrown by -- moduleProbeInsertModule if the module cannot be -- inserted due to a Blacklist setting. data BlacklistError BlacklistError :: BlacklistError -- | Insert a module in Linux kernel resolving dependencies, soft -- dependencies, install commands and applying blacklist. If the module -- cannot be inserted due to the Blacklist filter, -- moduleProbeInsertModule throws a -- BlacklistError exception. moduleProbeInsertModule :: Module -> ProbeFlags -> Blacklist -> Maybe Options -> Maybe RunInstall -> Maybe PrintAction -> IO () -- | Flags for moduleRemoveModule. data RemoveFlags RemoveFlags :: Bool -> Bool -> RemoveFlags removeForce :: RemoveFlags -> Bool removeNowait :: RemoveFlags -> Bool -- | Remove a module from Linux kernel. moduleRemoveModule :: Module -> RemoveFlags -> IO () -- | Get install commands for this Module. Install commands -- come from the configuration file and are cached in -- Module. The first call to this function will search -- for this module in configuration and subsequent calls return the -- cached string. The install commands are returned as they were in the -- configuration, concatenated by ';'. No other processing is made in -- this string. moduleGetInstallCommands :: Module -> IO (Maybe String) -- | Get remove commands for this Module. Remove commands -- come from the configuration file and are cached in -- Module. The first call to this function will search -- for this module in configuration and subsequent calls return the -- cached string. The remove commands are returned as they were in the -- configuration, concatenated by ';'. No other processing is made in -- this string. moduleGetRemoveCommands :: Module -> IO (Maybe String) -- | Get options of this Module. Options come from the -- configuration file and are cached in Module. The first -- call to this function will search for this Module in -- configuration and subsequent calls return the cached string. moduleGetOptions :: Module -> IO (Maybe String) -- | Get the path of this Module. If this -- Module was not created by path, it can search the -- modules.dep index in order to find out the module under context's -- dirname. moduleGetPath :: Module -> IO (Maybe String) -- | Search the modules.dep index to find the dependencies of the given -- Module. moduleGetDependencies :: Module -> IO [Module] -- | Get soft dependencies for this Module. moduleGetSoftdeps :: Module -> IO ([Module], [Module]) -- | Name of a symbol. type Symbol = String -- | Symbol bind type. data Bind None :: Bind Local :: Bind Global :: Bind Weak :: Bind Undefined :: Bind -- | Crc of a symbol. type CRC = Word64 -- | Get the list of entries in ELF section ".symtab" or -- "__ksymtab_strings". moduleGetDependencySymbols :: Module -> IO [(Symbol, Bind, CRC)] -- | Name of a module section. type Name = String -- | Address of a module section. type Address = Word64 -- | Get a list of sections of this Module, as returned by -- Linux kernel (implemented natively in Haskell by reading -- /sys/module/). moduleGetSections :: Module -> IO [(Name, Address)] -- | Get the list of entries in ELF section ".symtab" or -- "__ksymtab_strings". moduleGetSymbols :: Module -> IO [(Symbol, CRC)] -- | Get the list of entries in ELF section "__versions". moduleGetVersions :: Module -> IO [(Symbol, CRC)] -- | Get the list of entries in ELF section ".modinfo", these contain -- alias, license, depends, vermagic and other keys with respective -- values. moduleGetInfo :: Module -> IO [(Key, Value)] -- | Get the list of Modules currently loaded in kernel. moduleNewFromLoaded :: Context -> IO [Module] -- | Possible values of initialization state of a Module. data Initstate Builtin :: Initstate Live :: Initstate Coming :: Initstate Going :: Initstate -- | Get the Initstate of the given Module, -- as returned by Linux Kernel, by reading /sys filesystem. moduleGetInitstate :: Module -> IO Initstate -- | Get the size of the given Module as returned by Linux -- kernel. moduleGetSize :: Module -> IO Int -- | Get the ref count of the given Module, as returned by -- Linux kernel, by reading /sys filesystem. moduleGetRefcnt :: Module -> IO Int -- | Get the list of Modules that are holding the given -- Module, as returned by Linux kernel. moduleGetHolders :: Module -> IO [Module] instance Typeable BlacklistError instance Eq Resources instance Show Resources instance Eq Index instance Show Index instance Eq InsertFlags instance Show InsertFlags instance Eq ProbeFlags instance Show ProbeFlags instance Eq Blacklist instance Show Blacklist instance Eq BlacklistError instance Show BlacklistError instance Eq RemoveFlags instance Show RemoveFlags instance Eq Filter instance Show Filter instance Eq Bind instance Show Bind instance Eq Initstate instance Show Initstate instance Exception BlacklistError instance Show Module