1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Make poll_mirror_progress a function that can be replaced.

This commit is contained in:
Alasdair Kergon 2009-09-30 18:15:06 +00:00
parent 42dd692bea
commit 4b12fa1377
4 changed files with 20 additions and 8 deletions

View File

@ -315,6 +315,7 @@ out:
static struct poll_functions _lvconvert_mirror_fns = {
.get_copy_vg = _get_lvconvert_vg,
.get_copy_lv = _get_lvconvert_lv,
.poll_progress = poll_mirror_progress,
.update_metadata = _update_lvconvert_mirror,
.finish_copy = _finish_lvconvert_mirror,
};

View File

@ -63,13 +63,6 @@ static int _become_daemon(struct cmd_context *cmd)
return 1;
}
typedef enum {
PROGRESS_CHECK_FAILED = 0,
PROGRESS_UNFINISHED = 1,
PROGRESS_FINISHED_SEGMENT = 2,
PROGRESS_FINISHED_ALL = 3
} progress_t;
progress_t poll_mirror_progress(struct cmd_context *cmd,
struct logical_volume *lv, const char *name,
struct daemon_parms *parms)
@ -122,7 +115,7 @@ static int _check_lv_status(struct cmd_context *cmd,
return 0;
}
progress = poll_mirror_progress(cmd, lv, name, parms);
progress = parms->poll_fns->poll_progress(cmd, lv, name, parms);
if (progress == PROGRESS_CHECK_FAILED)
return_0;

View File

@ -18,6 +18,15 @@
#include "metadata-exported.h"
typedef enum {
PROGRESS_CHECK_FAILED = 0,
PROGRESS_UNFINISHED = 1,
PROGRESS_FINISHED_SEGMENT = 2,
PROGRESS_FINISHED_ALL = 3
} progress_t;
struct daemon_parms;
struct poll_functions {
const char *(*get_copy_name_from_lv) (struct logical_volume *lv);
struct volume_group *(*get_copy_vg) (struct cmd_context *cmd,
@ -28,6 +37,10 @@ struct poll_functions {
const char *name,
const char *uuid,
uint32_t lv_type);
progress_t (*poll_progress)(struct cmd_context *cmd,
struct logical_volume *lv,
const char *name,
struct daemon_parms *parms);
int (*update_metadata) (struct cmd_context *cmd,
struct volume_group *vg,
struct logical_volume *lv,
@ -54,4 +67,8 @@ int poll_daemon(struct cmd_context *cmd, const char *name, const char *uuid,
uint32_t lv_type, struct poll_functions *poll_fns,
const char *progress_title);
progress_t poll_mirror_progress(struct cmd_context *cmd,
struct logical_volume *lv, const char *name,
struct daemon_parms *parms);
#endif

View File

@ -562,6 +562,7 @@ static struct poll_functions _pvmove_fns = {
.get_copy_name_from_lv = get_pvmove_pvname_from_lv_mirr,
.get_copy_vg = _get_move_vg,
.get_copy_lv = find_pvmove_lv_from_pvname,
.poll_progress = poll_mirror_progress,
.update_metadata = _update_metadata,
.finish_copy = _finish_pvmove,
};