From 02059c81e7e2d88c459ae1d352eff33524ff2b63 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 15 Jan 2007 18:22:02 +0000 Subject: [PATCH] Some libdevmapper-event interface changes. --- WHATS_NEW | 1 + .../dmeventd/plugins/mirror/dmeventd_mirror.c | 2 +- dmeventd/mirror/dmeventd_mirror.c | 2 +- lib/mirror/mirrored.c | 46 +++++++++---------- 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 7d18746af..d73c8572a 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.19 - =================================== + Some libdevmapper-event interface changes. Report dmeventd mirror monitoring status. Fix dmeventd mirror status line processing. diff --git a/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c b/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c index 571a264ca..62c6e9e79 100644 --- a/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c +++ b/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c @@ -164,7 +164,7 @@ static int _remove_failed_devices(const char *device) return (r == 1) ? 0 : -1; } -void process_event(struct dm_task *dmt, enum dm_event_type event) +void process_event(struct dm_task *dmt, enum dm_event_mask event) { void *next = NULL; uint64_t start, length; diff --git a/dmeventd/mirror/dmeventd_mirror.c b/dmeventd/mirror/dmeventd_mirror.c index 571a264ca..62c6e9e79 100644 --- a/dmeventd/mirror/dmeventd_mirror.c +++ b/dmeventd/mirror/dmeventd_mirror.c @@ -164,7 +164,7 @@ static int _remove_failed_devices(const char *device) return (r == 1) ? 0 : -1; } -void process_event(struct dm_task *dmt, enum dm_event_type event) +void process_event(struct dm_task *dmt, enum dm_event_mask event) { void *next = NULL; uint64_t start, length; diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c index 4437d2ff2..6bb04b513 100644 --- a/lib/mirror/mirrored.c +++ b/lib/mirror/mirrored.c @@ -393,7 +393,7 @@ static int _target_registered(struct lv_segment *seg, int *pending) char *dso, *name; struct logical_volume *lv; struct volume_group *vg; - enum dm_event_type events = 0; + enum dm_event_mask evmask = 0; lv = seg->lv; vg = lv->vg; @@ -407,27 +407,27 @@ static int _target_registered(struct lv_segment *seg, int *pending) if (!(name = build_dm_name(vg->cmd->mem, vg->name, lv->name, NULL))) return_0; - if (!dm_event_get_registered_device(&dso, &name, &events, 0)) + if (!dm_event_get_registered_device(&dso, &name, &evmask, 0)) return 0; - if (events & DM_EVENT_REGISTRATION_PENDING) { + if (evmask & DM_EVENT_REGISTRATION_PENDING) { *pending = 1; - events &= ~DM_EVENT_REGISTRATION_PENDING; + evmask &= ~DM_EVENT_REGISTRATION_PENDING; } - return events; + return evmask; } /* FIXME This gets run while suspended and performs banned operations. */ /* FIXME Merge these two functions */ static int _target_register_events(struct cmd_context *cmd, struct lv_segment *seg, - int events) + int evmask) { char *dso, *name; struct logical_volume *lv; struct volume_group *vg; - struct dm_event_handler *handler; + struct dm_event_handler *dmevh; lv = seg->lv; vg = lv->vg; @@ -440,17 +440,17 @@ static int _target_register_events(struct cmd_context *cmd, if (!(name = build_dm_name(cmd->mem, vg->name, lv->name, NULL))) return_0; - if (!(handler = dm_event_handler_create())) + if (!(dmevh = dm_event_handler_create())) return_0; - dm_event_handler_set_dso(handler, dso); - dm_event_handler_set_name(handler, name); - dm_event_handler_set_events(handler, DM_EVENT_ALL_ERRORS); - if (!dm_event_register(handler)) { - dm_event_handler_destroy(handler); + dm_event_handler_set_dso(dmevh, dso); + dm_event_handler_set_devname(dmevh, name); + dm_event_handler_set_event_mask(dmevh, DM_EVENT_ALL_ERRORS); + if (!dm_event_register_handler(dmevh)) { + dm_event_handler_destroy(dmevh); return_0; } - dm_event_handler_destroy(handler); + dm_event_handler_destroy(dmevh); log_info("Registered %s for events", name); @@ -459,13 +459,13 @@ static int _target_register_events(struct cmd_context *cmd, static int _target_unregister_events(struct cmd_context *cmd, struct lv_segment *seg, - int events) + int evmask) { char *dso; char *name; struct logical_volume *lv; struct volume_group *vg; - struct dm_event_handler *handler; + struct dm_event_handler *dmevh; lv = seg->lv; vg = lv->vg; @@ -477,17 +477,17 @@ static int _target_unregister_events(struct cmd_context *cmd, if (!(name = build_dm_name(cmd->mem, vg->name, lv->name, NULL))) return_0; - if (!(handler = dm_event_handler_create())) + if (!(dmevh = dm_event_handler_create())) return_0; - dm_event_handler_set_dso(handler, dso); - dm_event_handler_set_name(handler, name); - dm_event_handler_set_events(handler, DM_EVENT_ALL_ERRORS); - if (!dm_event_unregister(handler)) { - dm_event_handler_destroy(handler); + dm_event_handler_set_dso(dmevh, dso); + dm_event_handler_set_devname(dmevh, name); + dm_event_handler_set_event_mask(dmevh, DM_EVENT_ALL_ERRORS); + if (!dm_event_unregister_handler(dmevh)) { + dm_event_handler_destroy(dmevh); return_0; } - dm_event_handler_destroy(handler); + dm_event_handler_destroy(dmevh); log_info("Unregistered %s for events", name);