## NVDIMM NVDIMM — plugin for operations with nvdimm space |

## Functions

void | bd_nvdimm_close ()
gboolean | bd_nvdimm_init ()
GQuark | bd_nvdimm_error_quark ()
BDNVDIMMNamespaceMode | bd_nvdimm_namespace_get_mode_from_str ()
const gchar * | bd_nvdimm_namespace_get_mode_str ()
gchar * | bd_nvdimm_namespace_get_devname ()
gboolean | bd_nvdimm_namespace_enable ()
gboolean | bd_nvdimm_namespace_disable ()
BDNVDIMMNamespaceInfo * | bd_nvdimm_namespace_info ()
BDNVDIMMNamespaceInfo ** | bd_nvdimm_list_namespaces ()
gboolean | bd_nvdimm_namespace_reconfigure ()
const guint64 * | bd_nvdimm_namespace_get_supported_sector_sizes ()
BDNVDIMMNamespaceInfo * | bd_nvdimm_namespace_info_copy ()
void | bd_nvdimm_namespace_info_free ()
gboolean | bd_nvdimm_is_tech_avail ()

## Types and Values

#define | BD_NVDIMM_ERROR
enum | BDNVDIMMError
enum | BDNVDIMMNamespaceMode
| BDNVDIMMNamespaceInfo
enum | BDNVDIMMTech
enum | BDNVDIMMTechMode

## Includes

    #include <nvdimm.h>

## Description

A plugin for operations with NVDIMM devices.

## Functions

### bd_nvdimm_close ()

    void
    bd_nvdimm_close (void);

Cleans up after the plugin. **This function is called automatically by the library's functions that unload it.**

### bd_nvdimm_init ()

    gboolean
    bd_nvdimm_init (void);

Initializes the plugin. **This function is called automatically by the library's initialization functions.**

### bd_nvdimm_error_quark ()

    GQuark
    bd_nvdimm_error_quark (void);

[skip]

### bd_nvdimm_namespace_get_mode_from_str ()

    BDNVDIMMNamespaceMode
    bd_nvdimm_namespace_get_mode_from_str (const gchar *mode_str,
                                           GError **error);

#### Parameters

mode_str | string representation of mode |
error | place to store error (if any). | [out][optional]

#### Returns

mode matching the `mode_str` given or `BD_NVDIMM_NAMESPACE_MODE_UNKNOWN` in case of no match

Tech category: always available

### bd_nvdimm_namespace_get_mode_str ()

    const gchar *
    bd_nvdimm_namespace_get_mode_str (BDNVDIMMNamespaceMode mode,
                                      GError **error);

#### Parameters

mode | mode to get string representation of |
error | place to store error (if any). | [out][optional]

#### Returns

string representation of `mode` or `NULL` in case of error

Tech category: always available.

[transfer none]

### bd_nvdimm_namespace_get_devname ()

    gchar *
    bd_nvdimm_namespace_get_devname (const gchar *device,
                                     GError **error);

#### Parameters

device | name or path of a block device (e.g. "/dev/pmem0") |
error | place to store error (if any). | [out][optional]

#### Returns

namespace device name (e.g. "namespaceX.Y") for `device` or `NULL` if `device` is not a NVDIMM namespace (`error` may be set to indicate error)

Tech category: `BD_NVDIMM_TECH_NAMESPACE`-`BD_NVDIMM_TECH_MODE_QUERY`.

[transfer full]

### bd_nvdimm_namespace_enable ()

    gboolean
    bd_nvdimm_namespace_enable (const gchar *namespace,
                                const BDExtraArg **extra,
                                GError **error);

#### Parameters

namespace | name of the namespace to enable |
extra | extra options (currently unused). | [nullable][array zero-terminated=1]
error | place to store error (if any). | [out][optional]

#### Returns

whether the `namespace` was successfully enabled or not

Tech category: `BD_NVDIMM_TECH_NAMESPACE`-`BD_NVDIMM_TECH_MODE_ACTIVATE_DEACTIVATE`

### bd_nvdimm_namespace_disable ()

    gboolean
    bd_nvdimm_namespace_disable (const gchar *namespace,
                                 const BDExtraArg **extra,
                                 GError **error);

#### Parameters

namespace | name of the namespace to disable |
extra | extra options (currently unused). | [nullable][array zero-terminated=1]
error | place to store error (if any). | [out][optional]

#### Returns

whether the `namespace` was successfully disabled or not

Tech category: `BD_NVDIMM_TECH_NAMESPACE`-`BD_NVDIMM_TECH_MODE_ACTIVATE_DEACTIVATE`

### bd_nvdimm_namespace_info ()

    BDNVDIMMNamespaceInfo *
    bd_nvdimm_namespace_info (const gchar *namespace,
                              const BDExtraArg **extra,
                              GError **error);

#### Parameters

namespace | namespace to get information about |
extra | extra options (currently unused). | [nullable][array zero-terminated=1]
error | place to store error (if any). | [out][optional]

#### Returns

information about given namespace or `NULL` if no such namespace was found (`error` may be set to indicate error)

Tech category: `BD_NVDIMM_TECH_NAMESPACE`-`BD_NVDIMM_TECH_MODE_QUERY`.

[transfer full]

### bd_nvdimm_list_namespaces ()

    BDNVDIMMNamespaceInfo **
    bd_nvdimm_list_namespaces (const gchar *bus,
                               const gchar *region,
                               gboolean idle,
                               const BDExtraArg **extra,
                               GError **error);

#### Parameters

bus | return only namespaces on given bus (specified by name), `NULL` may be specified to return namespaces from all buses. | [nullable]
region | return only namespaces on given region (specified by regionX name or region id), `NULL` may be specified to return namespaces from all regions. | [nullable]
idle | whether to list idle (not enabled) namespaces too |
extra | extra options for the creation (right now passed to the 'ndctl' utility). | [nullable][array zero-terminated=1]
error | place to store error (if any). | [out][optional]

#### Returns

information about the namespaces on `bus` and `region` or `NULL` if no namespaces were found (`error` may be set to indicate error)

Tech category: `BD_NVDIMM_TECH_NAMESPACE`-`BD_NVDIMM_TECH_MODE_QUERY`.

[array zero-terminated=1]

### bd_nvdimm_namespace_reconfigure ()

    gboolean
    bd_nvdimm_namespace_reconfigure (const gchar *namespace,
                                     BDNVDIMMNamespaceMode mode,
                                     gboolean force,
                                     const BDExtraArg **extra,
                                     GError **error);

#### Parameters

namespace | name of the namespace to reconfigure |
mode | mode type to set (memory/sector/raw/dax) |
force | whether to use force to reconfigure an active namespace |
error | place to store error if any. | [out][optional]
extra | extra options for the creation (right now passed to the 'ndctl' utility). | [nullable][array zero-terminated=1]

#### Returns

whether `namespace` was successfully reconfigured or not

### bd_nvdimm_namespace_get_supported_sector_sizes ()

    const guint64 *
    bd_nvdimm_namespace_get_supported_sector_sizes
                                   (BDNVDIMMNamespaceMode mode,
                                    GError **error);

#### Parameters

mode | namespace mode |
error | place to store error if any. | [out][optional]

#### Returns

list of supported sector sizes for `mode`

Tech category: `BD_NVDIMM_TECH_NAMESPACE`-`BD_NVDIMM_TECH_MODE_QUERY`.

[transfer none][array zero-terminated=1]

### bd_nvdimm_namespace_info_copy ()

    BDNVDIMMNamespaceInfo *
    bd_nvdimm_namespace_info_copy (BDNVDIMMNamespaceInfo *info);

Creates a new copy of `info` .

[skip]

#### Parameters

info | `BDNVDIMMNamespaceInfo` to copy. | [nullable]

### bd_nvdimm_namespace_info_free ()

    void
    bd_nvdimm_namespace_info_free (BDNVDIMMNamespaceInfo *info);

Frees `info` .

[skip]

#### Parameters

info | `BDNVDIMMNamespaceInfo` to free. | [nullable]

### bd_nvdimm_is_tech_avail ()

    gboolean
    bd_nvdimm_is_tech_avail (BDNVDIMMTech tech,
                             guint64 mode,
                             GError **error);

#### Parameters

tech | the queried tech |
mode | a bit mask of queried modes of operation (BDNVDIMMTechMode) for `tech` |
error | place to store error (details about why the `tech` -`mode` combination is not available). | [out][optional]

#### Returns

whether the `tech` -`mode` combination is available -- supported by the plugin implementation and having all the runtime dependencies available

## Types and Values

### BD_NVDIMM_ERROR

    #define             BD_NVDIMM_ERROR

### enum BDNVDIMMError

#### Members

BD_NVDIMM_ERROR_TECH_UNAVAIL |  |
BD_NVDIMM_ERROR_NAMESPACE_FAIL |  |
BD_NVDIMM_ERROR_NAMESPACE_PARSE |  |
BD_NVDIMM_ERROR_NAMESPACE_NOEXIST |  |
BD_NVDIMM_ERROR_NAMESPACE_MODE_INVAL |  |

### enum BDNVDIMMNamespaceMode

#### Members

BD_NVDIMM_NAMESPACE_MODE_RAW |  |
BD_NVDIMM_NAMESPACE_MODE_SECTOR |  |
BD_NVDIMM_NAMESPACE_MODE_MEMORY |  |
BD_NVDIMM_NAMESPACE_MODE_DAX |  |
BD_NVDIMM_NAMESPACE_MODE_FSDAX |  |
BD_NVDIMM_NAMESPACE_MODE_DEVDAX |  |
BD_NVDIMM_NAMESPACE_MODE_UNKNOWN |  |

### BDNVDIMMNamespaceInfo

    typedef struct {
        gchar *dev;
        guint64 mode;
        guint64 size;
        gchar *uuid;
        guint64 sector_size;
        gchar *blockdev;
        gboolean enabled;
    } BDNVDIMMNamespaceInfo;

#### Members

gchar *`dev`; | namespace device name ("namespaceX.Y") |
guint64 `mode`; | mode of the namespace (BDNVDIMMNamespaceMode) |
guint64 `size`; | size of the namespace |
gchar *`uuid`; | UUID of the namespace |
guint64 `sector_size`; | sector size of the namespace (0 for non-sector namespaces) |
gchar *`blockdev`; | name of the block device for the namespace |
gboolean `enabled`; | whether the namespace is enabled or not |

### enum BDNVDIMMTech

#### Members

BD_NVDIMM_TECH_NAMESPACE |  |

### enum BDNVDIMMTechMode

#### Members

BD_NVDIMM_TECH_MODE_CREATE |  |
BD_NVDIMM_TECH_MODE_REMOVE |  |
BD_NVDIMM_TECH_MODE_ACTIVATE_DEACTIVATE |  |
BD_NVDIMM_TECH_MODE_QUERY |  |
BD_NVDIMM_TECH_MODE_RECONFIGURE |  |