return tags_format_and_copy(mem, modules);
}
-static char *_do_lv_mirror_log_dup(struct dm_pool *mem, const struct logical_volume *lv,
- int uuid)
+struct logical_volume *lv_mirror_log_lv(const struct logical_volume *lv)
{
struct lv_segment *seg;
dm_list_iterate_items(seg, &lv->segments) {
- if (seg_is_mirrored(seg) && seg->log_lv) {
- if (uuid)
- return lv_uuid_dup(mem, seg->log_lv);
- else
- return lv_name_dup(mem, seg->log_lv);
- }
+ if (seg_is_mirrored(seg) && seg->log_lv)
+ return seg->log_lv;
}
return NULL;
}
+static char *_do_lv_mirror_log_dup(struct dm_pool *mem, const struct logical_volume *lv,
+ int uuid)
+{
+ struct logical_volume *mirror_log_lv = lv_mirror_log_lv(lv);
+
+ if (!mirror_log_lv)
+ return NULL;
+
+ if (uuid)
+ return lv_uuid_dup(mem, mirror_log_lv);
+ else
+ return lv_name_dup(mem, mirror_log_lv);
+}
+
char *lv_mirror_log_dup(struct dm_pool *mem, const struct logical_volume *lv)
{
return _do_lv_mirror_log_dup(mem, lv, 0);
return _field_set_value(field, name, NULL);
}
-static int _do_loglv_disp(struct dm_report *rh, struct dm_pool *mem,
- struct dm_report_field *field,
- const void *data, void *private,
- int uuid)
-{
- const struct logical_volume *lv = (const struct logical_volume *) data;
- const char *repstr = NULL;
-
- if (uuid)
- repstr = lv_mirror_log_uuid_dup(mem, lv);
- else
- repstr = lv_mirror_log_dup(mem, lv);
-
- if (repstr)
- return _string_disp(rh, mem, field, &repstr, private);
-
- return _field_set_value(field, "", NULL);
-}
-
-static int _loglv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
- struct dm_report_field *field,
- const void *data, void *private __attribute__((unused)))
-{
- return _do_loglv_disp(rh, mem, field, data, private, 0);
-}
-
-static int _loglvuuid_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
- struct dm_report_field *field,
- const void *data, void *private __attribute__((unused)))
-{
- return _do_loglv_disp(rh, mem, field, data, private, 1);
-}
-
static int _lvname_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
return _field_set_value(field, repstr, lvname);
}
+static int _do_loglv_disp(struct dm_report *rh, struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data, void *private,
+ int uuid)
+{
+ const struct logical_volume *lv = (const struct logical_volume *) data;
+ struct logical_volume *mirror_log_lv = lv_mirror_log_lv(lv);
+
+ if (!mirror_log_lv)
+ return _field_set_value(field, "", NULL);
+
+ if (uuid)
+ return _uuid_disp(rh, mem, field, &mirror_log_lv->lvid.id[1], private);
+ else
+ return _lvname_disp(rh, mem, field, mirror_log_lv, private);
+}
+
+static int _loglv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
+ struct dm_report_field *field,
+ const void *data, void *private __attribute__((unused)))
+{
+ return _do_loglv_disp(rh, mem, field, data, private, 0);
+}
+
+static int _loglvuuid_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
+ struct dm_report_field *field,
+ const void *data, void *private __attribute__((unused)))
+{
+ return _do_loglv_disp(rh, mem, field, data, private, 1);
+}
+
static int _lvfullname_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private __attribute__((unused)))