return -1;
}
-static char *_do_lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv,
- int uuid)
+struct logical_volume *lv_convert_lv(const struct logical_volume *lv)
{
struct lv_segment *seg;
/* Temporary mirror is always area_num == 0 */
if (seg_type(seg, 0) == AREA_LV &&
- is_temporary_mirror_layer(seg_lv(seg, 0))) {
- if (uuid)
- return lv_uuid_dup(mem, seg_lv(seg, 0));
- else
- return lv_name_dup(mem, seg_lv(seg, 0));
- }
+ is_temporary_mirror_layer(seg_lv(seg, 0)))
+ return seg_lv(seg, 0);
}
+
+ return NULL;
+}
+
+static char *_do_lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv,
+ int uuid)
+{
+ struct logical_volume *convert_lv = lv_convert_lv(lv);
+
+ if (convert_lv) {
+ if (uuid)
+ return lv_uuid_dup(mem, convert_lv);
+ else
+ return lv_name_dup(mem, convert_lv);
+ }
+
return NULL;
}
char *lv_name_dup(struct dm_pool *mem, const struct logical_volume *lv);
char *lv_fullname_dup(struct dm_pool *mem, const struct logical_volume *lv);
struct logical_volume *lv_parent(const struct logical_volume *lv);
+struct logical_volume *lv_convert_lv(const struct logical_volume *lv);
char *lv_parent_dup(struct dm_pool *mem, const struct logical_volume *lv);
char *lv_origin_dup(struct dm_pool *mem, const struct logical_volume *lv);
char *lv_origin_uuid_dup(struct dm_pool *mem, const struct logical_volume *lv);
return dm_report_field_string(rh, field, (const char * const *) &data);
}
-static int _uuid_disp(struct dm_report *rh __attribute__((unused)), struct dm_pool *mem,
+static int _uuid_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
- const void *data, void *private __attribute__((unused)))
+ const void *data, void *private)
{
char *repstr;
int uuid)
{
const struct logical_volume *lv = (const struct logical_volume *) data;
- const char *repstr;
+ const struct logical_volume *convert_lv = lv_convert_lv(lv);
+
+ if (!convert_lv)
+ return _field_set_value(field, "", NULL);
if (uuid)
- repstr = lv_convert_lv_uuid_dup(mem, lv);
+ return _uuid_disp(rh, mem, field, &convert_lv->lvid.id[1], private);
else
- repstr = lv_convert_lv_dup(mem, lv);
-
- if (repstr)
- return _string_disp(rh, mem, field, &repstr, private);
-
- return _field_set_value(field, "", NULL);
+ return _lvname_disp(rh, mem, field, convert_lv, private);
}
static int _convertlv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),