|
Packit Service |
158247 |
#include <glib.h>
|
|
Packit Service |
158247 |
#include <blockdev/utils.h>
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
#ifndef BD_MD
|
|
Packit Service |
158247 |
#define BD_MD
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
#define MDADM_MIN_VERSION "3.3.2"
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
/* taken from blivet */
|
|
Packit Service |
158247 |
// these defaults were determined empirically
|
|
Packit Service |
158247 |
#define BD_MD_SUPERBLOCK_SIZE (2 MiB)
|
|
Packit Service |
158247 |
#define BD_MD_CHUNK_SIZE (512 KiB)
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
GQuark bd_md_error_quark (void);
|
|
Packit Service |
158247 |
#define BD_MD_ERROR bd_md_error_quark ()
|
|
Packit Service |
158247 |
typedef enum {
|
|
Packit Service |
158247 |
BD_MD_ERROR_PARSE,
|
|
Packit Service |
158247 |
BD_MD_ERROR_BAD_FORMAT,
|
|
Packit Service |
158247 |
BD_MD_ERROR_NO_MATCH,
|
|
Packit Service |
158247 |
BD_MD_ERROR_INVAL,
|
|
Packit Service |
158247 |
BD_MD_ERROR_FAIL,
|
|
Packit Service |
158247 |
BD_MD_ERROR_TECH_UNAVAIL,
|
|
Packit Service |
158247 |
} BDMDError;
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
typedef struct BDMDExamineData {
|
|
Packit Service |
158247 |
gchar *device;
|
|
Packit Service |
158247 |
gchar *level;
|
|
Packit Service |
158247 |
guint64 num_devices;
|
|
Packit Service |
158247 |
gchar *name;
|
|
Packit Service |
158247 |
guint64 size;
|
|
Packit Service |
158247 |
gchar *uuid;
|
|
Packit Service |
158247 |
guint64 update_time;
|
|
Packit Service |
158247 |
gchar *dev_uuid;
|
|
Packit Service |
158247 |
guint64 events;
|
|
Packit Service |
158247 |
gchar *metadata;
|
|
Packit Service |
158247 |
guint64 chunk_size;
|
|
Packit Service |
158247 |
} BDMDExamineData;
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
BDMDExamineData* bd_md_examine_data_copy (BDMDExamineData *data);
|
|
Packit Service |
158247 |
void bd_md_examine_data_free (BDMDExamineData *data);
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
typedef struct BDMDDetailData {
|
|
Packit Service |
158247 |
gchar *device;
|
|
Packit Service |
158247 |
gchar *metadata;
|
|
Packit Service |
158247 |
gchar *creation_time;
|
|
Packit Service |
158247 |
gchar *level;
|
|
Packit Service |
158247 |
gchar *name;
|
|
Packit Service |
158247 |
guint64 array_size;
|
|
Packit Service |
158247 |
guint64 use_dev_size;
|
|
Packit Service |
158247 |
guint64 raid_devices;
|
|
Packit Service |
158247 |
guint64 total_devices;
|
|
Packit Service |
158247 |
guint64 active_devices;
|
|
Packit Service |
158247 |
guint64 working_devices;
|
|
Packit Service |
158247 |
guint64 failed_devices;
|
|
Packit Service |
158247 |
guint64 spare_devices;
|
|
Packit Service |
158247 |
gboolean clean;
|
|
Packit Service |
158247 |
gchar *uuid;
|
|
Packit Service |
158247 |
} BDMDDetailData;
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
void bd_md_detail_data_free (BDMDDetailData *data);
|
|
Packit Service |
158247 |
BDMDDetailData* bd_md_detail_data_copy (BDMDDetailData *data);
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
typedef enum {
|
|
Packit Service |
158247 |
BD_MD_TECH_MDRAID = 0,
|
|
Packit Service |
158247 |
} BDMDTech;
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
typedef enum {
|
|
Packit Service |
158247 |
BD_MD_TECH_MODE_CREATE = 1 << 0,
|
|
Packit Service |
158247 |
BD_MD_TECH_MODE_DELETE = 1 << 1,
|
|
Packit Service |
158247 |
BD_MD_TECH_MODE_MODIFY = 1 << 2,
|
|
Packit Service |
158247 |
BD_MD_TECH_MODE_QUERY = 1 << 3,
|
|
Packit Service |
158247 |
} BDMDTechMode;
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
/*
|
|
Packit Service |
158247 |
* If using the plugin as a standalone library, the following functions should
|
|
Packit Service |
158247 |
* be called to:
|
|
Packit Service |
158247 |
*
|
|
Packit Service |
158247 |
* check_deps() - check plugin's dependencies, returning TRUE if satisfied
|
|
Packit Service |
158247 |
* init() - initialize the plugin, returning TRUE on success
|
|
Packit Service |
158247 |
* close() - clean after the plugin at the end or if no longer used
|
|
Packit Service |
158247 |
*
|
|
Packit Service |
158247 |
*/
|
|
Packit Service |
158247 |
gboolean bd_md_check_deps (void);
|
|
Packit Service |
158247 |
gboolean bd_md_init (void);
|
|
Packit Service |
158247 |
void bd_md_close (void);
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
gboolean bd_md_is_tech_avail (BDMDTech tech, guint64 mode, GError **error);
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
guint64 bd_md_get_superblock_size (guint64 member_size, const gchar *version, GError **error);
|
|
Packit Service |
158247 |
gboolean bd_md_create (const gchar *raid_spec, const gchar *level, const gchar **disks, guint64 spares, const gchar *version, gboolean bitmap, guint64 chunk_size, const BDExtraArg **extra, GError **error);
|
|
Packit Service |
158247 |
gboolean bd_md_destroy (const gchar *device, GError **error);
|
|
Packit Service |
158247 |
gboolean bd_md_deactivate (const gchar *raid_spec, GError **error);
|
|
Packit Service |
158247 |
gboolean bd_md_activate (const gchar *raid_spec, const gchar **members, const gchar *uuid, gboolean start_degraded, const BDExtraArg **extra, GError **error);
|
|
Packit Service |
158247 |
gboolean bd_md_run (const gchar *raid_spec, GError **error);
|
|
Packit Service |
158247 |
gboolean bd_md_nominate (const gchar *device, GError **error);
|
|
Packit Service |
158247 |
gboolean bd_md_denominate (const gchar *device, GError **error);
|
|
Packit Service |
158247 |
gboolean bd_md_add (const gchar *raid_spec, const gchar *device, guint64 raid_devs, const BDExtraArg **extra, GError **error);
|
|
Packit Service |
158247 |
gboolean bd_md_remove (const gchar *raid_spec, const gchar *device, gboolean fail, const BDExtraArg **extra, GError **error);
|
|
Packit Service |
158247 |
BDMDExamineData* bd_md_examine (const gchar *device, GError **error);
|
|
Packit Service |
158247 |
BDMDDetailData* bd_md_detail (const gchar *raid_spec, GError **error);
|
|
Packit Service |
158247 |
gchar* bd_md_canonicalize_uuid (const gchar *uuid, GError **error);
|
|
Packit Service |
158247 |
gchar* bd_md_get_md_uuid (const gchar *uuid, GError **error);
|
|
Packit Service |
158247 |
gchar* bd_md_node_from_name (const gchar *name, GError **error);
|
|
Packit Service |
158247 |
gchar* bd_md_name_from_node (const gchar *node, GError **error);
|
|
Packit Service |
158247 |
gchar* bd_md_get_status (const gchar *raid_spec, GError **error);
|
|
Packit Service |
158247 |
gboolean bd_md_set_bitmap_location (const gchar *raid_spec, const gchar *location, GError **error);
|
|
Packit Service |
158247 |
gchar* bd_md_get_bitmap_location (const gchar *raid_spec, GError **error);
|
|
Packit Service |
158247 |
gboolean bd_md_request_sync_action (const gchar *raid_spec, const gchar *action, GError **error);
|
|
Packit Service |
158247 |
|
|
Packit Service |
158247 |
#endif /* BD_MD */
|