LCOV - code coverage report
Current view: top level - lib/plugin_apis - nvdimm.c (source / functions) Coverage Total Hit
Test: libblockdev Coverage Report Lines: 2.5 % 162 4
Test Date: 2026-01-26 13:19:28 Functions: 3.8 % 26 1
Legend: Lines: hit not hit

            Line data    Source code
       1            0 : GQuark  bd_nvdimm_error_quark (void) {
       2            0 :         return g_quark_from_static_string ("g-bd-nvdimm-error-quark");
       3              : }
       4              : 
       5              : /**
       6              :  * BDNVDIMMNamespaceInfo:
       7              :  * @dev: namespace device name ("namespaceX.Y")
       8              :  * @mode: mode of the namespace (BDNVDIMMNamespaceMode)
       9              :  * @size: size of the namespace
      10              :  * @uuid: UUID of the namespace
      11              :  * @sector_size: sector size of the namespace (0 for non-sector namespaces)
      12              :  * @blockdev: name of the block device for the namespace
      13              :  * @enabled: whether the namespace is enabled or not
      14              :  */
      15              : /**
      16              :  * bd_nvdimm_namespace_info_free: (skip)
      17              :  * @info: (nullable): %BDNVDIMMNamespaceInfo to free
      18              :  *
      19              :  * Frees @info.
      20              :  */
      21            0 : void  bd_nvdimm_namespace_info_free (BDNVDIMMNamespaceInfo *info) {
      22            0 :         if (info == NULL)
      23            0 :         return;
      24              : 
      25            0 :     g_free (info->dev);
      26            0 :     g_free (info->uuid);
      27            0 :     g_free (info->blockdev);
      28            0 :     g_free (info);
      29              : }
      30              : 
      31              : /**
      32              :  * bd_nvdimm_namespace_info_copy: (skip)
      33              :  * @info: (nullable): %BDNVDIMMNamespaceInfo to copy
      34              :  *
      35              :  * Creates a new copy of @info.
      36              :  */
      37            0 : BDNVDIMMNamespaceInfo* bd_nvdimm_namespace_info_copy (BDNVDIMMNamespaceInfo *info) {
      38            0 :         if (info == NULL)
      39            0 :         return NULL;
      40              : 
      41            0 :     BDNVDIMMNamespaceInfo *new_info = g_new0 (BDNVDIMMNamespaceInfo, 1);
      42              : 
      43            0 :     new_info->dev = info->dev;
      44            0 :     new_info->mode = info->mode;
      45            0 :     new_info->size = info->size;
      46            0 :     new_info->uuid = g_strdup (info->uuid);
      47            0 :     new_info->sector_size = info->sector_size;
      48            0 :     new_info->blockdev = g_strdup (info->blockdev);
      49            0 :     new_info->enabled = info->enabled;
      50              : 
      51            0 :     return new_info;
      52              : }
      53              : 
      54            2 : GType  bd_nvdimm_namespace_info_get_type () {
      55              :         static GType type = 0;
      56              : 
      57            2 :     if (G_UNLIKELY(type == 0)) {
      58            1 :         type = g_boxed_type_register_static("BDNVDIMMNamespaceInfo",
      59              :                                             (GBoxedCopyFunc) bd_nvdimm_namespace_info_copy,
      60              :                                             (GBoxedFreeFunc) bd_nvdimm_namespace_info_free);
      61              :     }
      62              : 
      63            2 :     return type;
      64              : }
      65              : 
      66            0 : static gboolean  bd_nvdimm_is_tech_avail_stub (BDNVDIMMTech tech G_GNUC_UNUSED, guint64 mode G_GNUC_UNUSED, GError **error) {
      67            0 :     bd_utils_log_format (BD_UTILS_LOG_CRIT, "The function 'bd_nvdimm_is_tech_avail' called, but not implemented!");
      68            0 :     g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_NOT_IMPLEMENTED,
      69              :                 "The function 'bd_nvdimm_is_tech_avail' called, but not implemented!");
      70            0 :     return FALSE;
      71              : }
      72              : 
      73              : static gboolean  (*_bd_nvdimm_is_tech_avail) (BDNVDIMMTech tech, guint64 mode, GError **error) = bd_nvdimm_is_tech_avail_stub;
      74              : 
      75              : /**
      76              :  * bd_nvdimm_is_tech_avail:
      77              :  * @tech: the queried tech
      78              :  * @mode: a bit mask of queried modes of operation (#BDNVDIMMTechMode) for @tech
      79              :  * @error: (out) (optional): place to store error (details about why the @tech-@mode combination is not available)
      80              :  *
      81              :  * Returns: whether the @tech-@mode combination is available -- supported by the
      82              :  *          plugin implementation and having all the runtime dependencies available
      83              :  *
      84              :  * Deprecated: 3.1: NVDIMM plugin will be removed in the next major release
      85              :  */
      86            0 : gboolean  bd_nvdimm_is_tech_avail (BDNVDIMMTech tech, guint64 mode, GError **error) {
      87            0 :     return _bd_nvdimm_is_tech_avail (tech, mode, error);
      88              : }
      89              : 
      90              : 
      91            0 : static BDNVDIMMNamespaceMode  bd_nvdimm_namespace_get_mode_from_str_stub (const gchar *mode_str G_GNUC_UNUSED, GError **error) {
      92            0 :     bd_utils_log_format (BD_UTILS_LOG_CRIT, "The function 'bd_nvdimm_namespace_get_mode_from_str' called, but not implemented!");
      93            0 :     g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_NOT_IMPLEMENTED,
      94              :                 "The function 'bd_nvdimm_namespace_get_mode_from_str' called, but not implemented!");
      95            0 :     return 0;
      96              : }
      97              : 
      98              : static BDNVDIMMNamespaceMode  (*_bd_nvdimm_namespace_get_mode_from_str) (const gchar *mode_str, GError **error) = bd_nvdimm_namespace_get_mode_from_str_stub;
      99              : 
     100              : /**
     101              :  * bd_nvdimm_namespace_get_mode_from_str:
     102              :  * @mode_str: string representation of mode
     103              :  * @error: (out) (optional): place to store error (if any)
     104              :  *
     105              :  * Returns: mode matching the @mode_str given or %BD_NVDIMM_NAMESPACE_MODE_UNKNOWN in case of no match
     106              :  *
     107              :  * Tech category: always available
     108              :  *
     109              :  * Deprecated: 3.1: NVDIMM plugin will be removed in the next major release
     110              :  */
     111            0 : BDNVDIMMNamespaceMode  bd_nvdimm_namespace_get_mode_from_str (const gchar *mode_str, GError **error) {
     112            0 :     return _bd_nvdimm_namespace_get_mode_from_str (mode_str, error);
     113              : }
     114              : 
     115              : 
     116            0 : static const gchar* bd_nvdimm_namespace_get_mode_str_stub (BDNVDIMMNamespaceMode mode G_GNUC_UNUSED, GError **error) {
     117            0 :     bd_utils_log_format (BD_UTILS_LOG_CRIT, "The function 'bd_nvdimm_namespace_get_mode_str' called, but not implemented!");
     118            0 :     g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_NOT_IMPLEMENTED,
     119              :                 "The function 'bd_nvdimm_namespace_get_mode_str' called, but not implemented!");
     120            0 :     return NULL;
     121              : }
     122              : 
     123              : static const gchar* (*_bd_nvdimm_namespace_get_mode_str) (BDNVDIMMNamespaceMode mode, GError **error) = bd_nvdimm_namespace_get_mode_str_stub;
     124              : 
     125              : /**
     126              :  * bd_nvdimm_namespace_get_mode_str:
     127              :  * @mode: mode to get string representation of
     128              :  * @error: (out) (optional): place to store error (if any)
     129              :  *
     130              :  * Returns: (transfer none): string representation of @mode or %NULL in case of error
     131              :  *
     132              :  * Tech category: always available
     133              :  *
     134              :  * Deprecated: 3.1: NVDIMM plugin will be removed in the next major release
     135              :  */
     136            0 : const gchar* bd_nvdimm_namespace_get_mode_str (BDNVDIMMNamespaceMode mode, GError **error) {
     137            0 :     return _bd_nvdimm_namespace_get_mode_str (mode, error);
     138              : }
     139              : 
     140              : 
     141            0 : static gchar* bd_nvdimm_namespace_get_devname_stub (const gchar *device G_GNUC_UNUSED, GError **error) {
     142            0 :     bd_utils_log_format (BD_UTILS_LOG_CRIT, "The function 'bd_nvdimm_namespace_get_devname' called, but not implemented!");
     143            0 :     g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_NOT_IMPLEMENTED,
     144              :                 "The function 'bd_nvdimm_namespace_get_devname' called, but not implemented!");
     145            0 :     return NULL;
     146              : }
     147              : 
     148              : static gchar* (*_bd_nvdimm_namespace_get_devname) (const gchar *device, GError **error) = bd_nvdimm_namespace_get_devname_stub;
     149              : 
     150              : /**
     151              :  * bd_nvdimm_namespace_get_devname:
     152              :  * @device: name or path of a block device (e.g. "/dev/pmem0")
     153              :  * @error: (out) (optional): place to store error (if any)
     154              :  *
     155              :  * Returns: (transfer full): namespace device name (e.g. "namespaceX.Y") for @device
     156              :  *                           or %NULL if @device is not a NVDIMM namespace
     157              :  *                           (@error may be set to indicate error)
     158              :  *
     159              :  * Tech category: %BD_NVDIMM_TECH_NAMESPACE-%BD_NVDIMM_TECH_MODE_QUERY
     160              :  *
     161              :  * Deprecated: 3.1: NVDIMM plugin will be removed in the next major release
     162              :  */
     163            0 : gchar* bd_nvdimm_namespace_get_devname (const gchar *device, GError **error) {
     164            0 :     return _bd_nvdimm_namespace_get_devname (device, error);
     165              : }
     166              : 
     167              : 
     168            0 : static gboolean  bd_nvdimm_namespace_enable_stub (const gchar *namespace G_GNUC_UNUSED, const BDExtraArg **extra G_GNUC_UNUSED, GError **error) {
     169            0 :     bd_utils_log_format (BD_UTILS_LOG_CRIT, "The function 'bd_nvdimm_namespace_enable' called, but not implemented!");
     170            0 :     g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_NOT_IMPLEMENTED,
     171              :                 "The function 'bd_nvdimm_namespace_enable' called, but not implemented!");
     172            0 :     return FALSE;
     173              : }
     174              : 
     175              : static gboolean  (*_bd_nvdimm_namespace_enable) (const gchar *namespace, const BDExtraArg **extra, GError **error) = bd_nvdimm_namespace_enable_stub;
     176              : 
     177              : /**
     178              :  * bd_nvdimm_namespace_enable:
     179              :  * @namespace: name of the namespace to enable
     180              :  * @extra: (nullable) (array zero-terminated=1): extra options (currently unused)
     181              :  * @error: (out) (optional): place to store error (if any)
     182              :  *
     183              :  * Returns: whether the @namespace was successfully enabled or not
     184              :  *
     185              :  * Tech category: %BD_NVDIMM_TECH_NAMESPACE-%BD_NVDIMM_TECH_MODE_ACTIVATE_DEACTIVATE
     186              :  *
     187              :  * Deprecated: 3.1: NVDIMM plugin will be removed in the next major release
     188              :  */
     189            0 : gboolean  bd_nvdimm_namespace_enable (const gchar *namespace, const BDExtraArg **extra, GError **error) {
     190            0 :     return _bd_nvdimm_namespace_enable (namespace, extra, error);
     191              : }
     192              : 
     193              : 
     194            0 : static gboolean  bd_nvdimm_namespace_disable_stub (const gchar *namespace G_GNUC_UNUSED, const BDExtraArg **extra G_GNUC_UNUSED, GError **error) {
     195            0 :     bd_utils_log_format (BD_UTILS_LOG_CRIT, "The function 'bd_nvdimm_namespace_disable' called, but not implemented!");
     196            0 :     g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_NOT_IMPLEMENTED,
     197              :                 "The function 'bd_nvdimm_namespace_disable' called, but not implemented!");
     198            0 :     return FALSE;
     199              : }
     200              : 
     201              : static gboolean  (*_bd_nvdimm_namespace_disable) (const gchar *namespace, const BDExtraArg **extra, GError **error) = bd_nvdimm_namespace_disable_stub;
     202              : 
     203              : /**
     204              :  * bd_nvdimm_namespace_disable:
     205              :  * @namespace: name of the namespace to disable
     206              :  * @extra: (nullable) (array zero-terminated=1): extra options (currently unused)
     207              :  * @error: (out) (optional): place to store error (if any)
     208              :  *
     209              :  * Returns: whether the @namespace was successfully disabled or not
     210              :  *
     211              :  * Tech category: %BD_NVDIMM_TECH_NAMESPACE-%BD_NVDIMM_TECH_MODE_ACTIVATE_DEACTIVATE
     212              :  *
     213              :  * Deprecated: 3.1: NVDIMM plugin will be removed in the next major release
     214              :  */
     215            0 : gboolean  bd_nvdimm_namespace_disable (const gchar *namespace, const BDExtraArg **extra, GError **error) {
     216            0 :     return _bd_nvdimm_namespace_disable (namespace, extra, error);
     217              : }
     218              : 
     219              : 
     220            0 : static BDNVDIMMNamespaceInfo* bd_nvdimm_namespace_info_stub (const gchar *namespace G_GNUC_UNUSED, const BDExtraArg **extra G_GNUC_UNUSED, GError **error) {
     221            0 :     bd_utils_log_format (BD_UTILS_LOG_CRIT, "The function 'bd_nvdimm_namespace_info' called, but not implemented!");
     222            0 :     g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_NOT_IMPLEMENTED,
     223              :                 "The function 'bd_nvdimm_namespace_info' called, but not implemented!");
     224            0 :     return NULL;
     225              : }
     226              : 
     227              : static BDNVDIMMNamespaceInfo* (*_bd_nvdimm_namespace_info) (const gchar *namespace, const BDExtraArg **extra, GError **error) = bd_nvdimm_namespace_info_stub;
     228              : 
     229              : /**
     230              :  * bd_nvdimm_namespace_info:
     231              :  * @namespace: namespace to get information about
     232              :  * @extra: (nullable) (array zero-terminated=1): extra options (currently unused)
     233              :  * @error: (out) (optional): place to store error (if any)
     234              :  *
     235              :  * Returns: (transfer full): information about given namespace or %NULL if no such
     236              :  *                           namespace was found (@error may be set to indicate error)
     237              :  *
     238              :  * Tech category: %BD_NVDIMM_TECH_NAMESPACE-%BD_NVDIMM_TECH_MODE_QUERY
     239              :  *
     240              :  * Deprecated: 3.1: NVDIMM plugin will be removed in the next major release
     241              :  */
     242            0 : BDNVDIMMNamespaceInfo* bd_nvdimm_namespace_info (const gchar *namespace, const BDExtraArg **extra, GError **error) {
     243            0 :     return _bd_nvdimm_namespace_info (namespace, extra, error);
     244              : }
     245              : 
     246              : 
     247            0 : static BDNVDIMMNamespaceInfo** bd_nvdimm_list_namespaces_stub (const gchar *bus G_GNUC_UNUSED, const gchar *region G_GNUC_UNUSED, gboolean idle G_GNUC_UNUSED, const BDExtraArg **extra G_GNUC_UNUSED, GError **error) {
     248            0 :     bd_utils_log_format (BD_UTILS_LOG_CRIT, "The function 'bd_nvdimm_list_namespaces' called, but not implemented!");
     249            0 :     g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_NOT_IMPLEMENTED,
     250              :                 "The function 'bd_nvdimm_list_namespaces' called, but not implemented!");
     251            0 :     return NULL;
     252              : }
     253              : 
     254              : static BDNVDIMMNamespaceInfo** (*_bd_nvdimm_list_namespaces) (const gchar *bus, const gchar *region, gboolean idle, const BDExtraArg **extra, GError **error) = bd_nvdimm_list_namespaces_stub;
     255              : 
     256              : /**
     257              :  * bd_nvdimm_list_namespaces:
     258              :  * @bus: (nullable): return only namespaces on given bus (specified by name),
     259              :  *                     %NULL may be specified to return namespaces from all buses
     260              :  * @region: (nullable): return only namespaces on given region (specified by regionX name or region id),
     261              :  *                        %NULL may be specified to return namespaces from all regions
     262              :  * @idle: whether to list idle (not enabled) namespaces too
     263              :  * @extra: (nullable) (array zero-terminated=1): extra options for the creation (right now
     264              :  *                                                 passed to the 'ndctl' utility)
     265              :  * @error: (out) (optional): place to store error (if any)
     266              :  *
     267              :  * Returns: (array zero-terminated=1): information about the namespaces on @bus and @region or
     268              :  *                                     %NULL if no namespaces were found (@error may be set to indicate error)
     269              :  *
     270              :  * Tech category: %BD_NVDIMM_TECH_NAMESPACE-%BD_NVDIMM_TECH_MODE_QUERY
     271              :  *
     272              :  * Deprecated: 3.1: NVDIMM plugin will be removed in the next major release
     273              :  */
     274            0 : BDNVDIMMNamespaceInfo** bd_nvdimm_list_namespaces (const gchar *bus, const gchar *region, gboolean idle, const BDExtraArg **extra, GError **error) {
     275            0 :     return _bd_nvdimm_list_namespaces (bus, region, idle, extra, error);
     276              : }
     277              : 
     278              : 
     279            0 : static gboolean  bd_nvdimm_namespace_reconfigure_stub (const gchar* namespace G_GNUC_UNUSED, BDNVDIMMNamespaceMode mode G_GNUC_UNUSED, gboolean force G_GNUC_UNUSED, const BDExtraArg **extra G_GNUC_UNUSED, GError** error) {
     280            0 :     bd_utils_log_format (BD_UTILS_LOG_CRIT, "The function 'bd_nvdimm_namespace_reconfigure' called, but not implemented!");
     281            0 :     g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_NOT_IMPLEMENTED,
     282              :                 "The function 'bd_nvdimm_namespace_reconfigure' called, but not implemented!");
     283            0 :     return FALSE;
     284              : }
     285              : 
     286              : static gboolean  (*_bd_nvdimm_namespace_reconfigure) (const gchar* namespace, BDNVDIMMNamespaceMode mode, gboolean force, const BDExtraArg **extra, GError** error) = bd_nvdimm_namespace_reconfigure_stub;
     287              : 
     288              : /**
     289              :  * bd_nvdimm_namespace_reconfigure:
     290              :  * @namespace: name of the namespace to reconfigure
     291              :  * @mode: mode type to set (memory/sector/raw/dax)
     292              :  * @force: whether to use force to reconfigure an active namespace
     293              :  * @error: (out) (optional): place to store error if any
     294              :  * @extra: (nullable) (array zero-terminated=1): extra options for the creation (right now
     295              :  *                                                 passed to the 'ndctl' utility)
     296              :  *
     297              :  * Returns: whether @namespace was successfully reconfigured or not
     298              :  *
     299              :  * Deprecated: 3.1: NVDIMM plugin will be removed in the next major release
     300              :  */
     301            0 : gboolean  bd_nvdimm_namespace_reconfigure (const gchar* namespace, BDNVDIMMNamespaceMode mode, gboolean force, const BDExtraArg **extra, GError** error) {
     302            0 :     return _bd_nvdimm_namespace_reconfigure (namespace, mode, force, extra, error);
     303              : }
     304              : 
     305              : 
     306            0 : static const guint64 * bd_nvdimm_namespace_get_supported_sector_sizes_stub (BDNVDIMMNamespaceMode mode G_GNUC_UNUSED, GError **error) {
     307            0 :     bd_utils_log_format (BD_UTILS_LOG_CRIT, "The function 'bd_nvdimm_namespace_get_supported_sector_sizes' called, but not implemented!");
     308            0 :     g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_NOT_IMPLEMENTED,
     309              :                 "The function 'bd_nvdimm_namespace_get_supported_sector_sizes' called, but not implemented!");
     310            0 :     return 0;
     311              : }
     312              : 
     313              : static const guint64 * (*_bd_nvdimm_namespace_get_supported_sector_sizes) (BDNVDIMMNamespaceMode mode, GError **error) = bd_nvdimm_namespace_get_supported_sector_sizes_stub;
     314              : 
     315              : /**
     316              :  * bd_nvdimm_namespace_get_supported_sector_sizes:
     317              :  * @mode: namespace mode
     318              :  * @error: (out) (optional): place to store error if any
     319              :  *
     320              :  * Returns: (transfer none) (array zero-terminated=1): list of supported sector sizes for @mode
     321              :  *
     322              :  * Tech category: %BD_NVDIMM_TECH_NAMESPACE-%BD_NVDIMM_TECH_MODE_QUERY
     323              :  *
     324              :  * Deprecated: 3.1: NVDIMM plugin will be removed in the next major release
     325              :  */
     326            0 : const guint64 * bd_nvdimm_namespace_get_supported_sector_sizes (BDNVDIMMNamespaceMode mode, GError **error) {
     327            0 :     return _bd_nvdimm_namespace_get_supported_sector_sizes (mode, error);
     328              : }
     329              : 
     330              : 
     331            0 : static gpointer load_nvdimm_from_plugin(const gchar *so_name) {
     332            0 :     void *handle = NULL;
     333            0 :     char *error = NULL;
     334            0 :     gboolean (*init_fn) (void) = NULL;
     335              : 
     336            0 :     handle = dlopen(so_name, RTLD_LAZY);
     337            0 :     if (!handle) {
     338            0 :         bd_utils_log_format (BD_UTILS_LOG_WARNING, "failed to load module nvdimm: %s", dlerror());
     339            0 :         return NULL;
     340              :     }
     341              : 
     342            0 :     dlerror();
     343            0 :     * (void**) (&init_fn) = dlsym(handle, "bd_nvdimm_init");
     344            0 :     if ((error = dlerror()) != NULL)
     345            0 :         bd_utils_log_format (BD_UTILS_LOG_DEBUG, "failed to load the init() function for nvdimm: %s", error);
     346              :     /* coverity[dead_error_condition] */
     347            0 :     if (init_fn && !init_fn()) {
     348            0 :         dlclose(handle);
     349            0 :         return NULL;
     350              :     }
     351            0 :     init_fn = NULL;
     352              : 
     353            0 :     dlerror();
     354            0 :     * (void**) (&_bd_nvdimm_is_tech_avail) = dlsym(handle, "bd_nvdimm_is_tech_avail");
     355            0 :     if ((error = dlerror()) != NULL)
     356            0 :         bd_utils_log_format (BD_UTILS_LOG_WARNING, "failed to load bd_nvdimm_is_tech_avail: %s", error);
     357              : 
     358            0 :     dlerror();
     359            0 :     * (void**) (&_bd_nvdimm_namespace_get_mode_from_str) = dlsym(handle, "bd_nvdimm_namespace_get_mode_from_str");
     360            0 :     if ((error = dlerror()) != NULL)
     361            0 :         bd_utils_log_format (BD_UTILS_LOG_WARNING, "failed to load bd_nvdimm_namespace_get_mode_from_str: %s", error);
     362              : 
     363            0 :     dlerror();
     364            0 :     * (void**) (&_bd_nvdimm_namespace_get_mode_str) = dlsym(handle, "bd_nvdimm_namespace_get_mode_str");
     365            0 :     if ((error = dlerror()) != NULL)
     366            0 :         bd_utils_log_format (BD_UTILS_LOG_WARNING, "failed to load bd_nvdimm_namespace_get_mode_str: %s", error);
     367              : 
     368            0 :     dlerror();
     369            0 :     * (void**) (&_bd_nvdimm_namespace_get_devname) = dlsym(handle, "bd_nvdimm_namespace_get_devname");
     370            0 :     if ((error = dlerror()) != NULL)
     371            0 :         bd_utils_log_format (BD_UTILS_LOG_WARNING, "failed to load bd_nvdimm_namespace_get_devname: %s", error);
     372              : 
     373            0 :     dlerror();
     374            0 :     * (void**) (&_bd_nvdimm_namespace_enable) = dlsym(handle, "bd_nvdimm_namespace_enable");
     375            0 :     if ((error = dlerror()) != NULL)
     376            0 :         bd_utils_log_format (BD_UTILS_LOG_WARNING, "failed to load bd_nvdimm_namespace_enable: %s", error);
     377              : 
     378            0 :     dlerror();
     379            0 :     * (void**) (&_bd_nvdimm_namespace_disable) = dlsym(handle, "bd_nvdimm_namespace_disable");
     380            0 :     if ((error = dlerror()) != NULL)
     381            0 :         bd_utils_log_format (BD_UTILS_LOG_WARNING, "failed to load bd_nvdimm_namespace_disable: %s", error);
     382              : 
     383            0 :     dlerror();
     384            0 :     * (void**) (&_bd_nvdimm_namespace_info) = dlsym(handle, "bd_nvdimm_namespace_info");
     385            0 :     if ((error = dlerror()) != NULL)
     386            0 :         bd_utils_log_format (BD_UTILS_LOG_WARNING, "failed to load bd_nvdimm_namespace_info: %s", error);
     387              : 
     388            0 :     dlerror();
     389            0 :     * (void**) (&_bd_nvdimm_list_namespaces) = dlsym(handle, "bd_nvdimm_list_namespaces");
     390            0 :     if ((error = dlerror()) != NULL)
     391            0 :         bd_utils_log_format (BD_UTILS_LOG_WARNING, "failed to load bd_nvdimm_list_namespaces: %s", error);
     392              : 
     393            0 :     dlerror();
     394            0 :     * (void**) (&_bd_nvdimm_namespace_reconfigure) = dlsym(handle, "bd_nvdimm_namespace_reconfigure");
     395            0 :     if ((error = dlerror()) != NULL)
     396            0 :         bd_utils_log_format (BD_UTILS_LOG_WARNING, "failed to load bd_nvdimm_namespace_reconfigure: %s", error);
     397              : 
     398            0 :     dlerror();
     399            0 :     * (void**) (&_bd_nvdimm_namespace_get_supported_sector_sizes) = dlsym(handle, "bd_nvdimm_namespace_get_supported_sector_sizes");
     400            0 :     if ((error = dlerror()) != NULL)
     401            0 :         bd_utils_log_format (BD_UTILS_LOG_WARNING, "failed to load bd_nvdimm_namespace_get_supported_sector_sizes: %s", error);
     402              : 
     403            0 :     return handle;
     404              : }
     405              : 
     406            0 : static gboolean unload_nvdimm (gpointer handle) {
     407            0 :     char *error = NULL;
     408            0 :     gboolean (*close_fn) (void) = NULL;
     409              : 
     410            0 :     _bd_nvdimm_is_tech_avail = bd_nvdimm_is_tech_avail_stub;
     411            0 :     _bd_nvdimm_namespace_get_mode_from_str = bd_nvdimm_namespace_get_mode_from_str_stub;
     412            0 :     _bd_nvdimm_namespace_get_mode_str = bd_nvdimm_namespace_get_mode_str_stub;
     413            0 :     _bd_nvdimm_namespace_get_devname = bd_nvdimm_namespace_get_devname_stub;
     414            0 :     _bd_nvdimm_namespace_enable = bd_nvdimm_namespace_enable_stub;
     415            0 :     _bd_nvdimm_namespace_disable = bd_nvdimm_namespace_disable_stub;
     416            0 :     _bd_nvdimm_namespace_info = bd_nvdimm_namespace_info_stub;
     417            0 :     _bd_nvdimm_list_namespaces = bd_nvdimm_list_namespaces_stub;
     418            0 :     _bd_nvdimm_namespace_reconfigure = bd_nvdimm_namespace_reconfigure_stub;
     419            0 :     _bd_nvdimm_namespace_get_supported_sector_sizes = bd_nvdimm_namespace_get_supported_sector_sizes_stub;
     420              : 
     421            0 :     dlerror();
     422            0 :     * (void**) (&close_fn) = dlsym(handle, "bd_nvdimm_close");
     423            0 :     if (((error = dlerror()) != NULL) || !close_fn)
     424            0 :         bd_utils_log_format (BD_UTILS_LOG_DEBUG, "failed to load the close_plugin() function for nvdimm: %s", error);
     425              :     /* coverity[dead_error_condition] */
     426            0 :     if (close_fn) {
     427            0 :         close_fn();
     428              :     }
     429              : 
     430            0 :     return dlclose(handle) == 0;
     431              : }
     432              : 
        

Generated by: LCOV version 2.0-1