]> sourceware.org Git - lvm2.git/commitdiff
Move compose_log_line() into mirror directory.
authorAlasdair Kergon <agk@redhat.com>
Wed, 10 Aug 2005 17:19:46 +0000 (17:19 +0000)
committerAlasdair Kergon <agk@redhat.com>
Wed, 10 Aug 2005 17:19:46 +0000 (17:19 +0000)
WHATS_NEW
lib/activate/dev_manager.c
lib/activate/targets.h
lib/mirror/mirrored.c

index e6726377c20f31774dd33521543c23b104983218..be86e3e061c5899812e061df408fa51c97afb660 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.01.15 - 
 =================================
+  Move compose_log_line() into mirror directory.
   Factor out _get_library_path().
   Don't kill idling clvmd threads.
   Recognise ATA over Ethernet (aoe) devices.
index 742205318db1a6cb8e4cbdcc965c4c25c16dcf60..2cb9103cbfa1b93006f0d6bfdcebd35c5737b151 100644 (file)
@@ -727,8 +727,8 @@ static int _emit_target_line(struct dev_manager *dm, struct dm_task *dmt,
        return 1;
 }
 
-static int _build_dev_string(struct dev_manager *dm, char *dlid,
-                            char *devbuf, size_t bufsize, const char *desc)
+int build_dev_string(struct dev_manager *dm, char *dlid, char *devbuf,
+                    size_t bufsize, const char *desc)
 {
        struct dev_layer *dl;
 
@@ -749,45 +749,6 @@ static int _build_dev_string(struct dev_manager *dm, char *dlid,
        return 1;
 }
 
-int compose_log_line(struct dev_manager *dm, struct lv_segment *seg,
-                    char *params, size_t paramsize, int *pos, int areas,
-                    uint32_t region_size)
-{
-       int tw;
-       char devbuf[10];
-       char *name;
-
-       if (!seg->log_lv)
-               tw = lvm_snprintf(params, paramsize, "core 1 %u %u ",
-                                 region_size, areas);
-       else {
-               if (!(name = build_dm_name(dm->mem, seg->log_lv->vg->name,
-                                          seg->log_lv->name, NULL))) {
-                       stack;
-                       return 0;
-               }
-
-               if (!_build_dev_string(dm, seg->log_lv->lvid.s, devbuf,
-                                      sizeof(devbuf), "log")) {
-                       stack;
-                       return 0;
-               }
-
-               /* FIXME add sync parm? */
-               tw = lvm_snprintf(params, paramsize, "disk 2 %s %u %u ",
-                                 devbuf, region_size, areas);
-       }
-
-       if (tw < 0) {
-               stack;
-               return -1;
-       }
-
-       *pos += tw;
-
-       return 1;
-}
-
 int compose_areas_line(struct dev_manager *dm, struct lv_segment *seg,
                       char *params, size_t paramsize, int *pos, int start_area,
                       int areas)
@@ -816,8 +777,8 @@ int compose_areas_line(struct dev_manager *dm, struct lv_segment *seg,
                                           (esize * seg_pe(seg, s))),
                                          trailing_space);
                else if (seg_type(seg, s) == AREA_LV) {
-                       if (!_build_dev_string(dm, seg_lv(seg, s)->lvid.s, devbuf,
-                                              sizeof(devbuf), "LV")) {
+                       if (!build_dev_string(dm, seg_lv(seg, s)->lvid.s, devbuf,
+                                             sizeof(devbuf), "LV")) {
                                stack;
                                return 0;
                        }
@@ -901,7 +862,7 @@ static int _populate_origin(struct dev_manager *dm,
                return 0;
        }
 
-       if (!_build_dev_string(dm, real, params, sizeof(params), "origin")) {
+       if (!build_dev_string(dm, real, params, sizeof(params), "origin")) {
                stack;
                return 0;
        }
@@ -942,13 +903,12 @@ static int _populate_snapshot(struct dev_manager *dm,
                return 0;
        }
 
-       if (!_build_dev_string(dm, origin, devbufo, sizeof(devbufo),
-                              "origin")) {
+       if (!build_dev_string(dm, origin, devbufo, sizeof(devbufo), "origin")) {
                stack;
                return 0;
        }
 
-       if (!_build_dev_string(dm, cow, devbufc, sizeof(devbufc), "cow")) {
+       if (!build_dev_string(dm, cow, devbufc, sizeof(devbufc), "cow")) {
                stack;
                return 0;
        }
index 960d7291fa135738aa16eacafdae9e9d82bfbd99..079a481361e386773b6e507de85134a97eab630e 100644 (file)
@@ -23,8 +23,7 @@ int compose_areas_line(struct dev_manager *dm, struct lv_segment *seg,
                       char *params, size_t paramsize, int *pos,
                       int start_area, int areas);
 
-int compose_log_line(struct dev_manager *dm, struct lv_segment *seg,
-                    char *params, size_t paramsize, int *pos, int areas,
-                    uint32_t region_size);
+int build_dev_string(struct dev_manager *dm, char *dlid, char *devbuf,
+                    size_t bufsize, const char *desc);
 
 #endif
index 67f97dd7d7cad99b679be1ba4e4abed95881738d..6844d18b539c380f997cc264cb1c466e84f7e366 100644 (file)
@@ -165,6 +165,38 @@ static struct mirror_state *_init_target(struct pool *mem,
        return mirr_state;
 }
 
+static int _compose_log_line(struct dev_manager *dm, struct lv_segment *seg,
+                            char *params, size_t paramsize, int *pos,
+                            int areas, uint32_t region_size)
+{
+       int tw;
+       char devbuf[10];
+
+       if (!seg->log_lv)
+               tw = lvm_snprintf(params, paramsize, "core 1 %u %u ",
+                                 region_size, areas);
+       else {
+               if (!build_dev_string(dm, seg->log_lv->lvid.s, devbuf,
+                                     sizeof(devbuf), "log")) {
+                       stack;
+                       return 0;
+               }
+
+               /* FIXME add sync parm? */
+               tw = lvm_snprintf(params, paramsize, "disk 2 %s %u %u ",
+                                 devbuf, region_size, areas);
+       }
+
+       if (tw < 0) {
+               stack;
+               return -1;
+       }
+
+       *pos += tw;
+
+       return 1;
+}
+
 static int _compose_target_line(struct dev_manager *dm, struct pool *mem,
                                struct config_tree *cft, void **target_state,
                                struct lv_segment *seg, char *params,
@@ -220,8 +252,8 @@ static int _compose_target_line(struct dev_manager *dm, struct pool *mem,
                        }
                }
 
-               if ((ret = compose_log_line(dm, seg, params, paramsize, pos,
-                                           areas, region_size)) <= 0) {
+               if ((ret = _compose_log_line(dm, seg, params, paramsize, pos,
+                                            areas, region_size)) <= 0) {
                        stack;
                        return ret;
                }
This page took 0.047643 seconds and 5 git commands to generate.