Blame src/plugins/vdo.h

Packit Service 158247
#include <glib.h>
Packit Service 158247
#include <blockdev/utils.h>
Packit Service 158247
Packit Service 158247
#ifndef BD_VDO
Packit Service 158247
#define BD_VDO
Packit Service 158247
Packit Service 158247
GQuark bd_vdo_error_quark (void);
Packit Service 158247
#define BD_VDO_ERROR bd_vdo_error_quark ()
Packit Service 158247
typedef enum {
Packit Service 158247
    BD_VDO_ERROR_FAIL,
Packit Service 158247
    BD_VDO_ERROR_PARSE,
Packit Service 158247
    BD_VDO_ERROR_TECH_UNAVAIL,
Packit Service 158247
    BD_VDO_ERROR_POLICY_INVAL,
Packit Service 158247
} BDVDOError;
Packit Service 158247
Packit Service 158247
typedef enum {
Packit Service 158247
    BD_VDO_TECH_VDO = 0,
Packit Service 158247
} BDVDOTech;
Packit Service 158247
Packit Service 158247
typedef enum {
Packit Service 158247
    BD_VDO_TECH_MODE_CREATE              = 1 << 0,
Packit Service 158247
    BD_VDO_TECH_MODE_REMOVE              = 1 << 1,
Packit Service 158247
    BD_VDO_TECH_MODE_MODIFY              = 1 << 2,
Packit Service 158247
    BD_VDO_TECH_MODE_ACTIVATE_DEACTIVATE = 1 << 3,
Packit Service 158247
    BD_VDO_TECH_MODE_START_STOP          = 1 << 4,
Packit Service 158247
    BD_VDO_TECH_MODE_QUERY               = 1 << 5,
Packit Service 158247
    BD_VDO_TECH_MODE_GROW                = 1 << 6,
Packit Service 158247
} BDVDOTechMode;
Packit Service 158247
Packit Service 158247
typedef enum {
Packit Service 158247
    BD_VDO_WRITE_POLICY_SYNC,
Packit Service 158247
    BD_VDO_WRITE_POLICY_ASYNC,
Packit Service 158247
    BD_VDO_WRITE_POLICY_AUTO,
Packit Service 158247
    BD_VDO_WRITE_POLICY_UNKNOWN,
Packit Service 158247
} BDVDOWritePolicy;
Packit Service 158247
Packit Service 158247
typedef struct BDVDOInfo {
Packit Service 158247
    gchar *name;
Packit Service 158247
    gchar *device;
Packit Service 158247
    gboolean active;
Packit Service 158247
    gboolean deduplication;
Packit Service 158247
    gboolean compression;
Packit Service 158247
    guint64 logical_size;
Packit Service 158247
    guint64 physical_size;
Packit Service 158247
    guint64 index_memory;
Packit Service 158247
    BDVDOWritePolicy write_policy;
Packit Service 158247
} BDVDOInfo;
Packit Service 158247
Packit Service 158247
typedef struct BDVDOStats {
Packit Service 158247
    gint64 block_size;
Packit Service 158247
    gint64 logical_block_size;
Packit Service 158247
    gint64 physical_blocks;
Packit Service 158247
    gint64 data_blocks_used;
Packit Service 158247
    gint64 overhead_blocks_used;
Packit Service 158247
    gint64 logical_blocks_used;
Packit Service 158247
    gint64 used_percent;
Packit Service 158247
    gint64 saving_percent;
Packit Service 158247
    gdouble write_amplification_ratio;
Packit Service 158247
} BDVDOStats;
Packit Service 158247
Packit Service 158247
void bd_vdo_info_free (BDVDOInfo *info);
Packit Service 158247
BDVDOInfo* bd_vdo_info_copy (BDVDOInfo *info);
Packit Service 158247
Packit Service 158247
void bd_vdo_stats_free (BDVDOStats *stats);
Packit Service 158247
BDVDOStats* bd_vdo_stats_copy (BDVDOStats *stats);
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_vdo_check_deps (void);
Packit Service 158247
gboolean bd_vdo_init (void);
Packit Service 158247
void bd_vdo_close (void);
Packit Service 158247
Packit Service 158247
gboolean bd_vdo_is_tech_avail (BDVDOTech tech, guint64 mode, GError **error);
Packit Service 158247
Packit Service 158247
const gchar* bd_vdo_get_write_policy_str (BDVDOWritePolicy policy, GError **error);
Packit Service 158247
BDVDOWritePolicy bd_vdo_get_write_policy_from_str (const gchar *policy_str, GError **error);
Packit Service 158247
Packit Service 158247
BDVDOInfo* bd_vdo_info (const gchar *name, GError **error);
Packit Service 158247
Packit Service 158247
gboolean bd_vdo_create (const gchar *name, const gchar *backing_device, guint64 logical_size, guint64 index_memory, gboolean compression, gboolean deduplication, BDVDOWritePolicy write_policy, const BDExtraArg **extra, GError **error);
Packit Service 158247
gboolean bd_vdo_remove (const gchar *name, gboolean force, const BDExtraArg **extra, GError **error);
Packit Service 158247
Packit Service 158247
gboolean bd_vdo_change_write_policy (const gchar *name, BDVDOWritePolicy write_policy, const BDExtraArg **extra, GError **error);
Packit Service 158247
Packit Service 158247
gboolean bd_vdo_enable_compression (const gchar *name, const BDExtraArg **extra, GError **error);
Packit Service 158247
gboolean bd_vdo_disable_compression (const gchar *name, const BDExtraArg **extra, GError **error);
Packit Service 158247
gboolean bd_vdo_enable_deduplication (const gchar *name, const BDExtraArg **extra, GError **error);
Packit Service 158247
gboolean bd_vdo_disable_deduplication (const gchar *name, const BDExtraArg **extra, GError **error);
Packit Service 158247
Packit Service 158247
gboolean bd_vdo_activate (const gchar *name, const BDExtraArg **extra, GError **error);
Packit Service 158247
gboolean bd_vdo_deactivate (const gchar *name, const BDExtraArg **extra, GError **error);
Packit Service 158247
Packit Service 158247
gboolean bd_vdo_start (const gchar *name, gboolean rebuild, const BDExtraArg **extra, GError **error);
Packit Service 158247
gboolean bd_vdo_stop (const gchar *name, gboolean force, const BDExtraArg **extra, GError **error);
Packit Service 158247
Packit Service 158247
gboolean bd_vdo_grow_logical (const gchar *name, guint64 size, const BDExtraArg **extra, GError **error);
Packit Service 158247
gboolean bd_vdo_grow_physical (const gchar *name, const BDExtraArg **extra, GError **error);
Packit Service 158247
Packit Service 158247
BDVDOStats* bd_vdo_get_stats (const gchar *name, GError **error);
Packit Service 158247
GHashTable* bd_vdo_get_stats_full (const gchar *name, GError **error);
Packit Service 158247
Packit Service 158247
#endif  /* BD_VDO */