]> sourceware.org Git - lvm2.git/commitdiff
Rename register_dev; fix missing initialisation; reduce number of ifdefs.
authorAlasdair Kergon <agk@redhat.com>
Fri, 27 Jan 2006 18:38:14 +0000 (18:38 +0000)
committerAlasdair Kergon <agk@redhat.com>
Fri, 27 Jan 2006 18:38:14 +0000 (18:38 +0000)
lib/activate/activate.c

index 57a6c7848e7d85871b73f2b5b7636c003025c949..b5b8da9977638c2de4c896f435a38f58ff1e2c4b 100644 (file)
@@ -574,11 +574,10 @@ int lvs_in_vg_opened(struct volume_group *vg)
        return count;
 }
 
-#ifdef DMEVENTD
-static int _register_dev(struct cmd_context *cmd, struct logical_volume *lv,
-                         int do_reg)
+static int _register_dev_for_events(struct cmd_context *cmd,
+                                   struct logical_volume *lv, int do_reg)
 {
-
+#ifdef DMEVENTD
        struct list *tmp;
        struct lv_segment *seg;
        int (*reg) (struct dm_pool *mem, struct lv_segment *,
@@ -587,6 +586,8 @@ static int _register_dev(struct cmd_context *cmd, struct logical_volume *lv,
        list_iterate(tmp, &lv->segments) {
                seg = list_item(tmp, struct lv_segment);
 
+               reg = NULL;
+
                if (do_reg) {
                        if (seg->segtype->ops->target_register_events)
                                reg = seg->segtype->ops->target_register_events;
@@ -601,9 +602,9 @@ static int _register_dev(struct cmd_context *cmd, struct logical_volume *lv,
                        }
        }
 
+#endif
        return 1;
 }
-#endif
 
 static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
                       int error_if_not_suspended)
@@ -637,9 +638,9 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
                }
        }
 
-#ifdef DMEVENTD
-       _register_dev(cmd, lv, 0);
-#endif
+       if (!_register_dev_for_events(cmd, lv, 0))
+               stack;
+
        memlock_inc();
        if (!_lv_suspend_lv(lv)) {
                memlock_dec();
@@ -690,9 +691,8 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
        memlock_dec();
        fs_unlock();
 
-#ifdef DMEVENTD
-       _register_dev(cmd, lv, 1);
-#endif
+       if (!_register_dev_for_events(cmd, lv, 1))
+               stack;
 
        return 1;
 }
@@ -737,9 +737,8 @@ int lv_deactivate(struct cmd_context *cmd, const char *lvid_s)
                return 0;
        }
 
-#ifdef DMEVENTD
-       _register_dev(cmd, lv, 0);
-#endif
+       if (!_register_dev_for_events(cmd, lv, 0))
+               stack;
 
        memlock_inc();
        r = _lv_deactivate(lv);
@@ -811,9 +810,8 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
        memlock_dec();
        fs_unlock();
 
-#ifdef DMEVENTD
-       _register_dev(cmd, lv, 1);
-#endif
+       if (!_register_dev_for_events(cmd, lv, 1))
+               stack;
 
        return r;
 }
This page took 0.039107 seconds and 5 git commands to generate.