DeviceMapper

DeviceMapper — plugin for basic operations with device mapper

Functions

Types and Values

#define BD_DM_ERROR
enum BDDMError

Includes

#include <dm.h>

Description

A plugin for basic operations with device mapper.

Functions

bd_dm_error_quark ()

GQuark
bd_dm_error_quark (void);

bd_dm_create_linear ()

gboolean
bd_dm_create_linear (gchar *map_name,
                     gchar *device,
                     guint64 length,
                     gchar *uuid,
                     GError **error);

Parameters

map_name

name of the map

 

device

device to create map for

 

length

length of the mapping in sectors

 

uuid

UUID for the new dev mapper device or NULL if not specified.

[allow-none]

error

place to store error (if any).

[out]

Returns

whether the new linear mapping map_name was successfully created for the device or not


bd_dm_remove ()

gboolean
bd_dm_remove (gchar *map_name,
              GError **error);

Parameters

map_name

name of the map to remove

 

error

place to store error (if any).

[out]

Returns

whether the map_name map was successfully removed or not


bd_dm_name_from_node ()

gchar *
bd_dm_name_from_node (gchar *dm_node,
                      GError **error);

Parameters

dm_node

name of the DM node (e.g. "dm-0")

 

error

place to store error (if any).

[out]

Returns

map name of the map providing the dm_node device or NULL (error ) contains the error in such cases)


bd_dm_node_from_name ()

gchar *
bd_dm_node_from_name (gchar *map_name,
                      GError **error);

Parameters

map_name

name of the queried DM map

 

error

place to store error (if any).

[out]

Returns

DM node name for the map_name map or NULL (error ) contains the error in such cases)


bd_dm_map_exists ()

gboolean
bd_dm_map_exists (gchar *map_name,
                  gboolean live_only,
                  gboolean active_only,
                  GError **error);

Parameters

map_name

name of the queried map

 

live_only

whether to go through the live maps only or not

 

active_only

whether to ignore suspended maps or not

 

error

place to store error (if any).

[out]

Returns

whether the given map_name exists (and is live if live_only is TRUE (and is active if active_only is TRUE)). If FALSE is returned, error ) indicates whether error appeared (non-NULL) or not (NULL).


bd_dm_get_member_raid_sets ()

gchar **
bd_dm_get_member_raid_sets (gchar *name,
                            gchar *uuid,
                            gint major,
                            gint minor,
                            GError **error);

Parameters

name

name of the member.

[allow-none]

uuid

uuid of the member.

[allow-none]

major

major number of the device or -1 if not specified

 

minor

minor number of the device or -1 if not specified

 

error

variable to store error (if any).

[out]

Returns

list of names of the RAID sets related to the member or NULL in case of error

One of name , uuid or major :minor has to be given.

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


bd_dm_activate_raid_set ()

gboolean
bd_dm_activate_raid_set (gchar *name,
                         GError **error);

Parameters

name

name of the DM RAID set to activate

 

error

variable to store error (if any).

[out]

Returns

whether the RAID set name was successfully activate or not


bd_dm_deactivate_raid_set ()

gboolean
bd_dm_deactivate_raid_set (gchar *name,
                           GError **error);

Parameters

name

name of the DM RAID set to deactivate

 

error

variable to store error (if any).

[out]

Returns

whether the RAID set name was successfully deactivate or not


bd_dm_get_raid_set_type ()

gchar *
bd_dm_get_raid_set_type (gchar *name,
                         GError **error);

Parameters

name

name of the DM RAID set to get the type of

 

error

variable to store error (if any).

[out]

Returns

string representation of the name RAID set's type

Types and Values

BD_DM_ERROR

#define BD_DM_ERROR bd_dm_error_quark ()

enum BDDMError

Members

BD_DM_ERROR_SYS

   

BD_DM_ERROR_NOT_ROOT

   

BD_DM_ERROR_TASK

   

BD_DM_ERROR_RAID_FAIL

   

BD_DM_ERROR_RAID_NO_DEVS

   

BD_DM_ERROR_RAID_NO_EXIST