![]() |
![]() |
![]() |
libblockdev Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <blockdev.h> #define BD_INIT_ERROR enum BDInitError; gboolean bd_init (BDPluginSpec **require_plugins
,BDUtilsLogFunc log_func
,GError **error
); gboolean bd_ensure_init (BDPluginSpec **require_plugins
,BDUtilsLogFunc log_func
,GError **error
); gboolean bd_try_init (BDPluginSpec **request_plugins
,BDUtilsLogFunc log_func
,gchar ***loaded_plugin_names
,GError **error
); gboolean bd_reinit (BDPluginSpec **require_plugins
,gboolean reload
,BDUtilsLogFunc log_func
,GError **error
); gboolean bd_try_reinit (BDPluginSpec **require_plugins
,gboolean reload
,BDUtilsLogFunc log_func
,gchar ***loaded_plugin_names
,GError **error
); gboolean bd_is_initialized (); GQuark bd_init_error_quark ();
typedef enum { BD_INIT_ERROR_PLUGINS_FAILED, BD_INIT_ERROR_NOT_IMPLEMENTED, } BDInitError;
gboolean bd_init (BDPluginSpec **require_plugins
,BDUtilsLogFunc log_func
,GError **error
);
|
NULL -terminated list
of plugins that should be loaded (if no so_name is specified
for the plugin, the default is used) or NULL to load all
plugins. [allow-none][array zero-terminated=1]
|
||
|
logging function to use. [allow-none][scope notified] | ||
|
place to store error (if any). [out] | ||
Returns : |
whether the library was successfully initialized with all the
required or default (see require_plugins ) plugins or not
Example of libblockdev initialization with 'fs' and 'lvm' plugins. Specific
version of the lvm plugin is required:
|
gboolean bd_ensure_init (BDPluginSpec **require_plugins
,BDUtilsLogFunc log_func
,GError **error
);
Checks the state of the library and if it is uninitialized or not all the
require_plugins
plugins are available, tries to (re)initialize it. Otherwise
just returns early. The difference between:
1 2 3 |
<!-- language="C" --> if (!bd_is_initialized()) bd_init(None, None, &error); |
and this function is that this function does the check and init in an atomic way (holding the lock preventing other threads from doing changes in between).
|
NULL -terminated list
of plugins that should be loaded (if no so_name is specified
for the plugin, the default is used) or NULL to load all
plugins. [allow-none][array zero-terminated=1]
|
|
logging function to use. [allow-none][scope notified] |
|
place to store error (if any). [out] |
Returns : |
whether the library was successfully initialized with all the
required or default (see require_plugins ) plugins or not either
before or by this call |
gboolean bd_try_init (BDPluginSpec **request_plugins
,BDUtilsLogFunc log_func
,gchar ***loaded_plugin_names
,GError **error
);
|
NULL -terminated list
of plugins that should be loaded (if no so_name is specified
for the plugin, the default is used) or NULL to load all
plugins. [allow-none][array zero-terminated=1]
|
|
logging function to use. [allow-none][scope notified] |
|
names of the successfully loaded plugins. [allow-none][out][transfer container][array zero-terminated=1] |
|
place to store error (if any). [out] |
Returns : |
whether the library was successfully initialized with all the
required or default (see require_plugins ) plugins or not
*UNLIKE IN CASE OF bd_init() AND bd_ensure_init() , FAILURE TO LOAD A PLUGIN
IS NOT CONSIDERED ERROR* |
gboolean bd_reinit (BDPluginSpec **require_plugins
,gboolean reload
,BDUtilsLogFunc log_func
,GError **error
);
|
NULL -terminated list
of plugins that should be loaded (if no so_name is specified
for the plugin, the default is used) or NULL to load all
plugins. [allow-none][array zero-terminated=1]
|
|
whether to reload the already loaded plugins or not |
|
logging function to use or NULL
to keep the old one. [allow-none][scope notified]
|
|
place to store error (if any). [out] |
Returns : |
whether the library was successfully initialized or not
If reload is TRUE all the plugins are closed and reloaded otherwise only
the missing plugins are loaded. |
gboolean bd_try_reinit (BDPluginSpec **require_plugins
,gboolean reload
,BDUtilsLogFunc log_func
,gchar ***loaded_plugin_names
,GError **error
);
|
NULL -terminated list
of plugins that should be loaded (if no so_name is specified
for the plugin, the default is used) or NULL to load all
plugins. [allow-none][array zero-terminated=1]
|
|
whether to reload the already loaded plugins or not |
|
logging function to use or NULL
to keep the old one. [allow-none][scope notified]
|
|
names of the successfully loaded plugins. [allow-none][out][transfer container][array zero-terminated=1] |
|
place to store error (if any). [out] |
Returns : |
whether the library was successfully initialized or not
If reload is TRUE all the plugins are closed and reloaded otherwise only
the missing plugins are loaded.
*UNLIKE IN CASE OF bd_init() AND bd_ensure_init() , FAILURE TO LOAD A PLUGIN
IS NOT CONSIDERED ERROR* |
gboolean bd_is_initialized ();
Returns : |
whether the library is initialized or not The library is considered initialized if some of the *init*() functions was/were called and either at least one plugin is loaded or 0 plugins are loaded after an explicit call that requested 0 plugins to be loaded. |